Skip to content

Commit b5e0b24

Browse files
authored
Merge pull request #31 from FastVM/v0.0.4-pre
v0.0.4
2 parents acd0979 + eea699d commit b5e0b24

Some content is hidden

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

111 files changed

+5077
-6898
lines changed

.github/workflows/all.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,27 @@ jobs:
77
- uses: actions/checkout@v4
88
with:
99
submodules: true
10-
- run: make -Bj CC=cc OPT='-Os -flto' GCCJIT=NO
10+
- run: make linux TARGET=test
11+
- run: cat build/test/diff.txt
1112
- uses: actions/upload-artifact@v4
1213
with:
1314
name: minivm-linux
14-
path: |
15+
path: |
1516
build/bin/minivm
16-
windows-minivm-gcc:
17+
mac-minivm:
18+
runs-on: macos-14
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: true
23+
- run: make mac TARGET=test
24+
- run: cat build/test/diff.txt
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: minivm-mac
28+
path: |
29+
build/bin/minivm
30+
windows-minivm:
1731
runs-on: windows-latest
1832
steps:
1933
- uses: actions/checkout@v4
@@ -24,9 +38,10 @@ jobs:
2438
with:
2539
version: 12.2.0
2640
platform: x64
27-
- run: make -Bj EXE=.exe CC='gcc' OPT='-Os -flto' OS=WINDOWS GCCJIT=NO
41+
- run: make windows TARGET=test OPT='-O2'
42+
- run: cat build/test/diff.txt
2843
- uses: actions/upload-artifact@v4
2944
with:
3045
name: minivm-windows
31-
path: |
46+
path: |
3247
build/bin/minivm.exe

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ minivm
2929
minivm.exe
3030
out.*
3131
package-lock.json
32+
web/minivm.js
33+
web-raw/minivm.js
34+
web-raw/minivm.wasm

.gitmodules

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
[submodule "vendor/tcc"]
2-
path = vendor/tcc
3-
url = https://github.com/fastvm/minivm-tinycc
4-
[submodule "vendor/cuik"]
5-
path = vendor/cuik
6-
url = https://github.com/fastvm/minivm-cuik
7-
branch = new-cg
8-
[submodule "vendor/xxhash"]
9-
path = vendor/xxhash
10-
url = https://github.com/fastvm/minivm-xxhash
111
[submodule "vendor/tree-sitter"]
122
path = vendor/tree-sitter
133
url = https://github.com/fastvm/minivm-tree-sitter
144
[submodule "vendor/isocline"]
155
path = vendor/isocline
166
url = https://github.com/fastvm/minivm-isocline
17-
[submodule "vendor/llvm-box"]
18-
path = vendor/llvm-box
19-
url = https://github.com/fastvm/llvm-box
7+
[submodule "vendor/raylib"]
8+
path = vendor/raylib
9+
url = https://github.com/FastVM/minivm-raylib
10+
[submodule "vendor/bdwgc"]
11+
path = vendor/bdwgc
12+
url = https://github.com/FastVM/minivm-bdwgc

core.mak

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

main/driver.mjs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ const readFileSync = (path) => {
1818
};
1919

2020
const boxSpawn = (cmd, ...cmdArgs) => {
21-
const args = [cmd, ...cmdArgs];
21+
const args = [...cmdArgs];
22+
switch (cmd) {
23+
case 'wasm-ld':
24+
args.unshift('lld', 'wasm-ld');
25+
break;
26+
case 'clang':
27+
args.unshift('clang', 'clang');
28+
break;
29+
default:
30+
throw new Error(`command: ${cmd}`);
31+
}
2232
const argc = args.length;
2333
const argv = box._malloc((argc + 1) * 4);
2434
let argv_ptr = argv;
@@ -127,19 +137,22 @@ mkdirSync(cache);
127137

128138
timeEnd('llvm');
129139

130-
export const run = (args) => {
140+
export const run = async (args) => {
131141
timeBegin('run');
132142
process.stdin.setRawMode(true);
133143

134144
let last = 'mod';
135145

136146
timeBegin(last);
137147

138-
const mod = MiniVM({
148+
const mod = await MiniVM({
139149
noInitialRun: true,
140150
stdin: watch(stdinFunc),
141151
stdout: watch(stdoutFunc),
142152
stderr: watch(stderrFunc),
153+
154+
_vm_lang_lua_repl_sync() {},
155+
143156
_vm_compile_c_to_wasm: (n) => {
144157
timeEnd(last);
145158
const cSrc = mod.FS.readFile(`/in${n}.c`);
@@ -149,17 +162,17 @@ export const run = (args) => {
149162
writeFileSync(inFile, cSrc);
150163
if (ld === 'none') {
151164
timeBegin(cc);
152-
execSync(`llvm-box ${cc} ${inFile} ${cFlags} -o ${outFile}`);
165+
execSync(`${cc} ${inFile} ${cFlags} -o ${outFile}`);
153166
timeEnd(cc);
154167
unlinkSync(inFile);
155168
} else {
156169
const midFile = `${cache}/mid${n}.o`;
157170
timeBegin(cc);
158-
execSync(`llvm-box ${cc} -c -w ${inFile} ${cFlagsBase} -o ${midFile}`);
171+
execSync(`${cc} -c -w ${inFile} ${cFlagsBase} -o ${midFile}`);
159172
timeEnd(cc);
160173
unlinkSync(inFile);
161174
timeBegin(ld);
162-
execSync(`llvm-box ${ld} --no-entry --whole-archive ${midFile} ${ldFlagsBase} -o ${outFile}`);
175+
execSync(`${ld} --no-entry --whole-archive ${midFile} ${ldFlagsBase} -o ${outFile}`);
163176
timeEnd(ld);
164177
unlinkSync(midFile);
165178
}
@@ -189,7 +202,7 @@ export const run = (args) => {
189202
};
190203

191204
try {
192-
run(process.argv.slice(2));
205+
await run(process.argv.slice(2));
193206
} catch (e) {
194207
console.error(e);
195208
}

0 commit comments

Comments
 (0)