Skip to content

Commit

Permalink
Update wabt module version 1.0.35
Browse files Browse the repository at this point in the history
* revise wasm binary reader and its parser

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
  • Loading branch information
clover2123 authored and ksh8281 committed Jun 25, 2024
1 parent a492678 commit 59c6dfd
Show file tree
Hide file tree
Showing 1,326 changed files with 2,582 additions and 81,551 deletions.
4 changes: 1 addition & 3 deletions src/parser/WASMParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ class WASMBinaryReader : public wabt::WASMBinaryReaderDelegate {

size_t* m_readerOffsetPointer;
const uint8_t* m_readerDataPointer;
size_t m_codeStartOffset;
size_t m_codeEndOffset;

struct PreprocessData {
Expand Down Expand Up @@ -680,7 +679,6 @@ class WASMBinaryReader : public wabt::WASMBinaryReaderDelegate {
WASMBinaryReader()
: m_readerOffsetPointer(nullptr)
, m_readerDataPointer(nullptr)
, m_codeStartOffset(0)
, m_codeEndOffset(0)
, m_inInitExpr(false)
, m_currentFunction(nullptr)
Expand Down Expand Up @@ -1016,10 +1014,10 @@ class WASMBinaryReader : public wabt::WASMBinaryReaderDelegate {
m_currentFunction->m_requiredStackSize, m_functionStackSizeSoFar);
}

// FIXME remove preprocess
virtual void OnStartReadInstructions(Offset start, Offset end) override
{
ASSERT(start == *m_readerOffsetPointer);
m_codeStartOffset = start;
m_codeEndOffset = end;
}

Expand Down
15 changes: 6 additions & 9 deletions src/shell/Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,10 @@ static Instance* fetchInstance(wabt::Var& moduleVar, std::map<size_t, Instance*>

static void executeWAST(Store* store, const std::string& filename, const std::vector<uint8_t>& src, DefinedFunctionTypes& functionTypes)
{
auto lexer = wabt::WastLexer::CreateBufferLexer("test.wabt", src.data(), src.size());
if (lexer == nullptr) {
printf("Error during lexer initialization!\n");
RELEASE_ASSERT_NOT_REACHED();
}

wabt::Errors errors;
auto lexer = wabt::WastLexer::CreateBufferLexer("test.wabt", src.data(), src.size(), &errors);
ASSERT(lexer);

std::unique_ptr<wabt::Script> script;
wabt::Features features;
features.EnableAll();
Expand Down Expand Up @@ -748,17 +745,17 @@ static void executeWAST(Store* store, const std::string& filename, const std::ve
if (assertReturn->action->type() == wabt::ActionType::Invoke) {
auto action = static_cast<wabt::InvokeAction*>(assertReturn->action.get());
auto fn = fetchInstance(action->module_var, instanceMap, registeredInstanceMap)->resolveExportFunction(action->name);
executeInvokeAction(action, fn, assertReturn->expected, nullptr);
executeInvokeAction(action, fn, assertReturn->expected->expected, nullptr);
} else if (assertReturn->action->type() == wabt::ActionType::Get) {
auto action = static_cast<wabt::GetAction*>(assertReturn->action.get());
auto v = fetchInstance(action->module_var, instanceMap, registeredInstanceMap)->resolveExportGlobal(action->name)->value();
if (!equals(v, assertReturn->expected[0])) {
if (!equals(v, assertReturn->expected->expected[0])) {
printf("Assert failed.\n");
RELEASE_ASSERT_NOT_REACHED();
}
printf("get %s", action->name.data());
printf(" expect value(");
printConstVector(assertReturn->expected);
printConstVector(assertReturn->expected->expected);
printf(") (line: %d) : OK\n", action->loc.line);
} else {
printf("Not supported action type.\n");
Expand Down
12 changes: 6 additions & 6 deletions src/util/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class Optional {

T& value()
{
ASSERT(m_hasValue);
assert(m_hasValue);
return m_value;
}

const T& value() const
{
ASSERT(m_hasValue);
assert(m_hasValue);
return m_value;
}

Expand Down Expand Up @@ -124,13 +124,13 @@ class Optional<T*> {

T* value()
{
ASSERT(hasValue());
assert(hasValue());
return m_value;
}

const T* value() const
{
ASSERT(hasValue());
assert(hasValue());
return m_value;
}

Expand All @@ -142,13 +142,13 @@ class Optional<T*> {

T* operator->()
{
ASSERT(hasValue());
assert(hasValue());
return m_value;
}

const T* operator->() const
{
ASSERT(hasValue());
assert(hasValue());
return m_value;
}

Expand Down
180 changes: 0 additions & 180 deletions third_party/wabt/docs/decompiler.md

This file was deleted.

Loading

0 comments on commit 59c6dfd

Please sign in to comment.