HF one entry point (#7393)

Add one entry point for all HF for centralized exceptions handling, gas calculation and general checks.
Add exception handling for HF
Add FieldLocator object
Switch pointers to references for HF and runtime
Max size for parameters and sfData field is 1 kb now
Fix Allhf unittest, to provide correct locator
This commit is contained in:
Olek
2026-06-03 21:53:12 -04:00
committed by GitHub
parent 0dbe51c740
commit d582ae7990
15 changed files with 1050 additions and 2448 deletions

View File

@@ -252,10 +252,7 @@ constexpr std::uint8_t kVaultMaximumIouScale = 18;
constexpr std::uint8_t kMaxAssetCheckDepth = 5;
/** Maximum length of a Data field in Escrow object that can be updated by WASM code. */
constexpr std::size_t kMaxWasmDataLength = 4 * 1024; // 4KB
/** Maximum length of parameters passed from WASM code to host functions. */
constexpr std::size_t kMaxWasmParamLength = 1024; // 1KB
constexpr std::size_t kMaxWasmDataLength = 1 * 1024; // 1KB
/** A ledger index. */
using LedgerIndex = std::uint32_t;

View File

@@ -10,6 +10,9 @@
#include <xrpl/protocol/UintTypes.h>
#include <xrpl/tx/wasm/WasmCommon.h>
#include <stdexcept>
#include <string>
namespace xrpl {
namespace wasm_float {
@@ -85,12 +88,12 @@ public:
rt_ = std::nullopt;
}
[[nodiscard]] WasmRuntimeWrapper*
[[nodiscard]] WasmRuntimeWrapper&
getRT() const
{
if (!rt_)
return nullptr; // LCOV_EXCL_LINE
return &rt_->get();
Throw<std::logic_error>("Wasm runtime not set");
return rt_->get();
}
[[nodiscard]] beast::Journal
@@ -168,19 +171,19 @@ public:
}
virtual Expected<Bytes, HostFunctionError>
getTxNestedField(Slice const& locator) const
getTxNestedField(FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}
virtual Expected<Bytes, HostFunctionError>
getCurrentLedgerObjNestedField(Slice const& locator) const
getCurrentLedgerObjNestedField(FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}
virtual Expected<Bytes, HostFunctionError>
getLedgerObjNestedField(int32_t cacheIdx, Slice const& locator) const
getLedgerObjNestedField(int32_t cacheIdx, FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}
@@ -204,19 +207,19 @@ public:
}
virtual Expected<int32_t, HostFunctionError>
getTxNestedArrayLen(Slice const& locator) const
getTxNestedArrayLen(FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}
virtual Expected<int32_t, HostFunctionError>
getCurrentLedgerObjNestedArrayLen(Slice const& locator) const
getCurrentLedgerObjNestedArrayLen(FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}
virtual Expected<int32_t, HostFunctionError>
getLedgerObjNestedArrayLen(int32_t cacheIdx, Slice const& locator) const
getLedgerObjNestedArrayLen(int32_t cacheIdx, FieldLocator const& locator) const
{
return Unexpected(HostFunctionError::Internal);
}

View File

@@ -108,13 +108,13 @@ public:
getLedgerObjField(int32_t cacheIdx, SField const& fname) const override;
Expected<Bytes, HostFunctionError>
getTxNestedField(Slice const& locator) const override;
getTxNestedField(FieldLocator const& locator) const override;
Expected<Bytes, HostFunctionError>
getCurrentLedgerObjNestedField(Slice const& locator) const override;
getCurrentLedgerObjNestedField(FieldLocator const& locator) const override;
Expected<Bytes, HostFunctionError>
getLedgerObjNestedField(int32_t cacheIdx, Slice const& locator) const override;
getLedgerObjNestedField(int32_t cacheIdx, FieldLocator const& locator) const override;
Expected<int32_t, HostFunctionError>
getTxArrayLen(SField const& fname) const override;
@@ -126,13 +126,13 @@ public:
getLedgerObjArrayLen(int32_t cacheIdx, SField const& fname) const override;
Expected<int32_t, HostFunctionError>
getTxNestedArrayLen(Slice const& locator) const override;
getTxNestedArrayLen(FieldLocator const& locator) const override;
Expected<int32_t, HostFunctionError>
getCurrentLedgerObjNestedArrayLen(Slice const& locator) const override;
getCurrentLedgerObjNestedArrayLen(FieldLocator const& locator) const override;
Expected<int32_t, HostFunctionError>
getLedgerObjNestedArrayLen(int32_t cacheIdx, Slice const& locator) const override;
getLedgerObjNestedArrayLen(int32_t cacheIdx, FieldLocator const& locator) const override;
Expected<int32_t, HostFunctionError>
updateData(Slice const& data) override;

View File

@@ -8,110 +8,86 @@
namespace xrpl {
#define WASM_CB_PARAMS_LIST void *env, wasm_val_vec_t const *params, wasm_val_vec_t *results
#define WASM_SECONDARY_CB_PARAMS_LIST \
HostFunctions &hf, wasm_val_vec_t const *params, wasm_val_vec_t *results
wasm_trap_t* HostFuncMain_wrap(WASM_CB_PARAMS_LIST);
using getLedgerSqn_proto = int32_t(uint8_t*, int32_t);
wasm_trap_t*
getLedgerSqn_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getLedgerSqn_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getParentLedgerTime_proto = int32_t(uint8_t*, int32_t);
wasm_trap_t*
getParentLedgerTime_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getParentLedgerTime_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getParentLedgerHash_proto = int32_t(uint8_t*, int32_t);
wasm_trap_t*
getParentLedgerHash_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getParentLedgerHash_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getBaseFee_proto = int32_t(uint8_t*, int32_t);
wasm_trap_t*
getBaseFee_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getBaseFee_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using isAmendmentEnabled_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
isAmendmentEnabled_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* isAmendmentEnabled_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using cacheLedgerObj_proto = int32_t(uint8_t const*, int32_t, int32_t);
wasm_trap_t*
cacheLedgerObj_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* cacheLedgerObj_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getTxField_proto = int32_t(int32_t, uint8_t*, int32_t);
wasm_trap_t*
getTxField_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getTxField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getCurrentLedgerObjField_proto = int32_t(int32_t, uint8_t*, int32_t);
wasm_trap_t*
getCurrentLedgerObjField_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getCurrentLedgerObjField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getLedgerObjField_proto = int32_t(int32_t, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getLedgerObjField_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getLedgerObjField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getTxNestedField_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getTxNestedField_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getTxNestedField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getCurrentLedgerObjNestedField_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getCurrentLedgerObjNestedField_wrap(
void* env,
wasm_val_vec_t const* params,
wasm_val_vec_t* results);
wasm_trap_t* getCurrentLedgerObjNestedField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getLedgerObjNestedField_proto = int32_t(int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getLedgerObjNestedField_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getLedgerObjNestedField_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getTxArrayLen_proto = int32_t(int32_t);
wasm_trap_t*
getTxArrayLen_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getTxArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getCurrentLedgerObjArrayLen_proto = int32_t(int32_t);
wasm_trap_t*
getCurrentLedgerObjArrayLen_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getCurrentLedgerObjArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getLedgerObjArrayLen_proto = int32_t(int32_t, int32_t);
wasm_trap_t*
getLedgerObjArrayLen_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getLedgerObjArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getTxNestedArrayLen_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
getTxNestedArrayLen_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getTxNestedArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getCurrentLedgerObjNestedArrayLen_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
getCurrentLedgerObjNestedArrayLen_wrap(
void* env,
wasm_val_vec_t const* params,
wasm_val_vec_t* results);
wasm_trap_t* getCurrentLedgerObjNestedArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getLedgerObjNestedArrayLen_proto = int32_t(int32_t, uint8_t const*, int32_t);
wasm_trap_t*
getLedgerObjNestedArrayLen_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getLedgerObjNestedArrayLen_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using updateData_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
updateData_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* updateData_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using checkSignature_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t const*, int32_t);
wasm_trap_t*
checkSignature_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* checkSignature_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using computeSha512HalfHash_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
computeSha512HalfHash_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* computeSha512HalfHash_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using accountKeylet_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
accountKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* accountKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using ammKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
ammKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* ammKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using checkKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
checkKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* checkKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using credentialKeylet_proto = int32_t(
uint8_t const*,
@@ -122,27 +98,22 @@ using credentialKeylet_proto = int32_t(
int32_t,
uint8_t*,
int32_t);
wasm_trap_t*
credentialKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* credentialKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using delegateKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
delegateKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* delegateKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using depositPreauthKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
depositPreauthKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* depositPreauthKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using didKeylet_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
didKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* didKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using escrowKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
escrowKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* escrowKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using lineKeylet_proto = int32_t(
uint8_t const*,
@@ -153,33 +124,27 @@ using lineKeylet_proto = int32_t(
int32_t,
uint8_t*,
int32_t);
wasm_trap_t*
lineKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* lineKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using mptIssuanceKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
mptIssuanceKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* mptIssuanceKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using mptokenKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
mptokenKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* mptokenKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using nftOfferKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
nftOfferKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* nftOfferKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using offerKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
offerKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* offerKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using oracleKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
oracleKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* oracleKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using paychanKeylet_proto = int32_t(
uint8_t const*,
@@ -190,130 +155,100 @@ using paychanKeylet_proto = int32_t(
int32_t,
uint8_t*,
int32_t);
wasm_trap_t*
paychanKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* paychanKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using permissionedDomainKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
permissionedDomainKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* permissionedDomainKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using signersKeylet_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
signersKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* signersKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using ticketKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
ticketKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* ticketKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using vaultKeylet_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
vaultKeylet_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* vaultKeylet_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFT_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getNFT_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFT_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFTIssuer_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getNFTIssuer_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFTIssuer_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFTTaxon_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getNFTTaxon_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFTTaxon_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFTFlags_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
getNFTFlags_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFTFlags_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFTTransferFee_proto = int32_t(uint8_t const*, int32_t);
wasm_trap_t*
getNFTTransferFee_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFTTransferFee_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using getNFTSerial_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
getNFTSerial_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* getNFTSerial_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using trace_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, int32_t);
wasm_trap_t*
trace_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* trace_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using traceNum_proto = int32_t(uint8_t const*, int32_t, int64_t);
wasm_trap_t*
traceNum_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* traceNum_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using traceAccount_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t);
wasm_trap_t*
traceAccount_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* traceAccount_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using traceFloat_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t);
wasm_trap_t*
traceFloat_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* traceFloat_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using traceAmount_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t);
wasm_trap_t*
traceAmount_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* traceAmount_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatFromInt_proto = int32_t(int64_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatFromInt_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatFromInt_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatFromUint_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatFromUint_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatFromUint_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatFromSTAmount_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatFromSTAmount_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatFromSTAmount_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatFromSTNumber_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatFromSTNumber_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatFromSTNumber_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatToInt_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatToInt_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatToInt_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatToMantExp_proto = int32_t(uint8_t const*, int32_t, uint8_t*, int32_t, uint8_t*, int32_t);
wasm_trap_t*
floatToMantExp_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatToMantExp_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatFromMantExp_proto = int32_t(int64_t, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatFromMantExp_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatFromMantExp_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatCompare_proto = int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t);
wasm_trap_t*
floatCompare_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatCompare_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatAdd_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatAdd_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatAdd_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatSubtract_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatSubtract_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatSubtract_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatMultiply_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatMultiply_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatMultiply_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatDivide_proto =
int32_t(uint8_t const*, int32_t, uint8_t const*, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatDivide_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatDivide_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatRoot_proto = int32_t(uint8_t const*, int32_t, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatRoot_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatRoot_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
using floatPower_proto = int32_t(uint8_t const*, int32_t, int32_t, uint8_t*, int32_t, int32_t);
wasm_trap_t*
floatPower_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
wasm_trap_t* floatPower_wrap(WASM_SECONDARY_CB_PARAMS_LIST);
} // namespace xrpl

View File

@@ -1,6 +1,7 @@
#pragma once
#include <xrpl/basics/base_uint.h>
#include <xrpl/basics/contract.h>
#include <functional>
#include <optional>
@@ -60,6 +61,56 @@ struct WasmResult
};
using EscrowResult = WasmResult<int32_t>;
class FieldLocator
{
int32_t const* ptr_ = nullptr;
uint32_t size_ = 0;
std::vector<int32_t> buf_;
public:
FieldLocator(std::vector<int32_t>&& buf)
: ptr_(&buf[0]), size_(buf.size()), buf_(std::move(buf))
{
}
FieldLocator(int32_t const* ptr, uint32_t const size) : ptr_(ptr), size_(size)
{
}
FieldLocator(FieldLocator const&) = delete;
FieldLocator&
operator=(FieldLocator const&) = delete;
FieldLocator(FieldLocator&&) = default;
FieldLocator&
operator=(FieldLocator&&) = default;
int32_t
operator[](unsigned i) const
{
if (i >= size_)
Throw<std::runtime_error>("index out of bounds");
return ptr_[i];
}
[[nodiscard]] uint32_t
size() const
{
return size_;
}
[[nodiscard]] int32_t const*
data() const
{
return ptr_;
}
[[nodiscard]] bool
empty() const
{
return size_ == 0;
}
};
class WasmRuntimeWrapper
{
public:

View File

@@ -14,13 +14,16 @@ namespace bft = boost::function_types;
namespace xrpl {
using wasmSecondaryCbFuncType =
wasm_trap_t*(HostFunctions&, wasm_val_vec_t const*, wasm_val_vec_t*);
struct WasmImportFunc
{
std::string_view name;
std::optional<WasmTypes> result;
std::vector<WasmTypes> params;
// wasm_func_callback_with_env_t
void* wrap = nullptr;
wasmSecondaryCbFuncType* wrap = nullptr;
uint32_t gas = 0;
};
@@ -105,7 +108,7 @@ void
WasmImpFunc(
ImportVec& v,
std::string_view impName,
void* fWrap,
wasmSecondaryCbFuncType* fWrap,
HostFunctions& hf,
uint32_t gas = 0)
{
@@ -117,11 +120,9 @@ WasmImpFunc(
v.emplace(impName, std::make_pair(HFRef(hf), std::move(e)));
}
#define WASM_IMPORT_FUNC(v, f, ...) \
WasmImpFunc<f##_proto>(v, #f, reinterpret_cast<void*>(&f##_wrap), ##__VA_ARGS__)
#define WASM_IMPORT_FUNC(v, f, ...) WasmImpFunc<f##_proto>(v, #f, &f##_wrap, ##__VA_ARGS__)
// n - string literal name, must have static lifetime
#define WASM_IMPORT_FUNC2(v, f, n, ...) \
WasmImpFunc<f##_proto>(v, n, reinterpret_cast<void*>(&f##_wrap), ##__VA_ARGS__)
#define WASM_IMPORT_FUNC2(v, f, n, ...) WasmImpFunc<f##_proto>(v, n, &f##_wrap, ##__VA_ARGS__)
} // namespace xrpl

View File

@@ -4,7 +4,6 @@
#include <xrpl/protocol/Asset.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/MPTIssue.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STBase.h>
#include <xrpl/protocol/STBitString.h>
@@ -14,7 +13,6 @@
#include <xrpl/tx/wasm/WasmCommon.h>
#include <cstdint>
#include <cstring>
#include <utility>
#include <variant>
@@ -134,33 +132,13 @@ noField(STBase const* field)
}
static Expected<FieldValue, HostFunctionError>
locateField(STObject const& obj, Slice const& locator)
locateField(STObject const& obj, FieldLocator const& locator)
{
if (locator.empty() || ((locator.size() & 3) != 0u)) // must be multiple of 4
return Unexpected(HostFunctionError::LocatorMalformed);
static_assert(kMaxWasmParamLength % sizeof(int32_t) == 0);
int32_t locBuf[kMaxWasmParamLength / sizeof(int32_t)];
int32_t const* locPtr = &locBuf[0];
int32_t const locSize = locator.size() / sizeof(int32_t);
{
uintptr_t const p = reinterpret_cast<uintptr_t>(locator.data());
if ((p & (alignof(int32_t) - 1)) != 0u)
{ // unaligned
memcpy(&locBuf[0], locator.data(), locator.size());
}
else
{
locPtr = reinterpret_cast<int32_t const*>(locator.data());
}
}
STBase const* field = nullptr;
auto const& knownSFields = SField::getKnownCodeToField();
{
int32_t const sfieldCode = adjustWasmEndianess(locPtr[0]);
int32_t const sfieldCode = adjustWasmEndianess(locator[0]);
auto const it = knownSFields.find(sfieldCode);
if (it == knownSFields.end())
return Unexpected(HostFunctionError::InvalidField);
@@ -171,9 +149,9 @@ locateField(STObject const& obj, Slice const& locator)
return Unexpected(HostFunctionError::FieldNotFound);
}
for (int i = 1; i < locSize; ++i)
for (unsigned i = 1; i < locator.size(); ++i)
{
int32_t const sfieldCode = adjustWasmEndianess(locPtr[i]);
int32_t const sfieldCode = adjustWasmEndianess(locator[i]);
if (STI_ARRAY == field->getSType())
{
@@ -285,7 +263,7 @@ WasmHostFunctionsImpl::getLedgerObjField(int32_t cacheIdx, SField const& fname)
// Subsection: nested getters
Expected<Bytes, HostFunctionError>
WasmHostFunctionsImpl::getTxNestedField(Slice const& locator) const
WasmHostFunctionsImpl::getTxNestedField(FieldLocator const& locator) const
{
auto const r = locateField(ctx_.tx, locator);
if (!r)
@@ -295,7 +273,7 @@ WasmHostFunctionsImpl::getTxNestedField(Slice const& locator) const
}
Expected<Bytes, HostFunctionError>
WasmHostFunctionsImpl::getCurrentLedgerObjNestedField(Slice const& locator) const
WasmHostFunctionsImpl::getCurrentLedgerObjNestedField(FieldLocator const& locator) const
{
auto const sle = getCurrentLedgerObj();
if (!sle.has_value())
@@ -309,7 +287,7 @@ WasmHostFunctionsImpl::getCurrentLedgerObjNestedField(Slice const& locator) cons
}
Expected<Bytes, HostFunctionError>
WasmHostFunctionsImpl::getLedgerObjNestedField(int32_t cacheIdx, Slice const& locator) const
WasmHostFunctionsImpl::getLedgerObjNestedField(int32_t cacheIdx, FieldLocator const& locator) const
{
auto const normalizedIdx = normalizeCacheIndex(cacheIdx);
if (!normalizedIdx.has_value())
@@ -374,7 +352,7 @@ WasmHostFunctionsImpl::getLedgerObjArrayLen(int32_t cacheIdx, SField const& fnam
// Subsection: nested array length getters
Expected<int32_t, HostFunctionError>
WasmHostFunctionsImpl::getTxNestedArrayLen(Slice const& locator) const
WasmHostFunctionsImpl::getTxNestedArrayLen(FieldLocator const& locator) const
{
auto const r = locateField(ctx_.tx, locator);
if (!r)
@@ -385,7 +363,7 @@ WasmHostFunctionsImpl::getTxNestedArrayLen(Slice const& locator) const
}
Expected<int32_t, HostFunctionError>
WasmHostFunctionsImpl::getCurrentLedgerObjNestedArrayLen(Slice const& locator) const
WasmHostFunctionsImpl::getCurrentLedgerObjNestedArrayLen(FieldLocator const& locator) const
{
auto const sle = getCurrentLedgerObj();
if (!sle.has_value())
@@ -399,7 +377,8 @@ WasmHostFunctionsImpl::getCurrentLedgerObjNestedArrayLen(Slice const& locator) c
}
Expected<int32_t, HostFunctionError>
WasmHostFunctionsImpl::getLedgerObjNestedArrayLen(int32_t cacheIdx, Slice const& locator) const
WasmHostFunctionsImpl::getLedgerObjNestedArrayLen(int32_t cacheIdx, FieldLocator const& locator)
const
{
auto const normalizedIdx = normalizeCacheIndex(cacheIdx);
if (!normalizedIdx.has_value())

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,9 @@
namespace xrpl {
wasm_trap_t*
HostFuncMain_wrap(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results);
namespace {
void
@@ -395,12 +398,8 @@ ModuleWrapper::buildImports(StorePtr& s, ImportVec const& imports) const
params.release();
results.release();
wasm_func_t* func = wasm_func_new_with_env(
s.get(),
ftype.get(),
reinterpret_cast<wasm_func_callback_with_env_t>(imp.wrap),
(void*)&obj,
nullptr);
wasm_func_t* func =
wasm_func_new_with_env(s.get(), ftype.get(), HostFuncMain_wrap, (void*)&obj, nullptr);
if (func == nullptr)
{
Throw<std::runtime_error>(

File diff suppressed because it is too large Load Diff

View File

@@ -155,15 +155,16 @@ public:
}
Expected<Bytes, HostFunctionError>
getTxNestedField(Slice const& locator) const override
getTxNestedField(FieldLocator const& locator) const override
{
if (locator.size() == 4)
if (locator.size() == 1)
{
int32_t const* l = reinterpret_cast<int32_t const*>(locator.data());
int32_t const* l = locator.data();
int32_t const sfield = l[0];
if (sfield == sfAccount.getCode())
return Bytes(accountID_.begin(), accountID_.end());
}
uint8_t const a[] = {0x2b, 0x6a, 0x23, 0x2a, 0xa4, 0xc4, 0xbe, 0x41, 0xbf, 0x49, 0xd2,
0x45, 0x9f, 0xa4, 0xa0, 0x34, 0x7e, 0x1b, 0x54, 0x3a, 0x4c, 0x92,
0xfc, 0xee, 0x08, 0x21, 0xc0, 0x20, 0x1e, 0x2e, 0x9a, 0x00};
@@ -171,15 +172,16 @@ public:
}
Expected<Bytes, HostFunctionError>
getCurrentLedgerObjNestedField(Slice const& locator) const override
getCurrentLedgerObjNestedField(FieldLocator const& locator) const override
{
if (locator.size() == 4)
if (locator.size() == 1)
{
int32_t const* l = reinterpret_cast<int32_t const*>(locator.data());
int32_t const* l = locator.data();
int32_t const sfield = l[0];
if (sfield == sfAccount.getCode())
return Bytes(accountID_.begin(), accountID_.end());
}
uint8_t const a[] = {0x2b, 0x6a, 0x23, 0x2a, 0xa4, 0xc4, 0xbe, 0x41, 0xbf, 0x49, 0xd2,
0x45, 0x9f, 0xa4, 0xa0, 0x34, 0x7e, 0x1b, 0x54, 0x3a, 0x4c, 0x92,
0xfc, 0xee, 0x08, 0x21, 0xc0, 0x20, 0x1e, 0x2e, 0x9a, 0x00};
@@ -187,15 +189,16 @@ public:
}
Expected<Bytes, HostFunctionError>
getLedgerObjNestedField(int32_t cacheIdx, Slice const& locator) const override
getLedgerObjNestedField(int32_t cacheIdx, FieldLocator const& locator) const override
{
if (locator.size() == 4)
if (locator.size() == 1)
{
int32_t const* l = reinterpret_cast<int32_t const*>(locator.data());
int32_t const* l = locator.data();
int32_t const sfield = l[0];
if (sfield == sfAccount.getCode())
return Bytes(accountID_.begin(), accountID_.end());
}
uint8_t const a[] = {0x2b, 0x6a, 0x23, 0x2a, 0xa4, 0xc4, 0xbe, 0x41, 0xbf, 0x49, 0xd2,
0x45, 0x9f, 0xa4, 0xa0, 0x34, 0x7e, 0x1b, 0x54, 0x3a, 0x4c, 0x92,
0xfc, 0xee, 0x08, 0x21, 0xc0, 0x20, 0x1e, 0x2e, 0x9a, 0x00};
@@ -221,19 +224,19 @@ public:
}
Expected<int32_t, HostFunctionError>
getTxNestedArrayLen(Slice const& locator) const override
getTxNestedArrayLen(FieldLocator const& locator) const override
{
return 32;
}
Expected<int32_t, HostFunctionError>
getCurrentLedgerObjNestedArrayLen(Slice const& locator) const override
getCurrentLedgerObjNestedArrayLen(FieldLocator const& locator) const override
{
return 32;
}
Expected<int32_t, HostFunctionError>
getLedgerObjNestedArrayLen(int32_t cacheIdx, Slice const& locator) const override
getLedgerObjNestedArrayLen(int32_t cacheIdx, FieldLocator const& locator) const override
{
return 32;
}

View File

@@ -1,3 +1,8 @@
#ifdef _DEBUG
// #define DEBUG_OUTPUT 1
#endif
#include <test/app/TestHostFunctions.h>
#include <test/app/wasm_fixtures/fixtures.h>
#include <test/jtx/Env.h>
@@ -17,21 +22,14 @@
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <optional>
#include <source_location>
#include <string>
#include <utility>
#include <vector>
#ifdef _DEBUG
// #define DEBUG_OUTPUT 1
#endif
#include <test/app/TestHostFunctions.h>
#include <source_location>
namespace xrpl::test {
@@ -40,7 +38,7 @@ testGetDataIncrement();
using Add_proto = int32_t(int32_t, int32_t);
static wasm_trap_t*
add(void* env, wasm_val_vec_t const* params, wasm_val_vec_t* results)
add(HostFunctions&, wasm_val_vec_t const* params, wasm_val_vec_t* results)
{
int32_t const val1 = params->data[0].of.i32;
int32_t const val2 = params->data[1].of.i32;
@@ -219,7 +217,7 @@ struct Wasm_test : public beast::unit_test::Suite
HostFunctions hfs;
ImportVec imports;
WasmImpFunc<Add_proto>(imports, "func-add", reinterpret_cast<void*>(&add), hfs);
WasmImpFunc<Add_proto>(imports, "func-add", add, hfs);
auto re = vm.run(wasm, hfs, 10'000'000, "addTwo", wasmParams(1234, 5678), imports);
@@ -405,7 +403,7 @@ struct Wasm_test : public beast::unit_test::Suite
auto re = engine.run(
allHostFuncWasm, hfs, 1'000'000, escrowFunctionName, {}, imp, env.journal);
checkResult(re, 1, 27'080);
checkResult(re, 1, 27'617);
env.close();
}
@@ -427,7 +425,7 @@ struct Wasm_test : public beast::unit_test::Suite
auto re = engine.run(
allHostFuncWasm, hfs, 1'000'000, escrowFunctionName, {}, imp, env.journal);
checkResult(re, 1, 70'340);
checkResult(re, 1, 70'877);
env.close();
}
@@ -466,7 +464,7 @@ struct Wasm_test : public beast::unit_test::Suite
{
TestHostFunctions hfs(env);
auto re = runEscrowWasm(allHFWasm, hfs, 100'000, escrowFunctionName, {});
checkResult(re, 1, 70'340);
checkResult(re, 1, 70'877);
}
{
@@ -490,7 +488,7 @@ struct Wasm_test : public beast::unit_test::Suite
TestHostFunctions hfs(env);
auto re = runEscrowWasm(
allHFWasm, hfs, std::numeric_limits<int64_t>::max(), escrowFunctionName, {});
checkResult(re, 1, 70'340);
checkResult(re, 1, 70'877);
}
{ // fail because trying to access nonexistent field
@@ -508,7 +506,7 @@ struct Wasm_test : public beast::unit_test::Suite
FieldNotFoundHostFunctions hfs(env);
auto re = runEscrowWasm(allHFWasm, hfs, 100'000, escrowFunctionName, {});
checkResult(re, -201, 28'965);
checkResult(re, -201, 29'502);
}
{ // fail because trying to allocate more than MAX_PAGES memory
@@ -526,7 +524,7 @@ struct Wasm_test : public beast::unit_test::Suite
OversizedFieldHostFunctions hfs(env);
auto re = runEscrowWasm(allHFWasm, hfs, 100'000, escrowFunctionName, {});
checkResult(re, -201, 28'965);
checkResult(re, -201, 29'502);
}
// This test use log output, so DEBUG_OUTPUT must be disabled.
@@ -642,7 +640,7 @@ struct Wasm_test : public beast::unit_test::Suite
TestHostFunctions hfs(env);
auto re = runEscrowWasm(float0Wasm, hfs, 100'000, funcName, {});
checkResult(re, 1, 4'309);
checkResult(re, 1, 2'819);
env.close();
}
}

View File

@@ -200,7 +200,7 @@ fn test_transaction_data_functions() -> i32 {
// Use get_tx_field() with appropriate parameters for all transaction field access.
// Test 2.2: get_tx_nested_field() - Nested field access with locator
let locator = [0x01, 0x00]; // Simple locator for first element
let locator = [0x01_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8]; // Two int32s in little-endian: [1, 0]
let mut nested_buffer = [0u8; 32];
let nested_result = unsafe {
host::get_tx_nested_field(
@@ -314,7 +314,7 @@ fn test_current_ledger_object_functions() -> i32 {
}
// Test 3.2: get_current_ledger_obj_nested_field() - Nested field access
let locator = [0x01, 0x00]; // Simple locator
let locator = [0x01_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8]; // Two int32s in little-endian: [1, 0]
let mut current_nested_buffer = [0u8; 32];
let current_nested_result = unsafe {
host::get_current_ledger_obj_nested_field(
@@ -426,7 +426,7 @@ fn test_any_ledger_object_functions() -> i32 {
}
// Test get_ledger_obj_nested_field with invalid slot
let locator = [0x01, 0x00];
let locator = [0x01_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8]; // Two int32s in little-endian: [1, 0]
let nested_result = unsafe {
host::get_ledger_obj_nested_field(
1,
@@ -509,7 +509,7 @@ fn test_any_ledger_object_functions() -> i32 {
}
// Test 4.3: get_ledger_obj_nested_field() - Nested field from cached object
let locator = [0x01, 0x00];
let locator = [0x01_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8, 0x00_u8]; // Two int32s in little-endian: [1, 0]
let mut cached_nested_buffer = [0u8; 32];
let cached_nested_result = unsafe {
host::get_ledger_obj_nested_field(

View File

@@ -45,13 +45,13 @@ extern std::string const kAllHostFunctionsWasmHex =
"65645f61727261795f6c656e000108686f73745f6c69620e6163636f756e745f6b65796c6574000208686f73745f6c"
"69620d74726163655f6163636f756e740002030c0b090a05050b05000101030005030100110619037f01418080c000"
"0b7f0041af99c0000b7f0041b099c0000b072e04066d656d6f727902000666696e697368001e0a5f5f646174615f65"
"6e6403010b5f5f686561705f6261736503020ac61d0b990101027f230041306b220124002000027f41818020200141"
"6e6403010b5f5f686561705f6261736503020a911e0b990101027f230041306b220124002000027f41818020200141"
"1c6a4114100022024114470440417f20022002417f4e1b210241010c010b200020012f001c3b0001200041036a2001"
"411e6a2d00003a0000200120012900233703082001200141286a29000037000d200128001f21022000410d6a200129"
"000d3700002000200129030837020841000b3a000020002002360204200141306a24000b460020012d000041014604"
"40418080c000410b20013402041001000b20002001290001370000200041106a200141116a28000036000020004108"
"6a200141096a2900003700000b1900200241214f0440000b20002002360204200020013602000b1900200241094f04"
"40000b20002002360204200020013602000bde1a01097f230041b0036b22002400418b80c000411b41014100410010"
"6a200141096a2900003700000b1900200241094f0440000b20002002360204200020013602000b1900200241214f04"
"40000b20002002360204200020013602000ba91b01097f230041b0036b22002400418b80c000411b41014100410010"
"021a41a680c000411941014100410010021a41e780c000412b41014100410010021a20004100360270024002400240"
"02400240024002400240200041f0006a220741041003220141004a0440419281c00041172000280270220141187420"
"014180fe03714108747220014108764180fe037120014118767272ad10011a200041003602900120004190016a2203"
@@ -60,144 +60,146 @@ extern std::string const kAllHostFunctionsWasmHex =
"044200370300200042003703b001200041b0016a22064120100522014120470d0241bc81c000411320064120410110"
"021a41cf81c000412041014100410010021a41dc82c000412e41014100410010021a200041a0016a41003602002000"
"4198016a420037030020004200370390014181802020034114100022014114470d03418a83c00041142003101f2000"
"42003703704188801820074108100022014108470d04419e83c0004117420810011a41b583c0004128200741084101"
"10021a2000410036024841848008200041c8006a22034104100022014104470d0541dd83c000411520034104410110"
"021a200041013b0034200242003703002005420037030020044200370300200042003703b0010240200041346a4102"
"200641201006220141004e044041f283c00041142001ad10011a200041286a20062001101c418684c000410d200028"
"0228200028022c410110021a0c010b419384c00041292001ac10011a0b41bc84c00041154183803c1007ac10011a41"
"d184c00041134189803c1007ac10011a0240200041346a41021008220141004e044041e484c00041142001ad10011a"
"0c010b41f884c000412d2001ac10011a0b41a585c000412341014100410010021a41de86c000413341014100410010"
"021a2000420037037041828018200041f0006a220141081009220341004c0d0620034108460440419187c000412b42"
"0810011a41bc87c000412f20014108410110021a0c080b41eb87c000412f2003ad10011a200041206a200041f0006a"
"2003101d419a88c000411720002802202000280224410110021a0c070b41bf82c000411d2001ac10011a419b7f2102"
"0c070b419a82c00041252001ac10011a419a7f21020c060b41ef81c000412b2001ac10011a41997f21020c050b41b4"
"86c000412a2001ac10011a41b77e21020c040b41f385c00041c1002001ac10011a41b67e21020c030b41c885c00041"
"2b2001ac10011a41b57e21020c020b41b188c00041c5002003ac10011a0b200041a0016a410036020020004198016a"
"4200370300200042003703900102404181802020004190016a220341141009220141004a044041f688c000411e2003"
"101f0c010b419489c00041332001ac10011a0b200041013b0048200041c8016a4200370300200041c0016a42003703"
"00200041b8016a4200370300200042003703b0010240200041c8006a4102200041b0016a22014120100a220341004e"
"044041c789c000411c2003ad10011a200041186a20012003101c41e389c00041152000280218200028021c41011002"
"1a0c010b41f889c00041392003ac10011a0b41b18ac00041244183803c100bac10011a0240200041c8006a4102100c"
"220141004e044041d58ac000411c2001ad10011a0c010b41f18ac000413d2001ac10011a0b41ae8bc0004128410141"
"00410010021a41d68bc000412f41014100410010021a200041b0016a2203101a200041f0006a22012003101b200041"
"a8016a4200370300200041a0016a420037030020004198016a42003703002000420037039001024002400240024002"
"40200120004190016a2203102022014120460440200341204100100d220441004a044041858cc00041232004ad1001"
"1a200042003703482004200041c8006a220141081021220341004c0d022003410846044041a88cc000412a42081001"
"1a41d28cc000412e20014108410110021a0c060b41808dc000412e2003ad10011a200041106a200041c8006a200310"
"1d41ae8dc000411620002802102000280214410110021a0c050b41e68fc000413c2004ac10011a200041c8016a4200"
"370300200041c0016a4200370300200041b8016a4200370300200042003703b0014101200041b0016a412010212201"
"4100480d020c030b41ba92c000412e2001ac10011a41ef7c21020c050b41c48dc000412b2003ac10011a0c020b41a2"
"90c00041c1002001ac10011a0b200041013b00484101200041c8006a200041b0016a10222201410048044041e390c0"
"0041352001ac10011a0b4101102322014100480440419891c00041322001ac10011a0b4101200041c8006a10242201"
"410048044041ca91c00041392001ac10011a0b418392c000413741014100410010021a0c010b200041013b00342000"
"41c8016a4200370300200041c0016a4200370300200041b8016a4200370300200042003703b0010240200420004134"
"6a200041b0016a22011022220341004e044041ef8dc000411b2003ad10011a200041086a20012003101c418a8ec000"
"41142000280208200028020c410110021a0c010b419e8ec00041312003ac10011a0b41cf8ec000412320041023ac10"
"011a02402004200041346a1024220141004e044041f28ec000411b2001ad10011a0c010b418d8fc00041352001ac10"
"011a0b41c28fc000412441014100410010021a0b41e892c000412f41014100410010021a200041b0016a2201101a20"
"0041346a22042001101b200041e0006a4200370300200041d8006a4200370300200041d0006a420037030020004200"
"370348024002400240024002402004200041c8006a2203102022014120460440419793c000410f2003412041011002"
"1a20004188016a420037030020004180016a4200370300200041f8006a420037030020004200370370024020044114"
"2004411441a693c0004109200041f0006a22014120100e220341004a0440200020012003101c41ae93c00041122000"
"2802002000280204410110021a0c010b41c093c000413c2003ac10011a0b200041a8016a22064200370300200041a0"
"016a2202420037030020004198016a22054200370300200042003703900120004180808cc07e360268200041346a22"
"034114200041e8006a410420004190016a22084120100f22014120470d0141fc93c000410e20084120410110021a20"
"0041c8016a4200370300200041c0016a4200370300200041b8016a4200370300200042003703b001200041808080d0"
"0236026c20034114200041ec006a4104200041b0016a22044120101022014120470d02418a94c000410e2004412041"
"0110021a419894c000412441014100410010021a419195c000412541014100410010021a20004188016a4200370300"
"20004180016a4200370300200041f8006a42003703002000420037037041b695c0004117200041f0006a2203412010"
"1122014120470d0341cd95c000410b41b695c0004117410110021a41d895c000411120034120410110021a2004101a"
"200041c8006a22072004101b2006420037030020024200370300200542003703002000420037039001024041002004"
"22026b410371220320026a220520024d0d0020030440200321010340200241003a0000200241016a2102200141016b"
"22010d000b0b200341016b4107490d000340200241003a0000200241076a41003a0000200241066a41003a00002002"
"41056a41003a0000200241046a41003a0000200241036a41003a0000200241026a41003a0000200241016a41003a00"
"00200241086a22022005470d000b0b200541800220036b2201417c716a220220054b04400340200541003602002005"
"41046a22052002490d000b0b024020022001410371220120026a22034f0d002001220504400340200241003a000020"
"0241016a2102200541016b22050d000b0b200141016b4107490d000340200241003a0000200241076a41003a000020"
"0241066a41003a0000200241056a41003a0000200241046a41003a0000200241036a41003a0000200241026a41003a"
"0000200241016a41003a0000200241086a22022003470d000b0b024020074114200841202004418002101222014100"
"4a044041e995c00041102001ad10011a20014181024f0d0641f995c000410920042001410110021a0c010b418296c0"
"00412e2001ac10011a0b41b096c000411241c296c00041074101100222014100480d0541c996c000411d2001ad1001"
"1a41e696c0004111422a1001410048044041ad97c000411a42a47b10011a41a47b21020c070b41f796c000411c4200"
"10011a41012102419397c000411a41014100410010021a41ff97c000412941014100410010021a41a898c000412810"
"132201412846044041d098c000412741a898c0004128410110021a41f798c000411e41014100410010021a41bf80c0"
"00412841014100410010021a0c070b419599c000411a2001ac10011a41c37a21020c060b41f494c000411d2001ac10"
"011a418b7c21020c050b41d894c000411c2001ac10011a41897c21020c040b41bc94c000411c2001ac10011a41887c"
"21020c030b41dd97c00041222001ac10011a41a77b21020c020b000b41c797c00041162001ac10011a41a57b21020b"
"200041b0036a240020020b0d00200020012002411410191a0b0c00200041142001412010180b0e0020004182801820"
"01200210140b0e002000200141022002412010150b0a0020004183803c10160b0a0020002001410210170b0bb91901"
"00418080c0000baf196572726f725f636f64653d3d3d3d20484f53542046554e4354494f4e532054455354203d3d3d"
"54657374696e6720323620686f73742066756e6374696f6e73535543434553533a20416c6c20686f73742066756e63"
"74696f6e20746573747320706173736564212d2d2d2043617465676f727920313a204c656467657220486561646572"
"2046756e6374696f6e73202d2d2d4c65646765722073657175656e6365206e756d6265723a506172656e74206c6564"
"6765722074696d653a506172656e74206c656467657220686173683a535543434553533a204c656467657220686561"
"6465722066756e6374696f6e734552524f523a206765745f706172656e745f6c65646765725f686173682077726f6e"
"67206c656e6774683a4552524f523a206765745f706172656e745f6c65646765725f74696d65206661696c65643a45"
"52524f523a206765745f6c65646765725f73716e206661696c65643a2d2d2d2043617465676f727920323a20547261"
"6e73616374696f6e20446174612046756e6374696f6e73202d2d2d5472616e73616374696f6e204163636f756e743a"
"5472616e73616374696f6e20466565206c656e6774683a5472616e73616374696f6e20466565202873657269616c69"
"7a65642058525020616d6f756e74293a5472616e73616374696f6e2053657175656e63653a4e657374656420666965"
"6c64206c656e6774683a4e6573746564206669656c643a494e464f3a206765745f74785f6e65737465645f6669656c"
"64206e6f74206170706c696361626c653a5369676e657273206172726179206c656e6774683a4d656d6f7320617272"
"6179206c656e6774683a4e6573746564206172726179206c656e6774683a494e464f3a206765745f74785f6e657374"
"65645f61727261795f6c656e206e6f74206170706c696361626c653a535543434553533a205472616e73616374696f"
"6e20646174612066756e6374696f6e734552524f523a206765745f74785f6669656c642853657175656e6365292077"
"726f6e67206c656e6774683a4552524f523a206765745f74785f6669656c6428466565292077726f6e67206c656e67"
"746820286578706563746564203820627974657320666f7220585250293a4552524f523a206765745f74785f666965"
"6c64284163636f756e74292077726f6e67206c656e6774683a2d2d2d2043617465676f727920333a2043757272656e"
"74204c6564676572204f626a6563742046756e6374696f6e73202d2d2d43757272656e74206f626a6563742062616c"
"616e6365206c656e677468202858525020616d6f756e74293a43757272656e74206f626a6563742062616c616e6365"
"202873657269616c697a65642058525020616d6f756e74293a43757272656e74206f626a6563742062616c616e6365"
"206c656e67746820286e6f6e2d58525020616d6f756e74293a43757272656e74206f626a6563742062616c616e6365"
"3a494e464f3a206765745f63757272656e745f6c65646765725f6f626a5f6669656c642842616c616e636529206661"
"696c656420286d6179206265206578706563746564293a43757272656e74206c6564676572206f626a656374206163"
"636f756e743a494e464f3a206765745f63757272656e745f6c65646765725f6f626a5f6669656c64284163636f756e"
"7429206661696c65643a43757272656e74206e6573746564206669656c64206c656e6774683a43757272656e74206e"
"6573746564206669656c643a494e464f3a206765745f63757272656e745f6c65646765725f6f626a5f6e6573746564"
"5f6669656c64206e6f74206170706c696361626c653a43757272656e74206f626a656374205369676e657273206172"
"726179206c656e6774683a43757272656e74206e6573746564206172726179206c656e6774683a494e464f3a206765"
"745f63757272656e745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e206e6f74206170706c69"
"6361626c653a535543434553533a2043757272656e74206c6564676572206f626a6563742066756e6374696f6e732d"
"2d2d2043617465676f727920343a20416e79204c6564676572204f626a6563742046756e6374696f6e73202d2d2d53"
"75636365737366756c6c7920636163686564206f626a65637420696e20736c6f743a436163686564206f626a656374"
"2062616c616e6365206c656e677468202858525020616d6f756e74293a436163686564206f626a6563742062616c61"
"6e6365202873657269616c697a65642058525020616d6f756e74293a436163686564206f626a6563742062616c616e"
"6365206c656e67746820286e6f6e2d58525020616d6f756e74293a436163686564206f626a6563742062616c616e63"
"653a494e464f3a206765745f6c65646765725f6f626a5f6669656c642842616c616e636529206661696c65643a4361"
"63686564206e6573746564206669656c64206c656e6774683a436163686564206e6573746564206669656c643a494e"
"464f3a206765745f6c65646765725f6f626a5f6e65737465645f6669656c64206e6f74206170706c696361626c653a"
"436163686564206f626a656374205369676e657273206172726179206c656e6774683a436163686564206e65737465"
"64206172726179206c656e6774683a494e464f3a206765745f6c65646765725f6f626a5f6e65737465645f61727261"
"795f6c656e206e6f74206170706c696361626c653a535543434553533a20416e79206c6564676572206f626a656374"
"2066756e6374696f6e73494e464f3a2063616368655f6c65646765725f6f626a206661696c65642028657870656374"
"656420776974682074657374206669787475726573293a494e464f3a206765745f6c65646765725f6f626a5f666965"
"6c64206661696c656420617320657870656374656420286e6f20636163686564206f626a656374293a494e464f3a20"
"6765745f6c65646765725f6f626a5f6e65737465645f6669656c64206661696c65642061732065787065637465643a"
"494e464f3a206765745f6c65646765725f6f626a5f61727261795f6c656e206661696c656420617320657870656374"
"65643a494e464f3a206765745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e206661696c6564"
"2061732065787065637465643a535543434553533a20416e79206c6564676572206f626a6563742066756e6374696f"
"6e732028696e7465726661636520746573746564294552524f523a206163636f756e745f6b65796c6574206661696c"
"656420666f722063616368696e6720746573743a2d2d2d2043617465676f727920353a204b65796c65742047656e65"
"726174696f6e2046756e6374696f6e73202d2d2d4163636f756e74206b65796c65743a546573745479706543726564"
"656e7469616c206b65796c65743a494e464f3a2063726564656e7469616c5f6b65796c6574206661696c6564202865"
"78706563746564202d20696e74657266616365206973737565293a457363726f77206b65796c65743a4f7261636c65"
"206b65796c65743a535543434553533a204b65796c65742067656e65726174696f6e2066756e6374696f6e73455252"
"4f523a206f7261636c655f6b65796c6574206661696c65643a4552524f523a20657363726f775f6b65796c65742066"
"61696c65643a4552524f523a206163636f756e745f6b65796c6574206661696c65643a2d2d2d2043617465676f7279"
"20363a205574696c6974792046756e6374696f6e73202d2d2d48656c6c6f2c205852504c205741534d20776f726c64"
"21496e70757420646174613a5348413531322068616c6620686173683a4e46542064617461206c656e6774683a4e46"
"5420646174613a494e464f3a206765745f6e6674206661696c656420286578706563746564202d206e6f2073756368"
"204e4654293a54657374207472616365206d6573736167657061796c6f616454726163652066756e6374696f6e2062"
"79746573207772697474656e3a54657374206e756d62657220747261636554726163655f6e756d2066756e6374696f"
"6e20737563636565646564535543434553533a205574696c6974792066756e6374696f6e734552524f523a20747261"
"63655f6e756d2829206661696c65643a4552524f523a2074726163652829206661696c65643a4552524f523a20636f"
"6d707574655f7368613531325f68616c66206661696c65643a2d2d2d2043617465676f727920373a20446174612055"
"70646174652046756e6374696f6e73202d2d2d55706461746564206c656467657220656e7472792064617461206672"
"6f6d205741534d20746573745375636365737366756c6c792075706461746564206c656467657220656e7472792077"
"6974683a535543434553533a2044617461207570646174652066756e6374696f6e734552524f523a20757064617465"
"5f64617461206661696c65643a004d0970726f64756365727302086c616e6775616765010452757374000c70726f63"
"65737365642d6279010572757374631d312e38372e30202831373036376539616320323032352d30352d303929002c"
"0f7461726765745f6665617475726573022b0f6d757461626c652d676c6f62616c732b087369676e2d657874";
"420037034841888018200041c8006a22034108100022014108470d04419e83c0004117420810011a41b583c0004128"
"20034108410110021a2000410036023041848008200041306a22034104100022014104470d0541dd83c00041152003"
"4104410110021a200041f4006a410036000020004100360071200041013a0070200242003703002005420037030020"
"044200370300200042003703b001024020074108200641201006220141004e044041f283c00041142001ad10011a20"
"0041286a20062001101d418684c000410d2000280228200028022c410110021a0c010b419384c00041292001ac1001"
"1a0b41bc84c00041154183803c1007ac10011a41d184c00041134189803c1007ac10011a0240200041f0006a410810"
"08220141004e044041e484c00041142001ad10011a0c010b41f884c000412d2001ac10011a0b41a585c00041234101"
"4100410010021a41de86c000413341014100410010021a2000420037034841828018200041c8006a22014108100922"
"0341004c0d0620034108460440419187c000412b420810011a41bc87c000412f20014108410110021a0c080b41eb87"
"c000412f2003ad10011a200041206a200041c8006a2003101c419a88c000411720002802202000280224410110021a"
"0c070b41bf82c000411d2001ac10011a419b7f21020c070b419a82c00041252001ac10011a419a7f21020c060b41ef"
"81c000412b2001ac10011a41997f21020c050b41b486c000412a2001ac10011a41b77e21020c040b41f385c00041c1"
"002001ac10011a41b67e21020c030b41c885c000412b2001ac10011a41b57e21020c020b41b188c00041c5002003ac"
"10011a0b200041a0016a410036020020004198016a4200370300200042003703900102404181802020004190016a22"
"0341141009220141004a044041f688c000411e2003101f0c010b419489c00041332001ac10011a0b200041f4006a41"
"0036000020004100360071200041013a0070200041c8016a4200370300200041c0016a4200370300200041b8016a42"
"00370300200042003703b0010240200041f0006a4108200041b0016a22014120100a220341004e044041c789c00041"
"1c2003ad10011a200041186a20012003101d41e389c00041152000280218200028021c410110021a0c010b41f889c0"
"0041392003ac10011a0b41b18ac00041244183803c100bac10011a0240200041f0006a4108100c220141004e044041"
"d58ac000411c2001ad10011a0c010b41f18ac000413d2001ac10011a0b41ae8bc000412841014100410010021a41d6"
"8bc000412f41014100410010021a200041b0016a2203101a200041f0006a22012003101b200041a8016a4200370300"
"200041a0016a420037030020004198016a420037030020004200370390010240024002400240024020012000419001"
"6a2203102022014120460440200341204100100d220441004a044041858cc00041232004ad10011a20004200370330"
"2004200041306a220141081021220341004c0d022003410846044041a88cc000412a420810011a41d28cc000412e20"
"014108410110021a0c060b41808dc000412e2003ad10011a200041106a200041306a2003101c41ae8dc00041162000"
"2802102000280214410110021a0c050b41e68fc000413c2004ac10011a200041c8016a4200370300200041c0016a42"
"00370300200041b8016a4200370300200042003703b0014101200041b0016a4120102122014100480d020c030b41ba"
"92c000412e2001ac10011a41ef7c21020c050b41c48dc000412b2003ac10011a0c020b41a290c00041c1002001ac10"
"011a0b200041cc006a410036000020004100360049200041013a00484101200041c8006a200041b0016a1022220141"
"0048044041e390c00041352001ac10011a0b4101102322014100480440419891c00041322001ac10011a0b41012000"
"41c8006a10242201410048044041ca91c00041392001ac10011a0b418392c000413741014100410010021a0c010b20"
"0041cc006a410036000020004100360049200041013a0048200041c8016a4200370300200041c0016a420037030020"
"0041b8016a4200370300200042003703b00102402004200041c8006a200041b0016a22011022220341004e044041ef"
"8dc000411b2003ad10011a200041086a20012003101d418a8ec00041142000280208200028020c410110021a0c010b"
"419e8ec00041312003ac10011a0b41cf8ec000412320041023ac10011a02402004200041c8006a1024220141004e04"
"4041f28ec000411b2001ad10011a0c010b418d8fc00041352001ac10011a0b41c28fc000412441014100410010021a"
"0b41e892c000412f41014100410010021a200041b0016a2201101a200041306a22042001101b200041e0006a420037"
"0300200041d8006a4200370300200041d0006a420037030020004200370348024002400240024002402004200041c8"
"006a2203102022014120460440419793c000410f20034120410110021a20004188016a420037030020004180016a42"
"00370300200041f8006a4200370300200042003703700240200441142004411441a693c0004109200041f0006a2201"
"4120100e220341004a0440200020012003101d41ae93c000411220002802002000280204410110021a0c010b41c093"
"c000413c2003ac10011a0b200041a8016a22064200370300200041a0016a2202420037030020004198016a22054200"
"370300200042003703900120004180808cc07e360268200041306a22034114200041e8006a410420004190016a2208"
"4120100f22014120470d0141fc93c000410e20084120410110021a200041c8016a4200370300200041c0016a420037"
"0300200041b8016a4200370300200042003703b001200041808080d00236026c20034114200041ec006a4104200041"
"b0016a22044120101022014120470d02418a94c000410e20044120410110021a419894c00041244101410041001002"
"1a419195c000412541014100410010021a20004188016a420037030020004180016a4200370300200041f8006a4200"
"3703002000420037037041b695c0004117200041f0006a22034120101122014120470d0341cd95c000410b41b695c0"
"004117410110021a41d895c000411120034120410110021a2004101a200041c8006a22072004101b20064200370300"
"2002420037030020054200370300200042003703900102404100200422026b410371220320026a220520024d0d0020"
"030440200321010340200241003a0000200241016a2102200141016b22010d000b0b200341016b4107490d00034020"
"0241003a0000200241076a41003a0000200241066a41003a0000200241056a41003a0000200241046a41003a000020"
"0241036a41003a0000200241026a41003a0000200241016a41003a0000200241086a22022005470d000b0b20054180"
"0220036b2201417c716a220220054b0440034020054100360200200541046a22052002490d000b0b02402002200141"
"0371220120026a22034f0d002001220504400340200241003a0000200241016a2102200541016b22050d000b0b2001"
"41016b4107490d000340200241003a0000200241076a41003a0000200241066a41003a0000200241056a41003a0000"
"200241046a41003a0000200241036a41003a0000200241026a41003a0000200241016a41003a0000200241086a2202"
"2003470d000b0b0240200741142008412020044180021012220141004a044041e995c00041102001ad10011a200141"
"81024f0d0641f995c000410920042001410110021a0c010b418296c000412e2001ac10011a0b41b096c000411241c2"
"96c00041074101100222014100480d0541c996c000411d2001ad10011a41e696c0004111422a1001410048044041ad"
"97c000411a42a47b10011a41a47b21020c070b41f796c000411c420010011a41012102419397c000411a4101410041"
"0010021a41ff97c000412941014100410010021a41a898c000412810132201412846044041d098c000412741a898c0"
"004128410110021a41f798c000411e41014100410010021a41bf80c000412841014100410010021a0c070b419599c0"
"00411a2001ac10011a41c37a21020c060b41f494c000411d2001ac10011a418b7c21020c050b41d894c000411c2001"
"ac10011a41897c21020c040b41bc94c000411c2001ac10011a41887c21020c030b41dd97c00041222001ac10011a41"
"a77b21020c020b000b41c797c00041162001ac10011a41a57b21020b200041b0036a240020020b0d00200020012002"
"411410191a0b0c00200041142001412010180b0e002000418280182001200210140b0e002000200141082002412010"
"150b0a0020004183803c10160b0a0020002001410810170b0bb9190100418080c0000baf196572726f725f636f6465"
"3d3d3d3d20484f53542046554e4354494f4e532054455354203d3d3d54657374696e6720323620686f73742066756e"
"6374696f6e73535543434553533a20416c6c20686f73742066756e6374696f6e20746573747320706173736564212d"
"2d2d2043617465676f727920313a204c6564676572204865616465722046756e6374696f6e73202d2d2d4c65646765"
"722073657175656e6365206e756d6265723a506172656e74206c65646765722074696d653a506172656e74206c6564"
"67657220686173683a535543434553533a204c6564676572206865616465722066756e6374696f6e734552524f523a"
"206765745f706172656e745f6c65646765725f686173682077726f6e67206c656e6774683a4552524f523a20676574"
"5f706172656e745f6c65646765725f74696d65206661696c65643a4552524f523a206765745f6c65646765725f7371"
"6e206661696c65643a2d2d2d2043617465676f727920323a205472616e73616374696f6e20446174612046756e6374"
"696f6e73202d2d2d5472616e73616374696f6e204163636f756e743a5472616e73616374696f6e20466565206c656e"
"6774683a5472616e73616374696f6e20466565202873657269616c697a65642058525020616d6f756e74293a547261"
"6e73616374696f6e2053657175656e63653a4e6573746564206669656c64206c656e6774683a4e6573746564206669"
"656c643a494e464f3a206765745f74785f6e65737465645f6669656c64206e6f74206170706c696361626c653a5369"
"676e657273206172726179206c656e6774683a4d656d6f73206172726179206c656e6774683a4e6573746564206172"
"726179206c656e6774683a494e464f3a206765745f74785f6e65737465645f61727261795f6c656e206e6f74206170"
"706c696361626c653a535543434553533a205472616e73616374696f6e20646174612066756e6374696f6e73455252"
"4f523a206765745f74785f6669656c642853657175656e6365292077726f6e67206c656e6774683a4552524f523a20"
"6765745f74785f6669656c6428466565292077726f6e67206c656e6774682028657870656374656420382062797465"
"7320666f7220585250293a4552524f523a206765745f74785f6669656c64284163636f756e74292077726f6e67206c"
"656e6774683a2d2d2d2043617465676f727920333a2043757272656e74204c6564676572204f626a6563742046756e"
"6374696f6e73202d2d2d43757272656e74206f626a6563742062616c616e6365206c656e677468202858525020616d"
"6f756e74293a43757272656e74206f626a6563742062616c616e6365202873657269616c697a65642058525020616d"
"6f756e74293a43757272656e74206f626a6563742062616c616e6365206c656e67746820286e6f6e2d58525020616d"
"6f756e74293a43757272656e74206f626a6563742062616c616e63653a494e464f3a206765745f63757272656e745f"
"6c65646765725f6f626a5f6669656c642842616c616e636529206661696c656420286d617920626520657870656374"
"6564293a43757272656e74206c6564676572206f626a656374206163636f756e743a494e464f3a206765745f637572"
"72656e745f6c65646765725f6f626a5f6669656c64284163636f756e7429206661696c65643a43757272656e74206e"
"6573746564206669656c64206c656e6774683a43757272656e74206e6573746564206669656c643a494e464f3a2067"
"65745f63757272656e745f6c65646765725f6f626a5f6e65737465645f6669656c64206e6f74206170706c69636162"
"6c653a43757272656e74206f626a656374205369676e657273206172726179206c656e6774683a43757272656e7420"
"6e6573746564206172726179206c656e6774683a494e464f3a206765745f63757272656e745f6c65646765725f6f62"
"6a5f6e65737465645f61727261795f6c656e206e6f74206170706c696361626c653a535543434553533a2043757272"
"656e74206c6564676572206f626a6563742066756e6374696f6e732d2d2d2043617465676f727920343a20416e7920"
"4c6564676572204f626a6563742046756e6374696f6e73202d2d2d5375636365737366756c6c792063616368656420"
"6f626a65637420696e20736c6f743a436163686564206f626a6563742062616c616e6365206c656e67746820285852"
"5020616d6f756e74293a436163686564206f626a6563742062616c616e6365202873657269616c697a656420585250"
"20616d6f756e74293a436163686564206f626a6563742062616c616e6365206c656e67746820286e6f6e2d58525020"
"616d6f756e74293a436163686564206f626a6563742062616c616e63653a494e464f3a206765745f6c65646765725f"
"6f626a5f6669656c642842616c616e636529206661696c65643a436163686564206e6573746564206669656c64206c"
"656e6774683a436163686564206e6573746564206669656c643a494e464f3a206765745f6c65646765725f6f626a5f"
"6e65737465645f6669656c64206e6f74206170706c696361626c653a436163686564206f626a656374205369676e65"
"7273206172726179206c656e6774683a436163686564206e6573746564206172726179206c656e6774683a494e464f"
"3a206765745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e206e6f74206170706c696361626c"
"653a535543434553533a20416e79206c6564676572206f626a6563742066756e6374696f6e73494e464f3a20636163"
"68655f6c65646765725f6f626a206661696c6564202865787065637465642077697468207465737420666978747572"
"6573293a494e464f3a206765745f6c65646765725f6f626a5f6669656c64206661696c656420617320657870656374"
"656420286e6f20636163686564206f626a656374293a494e464f3a206765745f6c65646765725f6f626a5f6e657374"
"65645f6669656c64206661696c65642061732065787065637465643a494e464f3a206765745f6c65646765725f6f62"
"6a5f61727261795f6c656e206661696c65642061732065787065637465643a494e464f3a206765745f6c6564676572"
"5f6f626a5f6e65737465645f61727261795f6c656e206661696c65642061732065787065637465643a535543434553"
"533a20416e79206c6564676572206f626a6563742066756e6374696f6e732028696e74657266616365207465737465"
"64294552524f523a206163636f756e745f6b65796c6574206661696c656420666f722063616368696e672074657374"
"3a2d2d2d2043617465676f727920353a204b65796c65742047656e65726174696f6e2046756e6374696f6e73202d2d"
"2d4163636f756e74206b65796c65743a546573745479706543726564656e7469616c206b65796c65743a494e464f3a"
"2063726564656e7469616c5f6b65796c6574206661696c656420286578706563746564202d20696e74657266616365"
"206973737565293a457363726f77206b65796c65743a4f7261636c65206b65796c65743a535543434553533a204b65"
"796c65742067656e65726174696f6e2066756e6374696f6e734552524f523a206f7261636c655f6b65796c65742066"
"61696c65643a4552524f523a20657363726f775f6b65796c6574206661696c65643a4552524f523a206163636f756e"
"745f6b65796c6574206661696c65643a2d2d2d2043617465676f727920363a205574696c6974792046756e6374696f"
"6e73202d2d2d48656c6c6f2c205852504c205741534d20776f726c6421496e70757420646174613a53484135313220"
"68616c6620686173683a4e46542064617461206c656e6774683a4e465420646174613a494e464f3a206765745f6e66"
"74206661696c656420286578706563746564202d206e6f2073756368204e4654293a54657374207472616365206d65"
"73736167657061796c6f616454726163652066756e6374696f6e206279746573207772697474656e3a54657374206e"
"756d62657220747261636554726163655f6e756d2066756e6374696f6e20737563636565646564535543434553533a"
"205574696c6974792066756e6374696f6e734552524f523a2074726163655f6e756d2829206661696c65643a455252"
"4f523a2074726163652829206661696c65643a4552524f523a20636f6d707574655f7368613531325f68616c662066"
"61696c65643a2d2d2d2043617465676f727920373a2044617461205570646174652046756e6374696f6e73202d2d2d"
"55706461746564206c656467657220656e74727920646174612066726f6d205741534d207465737453756363657373"
"66756c6c792075706461746564206c656467657220656e74727920776974683a535543434553533a20446174612075"
"70646174652066756e6374696f6e734552524f523a207570646174655f64617461206661696c65643a004d0970726f"
"64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d312e38"
"392e30202832393438333838336520323032352d30382d303429002c0f7461726765745f6665617475726573022b0f"
"6d757461626c652d676c6f62616c732b087369676e2d657874";
extern std::string const kDeepRecursionHex =
"0061736d010000000105016000017f030201000608017f0141c0843d0b070a010666696e69736800000a1601140023"
@@ -1008,33 +1010,18 @@ extern std::string const kFloat0Hex =
"0061736d0100000001290560057f7f7f7f7f017f60047e7f7f7f017f60077f7f7f7f7f7f7f017f60047f7f7f7f017f"
"6000017f025f0408686f73745f6c6962057472616365000008686f73745f6c69620e666c6f61745f66726f6d5f696e"
"74000108686f73745f6c69620e666c6f61745f7375627472616374000208686f73745f6c69620d666c6f61745f636f"
"6d7061726500030302010405030100110619037f01418080c0000b7f00419681c0000b7f0041a081c0000b072e0406"
"6d656d6f727902000666696e69736800040a5f5f646174615f656e6403010b5f5f686561705f6261736503020ad302"
"01d00201017f23808080800041206b2200248080808000418080c0800041154101410041001080808080001a200041"
"086a410036020020004200370300200041106a41086a410036020020004200370310024002400240420a2000410c41"
"00108180808000410c470d002000410c2000410c200041106a410c4100108280808000410c470d0102400240200041"
"106a410c200041106a410c1083808080000d00419580c0800041174101410041001080808080001a0c010b41ac80c0"
"800041164101410041001080808080001a0b0240200041106a410c41c280c08000410c1083808080000d0041ce80c0"
"8000411a4101410041001080808080001a0c030b41e880c0800041194101410041001080808080001a0c020b418181"
"c0800041154101410041001080808080001a0c010b418181c0800041154101410041001080808080001a0b20004120"
"6a24808080800041010b0ba0010100418080c0000b96010a24242420746573745f666c6f61745f3020242424202066"
"6c6f6174203020636f6d706172653a20676f6f642020666c6f6174203020636f6d706172653a206261640000000000"
"000000800000002020464c4f41545f5a45524f20636f6d706172653a20676f6f642020464c4f41745f5a45524f2063"
"6f6d706172653a206261642020666c6f61742031302d31303a206661696c6564009503046e616d65000d0c666c6f61"
"745f302e7761736d01de0205004c5f5a4e31367872706c5f7761736d5f7374646c696234686f73743232686f73745f"
"646566696e65645f66756e6374696f6e73357472616365313768653738323066313637383330383338364501565f5a"
"4e31367872706c5f7761736d5f7374646c696234686f73743232686f73745f646566696e65645f66756e6374696f6e"
"733134666c6f61745f66726f6d5f696e74313768646463636262643266613366663431634502565f5a4e3136787270"
"6c5f7761736d5f7374646c696234686f73743232686f73745f646566696e65645f66756e6374696f6e733134666c6f"
"61745f7375627472616374313768313765643838343131303333663437624503555f5a4e31367872706c5f7761736d"
"5f7374646c696234686f73743232686f73745f646566696e65645f66756e6374696f6e733133666c6f61745f636f6d"
"706172653137683835393637633834333363613334623045040666696e697368071201000f5f5f737461636b5f706f"
"696e746572090a0100072e726f64617461004d0970726f64756365727302086c616e6775616765010452757374000c"
"70726f6365737365642d6279010572757374631d312e38392e30202832393438333838336520323032352d30382d30"
"34290094010f7461726765745f6665617475726573082b0b62756c6b2d6d656d6f72792b0f62756c6b2d6d656d6f72"
"792d6f70742b1663616c6c2d696e6469726563742d6f7665726c6f6e672b0a6d756c746976616c75652b0f6d757461"
"626c652d676c6f62616c732b136e6f6e7472617070696e672d6670746f696e742b0f7265666572656e63652d747970"
"65732b087369676e2d657874";
"6d7061726500030302010405030100110619037f01418080c0000b7f0041e980c0000b7f0041f080c0000b072e0406"
"6d656d6f727902000666696e69736800040a5f5f646174615f656e6403010b5f5f686561705f6261736503020ad201"
"01cf0101027f230041206b22002400418080c000411541014100410010001a200041086a4100360200200042003703"
"00200041186a41003602002000420037031002400240420a2000410c41001001410c4604402000410c2000410c2000"
"41106a2201410c41001002410c470d012001410c419580c000410c100345044041a180c000411a4101410041001000"
"1a0c030b41bb80c000411941014100410010001a0c020b41d480c000411541014100410010001a0c010b41d480c000"
"411541014100410010001a0b200041206a240041010b0b720100418080c0000b690a24242420746573745f666c6f61"
"745f30202424240000000000000000800000002020464c4f41545f5a45524f20636f6d706172653a20676f6f642020"
"464c4f41545f5a45524f20636f6d706172653a206261642020666c6f61742031302d31303a206661696c6564004d09"
"70726f64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d"
"312e38392e30202832393438333838336520323032352d30382d303429002c0f7461726765745f6665617475726573"
"022b0f6d757461626c652d676c6f62616c732b087369676e2d657874";
extern std::string const kDisabledFloatHex =
"0061736d010000000108026000006000017f03030200010503010002063e0a7f004180080b7f004180080b7f004180"

View File

@@ -39,13 +39,6 @@ pub extern "C" fn finish() -> i32 {
return 1;
}
// Compare result with zero
if 0 == unsafe { float_compare(f_result.as_ptr(), FLOAT_SIZE, f_result.as_ptr(), FLOAT_SIZE) } {
let _ = trace(" float 0 compare: good");
} else {
let _ = trace(" float 0 compare: bad");
}
// Compare result with FLOAT_ZERO constant
if 0 == unsafe { float_compare(f_result.as_ptr(), FLOAT_SIZE, FLOAT_ZERO.as_ptr(), FLOAT_SIZE) } {
let _ = trace(" FLOAT_ZERO compare: good");