Skip to content
Merged
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
27 changes: 24 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ jobs:
env:
version: "14.3"
freebsd_vm_memory: "8G"
freebsd_swapfile_mb: "2048"
strategy:
matrix:
compiler: ["CLANG"]
Expand Down Expand Up @@ -420,10 +421,11 @@ jobs:
memory: ${{ env.freebsd_vm_memory }}
run: |
bash -c "sudo pkg install -y llvm21 gmake unzip libunwind"
bash -c "sudo pkg clean -ay"
bash -c "sudo ln -sf $(command -v llvm-config21) /usr/local/bin/llvm-config"
bash -c "curl -fsSL https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.sh -o xmake-get.sh"
bash -c "bash xmake-get.sh"
bash -c "source ~/.xmake/profile && xmake f -y -m ${{ matrix.mode }} --policies=${{ matrix.policies }} --use-llvm-compiler=y --sdk="$(llvm-config21 --prefix)" --march=none --static=none --includedirs=/usr/local/include --linkdirs=/usr/local/lib --syslinks=unwind"
bash -c "source ~/.xmake/profile && xmake f -y -m ${{ matrix.mode }} --policies=${{ matrix.policies }} --use-llvm-compiler=y --sdk="$(llvm-config21 --prefix)" --march=none --static=none --strip=symbol --cxflags=-g1 --includedirs=/usr/local/include --linkdirs=/usr/local/lib --syslinks=unwind"
- name: Configure
if: matrix.compiler == 'GCC'
uses: cross-platform-actions/action@v0.30.0
Expand All @@ -433,16 +435,35 @@ jobs:
memory: ${{ env.freebsd_vm_memory }}
run: |
bash -c "sudo pkg install -y gcc16-devel gmake unzip"
bash -c "sudo pkg clean -ay"
bash -c "curl -fsSL https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.sh -o xmake-get.sh"
bash -c "bash xmake-get.sh"
bash -c "source ~/.xmake/profile && xmake f -y -m ${{ matrix.mode }} --policies=${{ matrix.policies }} --cc=gcc16 --cxx=g++16 --ld=g++16 --march=none --static=none"
bash -c "source ~/.xmake/profile && xmake f -y -m ${{ matrix.mode }} --policies=${{ matrix.policies }} --cc=gcc16 --cxx=g++16 --ld=g++16 --march=none --static=none --strip=symbol --cxflags=-g1"
- name: Build and check
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: freebsd
version: ${{ env.version }}
memory: ${{ env.freebsd_vm_memory }}
run: |
bash -c "source ~/.xmake/profile && xmake b -rv -j1 || { rc=\$?; swapinfo || true; dmesg | tail -n 80 || true; exit \$rc; }"
bash <<'FREEBSD_CI_SWAP'
set -eux
swapfile=/usr/swap0
sudo dd if=/dev/zero of="${swapfile}" bs=1m count=${{ env.freebsd_swapfile_mb }}
sudo chmod 0600 "${swapfile}"
swapdev="$(sudo mdconfig -a -t vnode -f "${swapfile}")"
case "${swapdev}" in
/dev/*) ;;
md*) swapdev="/dev/${swapdev}" ;;
*) swapdev="/dev/md${swapdev}" ;;
esac
sudo swapon "${swapdev}"
swapinfo
df -h / /usr || true
FREEBSD_CI_SWAP
bash -c "source ~/.xmake/profile && xmake b -rv -j1 || { rc=\$?; swapinfo || true; df -h / /usr || true; dmesg | tail -n 80 || true; exit \$rc; }"
bash -c "source ~/.xmake/profile && export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 && xmake run uwvm --version"
bash -c "source ~/.xmake/profile && xmake clean -y uwvm || true"
bash -c "source ~/.xmake/profile && xmake clean -y uwvm_runtime || true"
bash -c "df -h / /usr || true"
bash -c "source ~/.xmake/profile && export UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 && xmake test -v -j1"
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1p1::features
::std::byte const* const sec_id_module_ptr) UWVM_THROWS
{
auto const& para{::uwvm2::parser::wasm::standard::wasm1p1::features::get_wasm1p1_parameter(fs_para)};
if(!para.enable_bulk_memory) [[unlikely]]
if(para.disable_bulk_memory) [[unlikely]]
{
err.err_curr = sec_id_module_ptr;
err.err_selectable.wasm1p1_feature_required.value =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
}
case ::uwvm2::parser::wasm::standard::wasm1p1::features::wasm1p1_data_type_t::passive:
{
if(!para.enable_bulk_memory) [[unlikely]]
if(para.disable_bulk_memory) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = static_cast<wasm_u32>(fdt_type);
Expand All @@ -432,7 +432,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
}
case ::uwvm2::parser::wasm::standard::wasm1p1::features::wasm1p1_data_type_t::active_explicit:
{
if(!para.enable_bulk_memory) [[unlikely]]
if(para.disable_bulk_memory) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = static_cast<wasm_u32>(fdt_type);
Expand Down
41 changes: 21 additions & 20 deletions src/uwvm2/parser/wasm/standard/wasm1p1/features/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,31 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1p1::features
struct wasm1p1;

/// @brief Runtime switches for independent WebAssembly 1.1 feature groups.
/// @details The disable_* fields are false by default, so WebAssembly 1.1 features are enabled unless the user explicitly disables them.
/// @details The explicit_* fields record CLI ownership so the feature collection and its subfeatures can report conflicts deterministically.
/// @warning Extension point: every new wasm1.1 subfeature flag needs CLI ownership, feature conflict handling, parser gating, and ECO output.
struct wasm_binfmt1p1_feature_parameter
{
bool enable_multi_value{};
bool enable_reference_types{};
bool enable_bulk_memory{};
bool enable_sign_extension{};
bool enable_nontrapping_float_to_int{};
bool enable_simd{};

bool explicit_feature_1p1{};
bool explicit_enable_multi_value{};
bool explicit_enable_reference_types{};
bool explicit_enable_bulk_memory{};
bool explicit_enable_sign_extension{};
bool explicit_enable_nontrapping_float_to_int{};
bool explicit_enable_simd{};
bool disable_multi_value{};
bool disable_reference_types{};
bool disable_bulk_memory{};
bool disable_sign_extension{};
bool disable_nontrapping_float_to_int{};
bool disable_simd{};

bool explicit_feature_mvp{};
bool explicit_disable_multi_value{};
bool explicit_disable_reference_types{};
bool explicit_disable_bulk_memory{};
bool explicit_disable_sign_extension{};
bool explicit_disable_nontrapping_float_to_int{};
bool explicit_disable_simd{};

wasm1p1_parser_limit_t parser_limit{};

/// @brief Preserve wasm1 validation when wasm1p1 is compiled in but the runtime flags are still disabled.
bool controllable_allow_multi_result_vector{true};
bool controllable_allow_multi_table{true};
/// @brief Re-enable wasm1 validation when a wasm1p1 feature that relaxes MVP syntax is explicitly disabled.
bool controllable_allow_multi_result_vector{};
bool controllable_allow_multi_table{};
};

/// @brief Get the const wasm1.1 feature parameter from a parser feature-parameter tuple.
Expand Down Expand Up @@ -105,9 +106,9 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1p1::features
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::i64: [[fallthrough]];
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::f32: [[fallthrough]];
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::f64: return true;
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::v128: return para.enable_simd;
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::v128: return !para.disable_simd;
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::funcref: [[fallthrough]];
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::externref: return para.enable_reference_types;
case ::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::externref: return !para.disable_reference_types;
default: return false;
}
}
Expand All @@ -126,7 +127,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1p1::features
// funcref remains the MVP table element type. Reference-typed locals/globals are gated by value_type_enabled instead.
return true;
}
case ::uwvm2::parser::wasm::standard::wasm1p1::type::reference_type::externref: return para.enable_reference_types;
case ::uwvm2::parser::wasm::standard::wasm1p1::type::reference_type::externref: return !para.disable_reference_types;
default: return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features

auto const require_bulk_memory = [&]() UWVM_THROWS
{
if(!para.enable_bulk_memory) [[unlikely]]
if(para.disable_bulk_memory) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = static_cast<wasm_u32>(fet_type);
Expand All @@ -785,7 +785,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features

auto const require_reference_types = [&]() UWVM_THROWS
{
if(!para.enable_reference_types) [[unlikely]]
if(para.disable_reference_types) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = static_cast<wasm_u32>(fet_type);
Expand Down
6 changes: 3 additions & 3 deletions src/uwvm2/parser/wasm/standard/wasm1p1/features/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
case static_cast<::uwvm2::parser::wasm::standard::wasm1::type::op_basic_type>(0xD0u):
{
auto const& para{::uwvm2::parser::wasm::standard::wasm1p1::features::get_wasm1p1_parameter(fs_para)};
if(!para.enable_reference_types) [[unlikely]]
if(para.disable_reference_types) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = 0xD0u;
Expand Down Expand Up @@ -675,7 +675,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
case static_cast<::uwvm2::parser::wasm::standard::wasm1::type::op_basic_type>(0xD2u):
{
auto const& para{::uwvm2::parser::wasm::standard::wasm1p1::features::get_wasm1p1_parameter(fs_para)};
if(!para.enable_reference_types) [[unlikely]]
if(para.disable_reference_types) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = 0xD2u;
Expand Down Expand Up @@ -744,7 +744,7 @@ UWVM_MODULE_EXPORT namespace uwvm2::parser::wasm::standard::wasm1::features
case static_cast<::uwvm2::parser::wasm::standard::wasm1::type::op_basic_type>(0xFDu):
{
auto const& para{::uwvm2::parser::wasm::standard::wasm1p1::features::get_wasm1p1_parameter(fs_para)};
if(!para.enable_simd) [[unlikely]]
if(para.disable_simd) [[unlikely]]
{
err.err_curr = section_curr;
err.err_selectable.wasm1p1_feature_required.value = 0xFDu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ case static_cast<wasm1_code>(wasm1p1_code::select_t):

return static_cast<::uwvm2::parser::wasm::standard::wasm1p1::type::value_type>(type) ==
::uwvm2::parser::wasm::standard::wasm1p1::type::value_type::v128 &&
wasm1p1_para.enable_simd;
!wasm1p1_para.disable_simd;
}};

auto const validate_select_condition{[&](concrete_operand_t cond) constexpr UWVM_THROWS
Expand Down Expand Up @@ -142,7 +142,7 @@ case static_cast<wasm1_code>(wasm1p1_code::select_t):
case static_cast<wasm1_code>(wasm1p1_code::i32_extend8_s):
{
auto const op_begin{code_curr};
if(!wasm1p1_para.enable_sign_extension) [[unlikely]]
if(wasm1p1_para.disable_sign_extension) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
opcode_byte(wasm1p1_code::i32_extend8_s),
Expand Down Expand Up @@ -176,7 +176,7 @@ case static_cast<wasm1_code>(wasm1p1_code::i32_extend8_s):
case static_cast<wasm1_code>(wasm1p1_code::i32_extend16_s):
{
auto const op_begin{code_curr};
if(!wasm1p1_para.enable_sign_extension) [[unlikely]]
if(wasm1p1_para.disable_sign_extension) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
opcode_byte(wasm1p1_code::i32_extend16_s),
Expand Down Expand Up @@ -210,7 +210,7 @@ case static_cast<wasm1_code>(wasm1p1_code::i32_extend16_s):
case static_cast<wasm1_code>(wasm1p1_code::i64_extend8_s):
{
auto const op_begin{code_curr};
if(!wasm1p1_para.enable_sign_extension) [[unlikely]]
if(wasm1p1_para.disable_sign_extension) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
opcode_byte(wasm1p1_code::i64_extend8_s),
Expand Down Expand Up @@ -244,7 +244,7 @@ case static_cast<wasm1_code>(wasm1p1_code::i64_extend8_s):
case static_cast<wasm1_code>(wasm1p1_code::i64_extend16_s):
{
auto const op_begin{code_curr};
if(!wasm1p1_para.enable_sign_extension) [[unlikely]]
if(wasm1p1_para.disable_sign_extension) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
opcode_byte(wasm1p1_code::i64_extend16_s),
Expand Down Expand Up @@ -278,7 +278,7 @@ case static_cast<wasm1_code>(wasm1p1_code::i64_extend16_s):
case static_cast<wasm1_code>(wasm1p1_code::i64_extend32_s):
{
auto const op_begin{code_curr};
if(!wasm1p1_para.enable_sign_extension) [[unlikely]]
if(wasm1p1_para.disable_sign_extension) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
opcode_byte(wasm1p1_code::i64_extend32_s),
Expand Down Expand Up @@ -323,7 +323,7 @@ case static_cast<wasm1_code>(wasm1p1_code::numeric_prefix):
curr_operand_stack_value_type operand_type,
curr_operand_stack_value_type result_type) constexpr UWVM_THROWS
{
if(!wasm1p1_para.enable_nontrapping_float_to_int) [[unlikely]]
if(wasm1p1_para.disable_nontrapping_float_to_int) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
subopcode,
Expand Down Expand Up @@ -507,7 +507,7 @@ case static_cast<wasm1_code>(wasm1p1_code::numeric_prefix):
break;
case wasm1p1_numeric_code::memory_copy:
{
if(!wasm1p1_para.enable_bulk_memory) [[unlikely]]
if(wasm1p1_para.disable_bulk_memory) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
subopcode,
Expand All @@ -524,7 +524,7 @@ case static_cast<wasm1_code>(wasm1p1_code::numeric_prefix):
}
case wasm1p1_numeric_code::memory_fill:
{
if(!wasm1p1_para.enable_bulk_memory) [[unlikely]]
if(wasm1p1_para.disable_bulk_memory) [[unlikely]]
{
fail_wasm1p1_feature_required(op_begin,
subopcode,
Expand Down
Loading
Loading