Skip to content
This repository was archived by the owner on Dec 7, 2024. It is now read-only.

Commit 8ee9761

Browse files
committed
Merge pull request #3 from Teemperor/parsingSubmodule
Parsing submodule
2 parents d509062 + 9e38779 commit 8ee9761

File tree

118 files changed

+289
-3080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+289
-3080
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "wasm-module"]
2+
path = wasm-module
3+
url = https://github.com/Teemperor/wasm-module.git

CMakeLists.txt

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,77 +3,23 @@ project(wasmint)
33

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

6+
add_subdirectory(wasm-module)
7+
68
####################
79
# Common code #
810
####################
911

12+
include_directories(wasm-module/src)
1013
include_directories (src)
1114

1215
add_library(core
13-
main.cpp
14-
src/ExceptionWithMessage.cpp
15-
src/instructions/InstructionSet.cpp
16-
src/Module.cpp
17-
src/Section.cpp
18-
src/FunctionContext.cpp
19-
src/FunctionSignature.cpp
20-
src/FunctionTable.cpp
21-
src/instructions/Instruction.cpp
22-
src/OpcodeTable.cpp
23-
src/Variable.cpp
24-
src/Global.cpp
25-
src/GlobalTable.cpp
26-
src/Function.cpp
27-
src/types/Type.cpp
28-
src/TypeTable.cpp
29-
src/ModuleContext.cpp
30-
3116
src/interpreter/Thread.cpp
3217
src/interpreter/FunctionState.cpp
3318
src/interpreter/InstructionState.cpp
3419
src/interpreter/RuntimeEnvironment.cpp
20+
src/interpreter/InstructionExecutor.cpp
3521
src/interpreter/Heap.cpp
36-
37-
src/instructions/I32/I32Add.cpp
38-
src/instructions/I32/I32Sub.cpp
39-
src/instructions/I32/I32Mul.cpp
40-
src/instructions/I32/I32Div.cpp
41-
42-
src/instructions/heap/Int32Load.cpp
43-
src/instructions/heap/Int32Store.cpp
44-
45-
src/instructions/controlflow/Block.cpp
46-
src/instructions/controlflow/Break.cpp
47-
src/instructions/controlflow/Continue.cpp
48-
src/instructions/controlflow/DoWhile.cpp
49-
src/instructions/controlflow/Forever.cpp
50-
src/instructions/controlflow/If.cpp
51-
src/instructions/controlflow/Return.cpp
52-
53-
src/instructions/Print.cpp
54-
src/instructions/GetLocal.cpp
55-
src/instructions/SetLocal.cpp
56-
src/instructions/GetGlobal.cpp
57-
src/instructions/SetGlobal.cpp
58-
src/instructions/FunctionCall.cpp
59-
src/instructions/Literal.cpp
60-
src/instructions/StepResult.cpp
61-
62-
src/types/Int8.cpp
63-
src/types/Int32.cpp
64-
src/types/Int64.cpp
65-
src/types/Void.cpp
66-
src/types/Float32.cpp
67-
src/types/Float64.cpp
68-
69-
src/parsing/ByteStream.cpp
70-
src/parsing/GlobalTableParser.cpp
71-
src/parsing/FunctionParser.cpp
72-
src/parsing/FunctionTableParser.cpp
73-
src/parsing/TypeTableParser.cpp
74-
src/parsing/ModuleParser.cpp
75-
src/parsing/CodeSectionParser.cpp
76-
src/parsing/OpcodeTableParser.cpp
22+
src/interpreter/StepResult.cpp
7723
)
7824

7925

@@ -83,7 +29,7 @@ add_library(core
8329

8430
add_executable(wasmint main.cpp)
8531

86-
target_link_libraries(wasmint core)
32+
target_link_libraries(wasmint core wasm-module)
8733

8834

8935
####################
@@ -95,6 +41,6 @@ file(GLOB TEST_FILES "tests/*Test.cpp")
9541
foreach(TEST_FILE ${TEST_FILES})
9642
get_filename_component(BASENAME ${TEST_FILE} NAME_WE)
9743
add_executable(${BASENAME} ${TEST_FILE})
98-
target_link_libraries(${BASENAME} core)
44+
target_link_libraries(${BASENAME} core wasm-module)
9945
add_test(${BASENAME} ${BASENAME})
10046
endforeach()

docs/BinaryFormat.md

Lines changed: 0 additions & 114 deletions
This file was deleted.

docs/Instructions.md

Lines changed: 0 additions & 72 deletions
This file was deleted.

main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include <parsing/ByteStream.h>
66
#include <Module.h>
77
#include <parsing/ModuleParser.h>
8-
8+
#include <interpreter/RuntimeEnvironment.h>
9+
#include <interpreter/Thread.h>
910
int main(int argc, char** argv) {
1011
if (argc == 1) {
1112
std::cerr << "No modules given. Call programm like this: \n$ wasmint module1.wasm" << std::endl;
@@ -41,8 +42,8 @@ int main(int argc, char** argv) {
4142
}
4243

4344
try {
44-
Thread& thread = environment.createThread();
45-
thread.callFunction("main");
45+
Thread& thread = environment.createThread().startAtFunction("main");
46+
thread.stepUntilFinished();
4647
} catch(NoFunctionWithName e) {
4748
if (e.what() == "main") {
4849
std::cerr << "None of the given modules has a main function. Exiting..." << std::endl;

src/ExceptionWithMessage.cpp

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/ExceptionWithMessage.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Function.cpp

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)