Skip to content
This repository was archived by the owner on Dec 7, 2024. It is now read-only.
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "wasm-module"]
path = wasm-module
url = https://github.com/Teemperor/wasm-module.git
68 changes: 7 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,23 @@ project(wasmint)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_subdirectory(wasm-module)

####################
# Common code #
####################

include_directories(wasm-module/src)
include_directories (src)

add_library(core
main.cpp
src/ExceptionWithMessage.cpp
src/instructions/InstructionSet.cpp
src/Module.cpp
src/Section.cpp
src/FunctionContext.cpp
src/FunctionSignature.cpp
src/FunctionTable.cpp
src/instructions/Instruction.cpp
src/OpcodeTable.cpp
src/Variable.cpp
src/Global.cpp
src/GlobalTable.cpp
src/Function.cpp
src/types/Type.cpp
src/TypeTable.cpp
src/ModuleContext.cpp

src/interpreter/Thread.cpp
src/interpreter/FunctionState.cpp
src/interpreter/InstructionState.cpp
src/interpreter/RuntimeEnvironment.cpp
src/interpreter/InstructionExecutor.cpp
src/interpreter/Heap.cpp

src/instructions/I32/I32Add.cpp
src/instructions/I32/I32Sub.cpp
src/instructions/I32/I32Mul.cpp
src/instructions/I32/I32Div.cpp

src/instructions/heap/Int32Load.cpp
src/instructions/heap/Int32Store.cpp

src/instructions/controlflow/Block.cpp
src/instructions/controlflow/Break.cpp
src/instructions/controlflow/Continue.cpp
src/instructions/controlflow/DoWhile.cpp
src/instructions/controlflow/Forever.cpp
src/instructions/controlflow/If.cpp
src/instructions/controlflow/Return.cpp

src/instructions/Print.cpp
src/instructions/GetLocal.cpp
src/instructions/SetLocal.cpp
src/instructions/GetGlobal.cpp
src/instructions/SetGlobal.cpp
src/instructions/FunctionCall.cpp
src/instructions/Literal.cpp
src/instructions/StepResult.cpp

src/types/Int8.cpp
src/types/Int32.cpp
src/types/Int64.cpp
src/types/Void.cpp
src/types/Float32.cpp
src/types/Float64.cpp

src/parsing/ByteStream.cpp
src/parsing/GlobalTableParser.cpp
src/parsing/FunctionParser.cpp
src/parsing/FunctionTableParser.cpp
src/parsing/TypeTableParser.cpp
src/parsing/ModuleParser.cpp
src/parsing/CodeSectionParser.cpp
src/parsing/OpcodeTableParser.cpp
src/interpreter/StepResult.cpp
)


Expand All @@ -83,7 +29,7 @@ add_library(core

add_executable(wasmint main.cpp)

target_link_libraries(wasmint core)
target_link_libraries(wasmint core wasm-module)


####################
Expand All @@ -95,6 +41,6 @@ file(GLOB TEST_FILES "tests/*Test.cpp")
foreach(TEST_FILE ${TEST_FILES})
get_filename_component(BASENAME ${TEST_FILE} NAME_WE)
add_executable(${BASENAME} ${TEST_FILE})
target_link_libraries(${BASENAME} core)
target_link_libraries(${BASENAME} core wasm-module)
add_test(${BASENAME} ${BASENAME})
endforeach()
114 changes: 0 additions & 114 deletions docs/BinaryFormat.md

This file was deleted.

72 changes: 0 additions & 72 deletions docs/Instructions.md

This file was deleted.

7 changes: 4 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include <parsing/ByteStream.h>
#include <Module.h>
#include <parsing/ModuleParser.h>

#include <interpreter/RuntimeEnvironment.h>
#include <interpreter/Thread.h>
int main(int argc, char** argv) {
if (argc == 1) {
std::cerr << "No modules given. Call programm like this: \n$ wasmint module1.wasm" << std::endl;
Expand Down Expand Up @@ -41,8 +42,8 @@ int main(int argc, char** argv) {
}

try {
Thread& thread = environment.createThread();
thread.callFunction("main");
Thread& thread = environment.createThread().startAtFunction("main");
thread.stepUntilFinished();
} catch(NoFunctionWithName e) {
if (e.what() == "main") {
std::cerr << "None of the given modules has a main function. Exiting..." << std::endl;
Expand Down
3 changes: 0 additions & 3 deletions src/ExceptionWithMessage.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/ExceptionWithMessage.h

This file was deleted.

12 changes: 0 additions & 12 deletions src/Function.cpp

This file was deleted.

Loading