Skip to content

Commit d79129d

Browse files
committed
[WINDOWS] Deactivate ffi tests on windows
1 parent 922adc6 commit d79129d

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/executer/ByteCode.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,22 @@ ProgramState ByteCodeVM::run(size_t maxInstructions) {
133133
case Op::LOCALS: {
134134
// LOCALS ID
135135
auto& locals = callstack.back().locals;
136-
locals.resize(inst.arg1 + 1); // TODO: Expensive!
136+
137+
auto idx = inst.arg1 + 1;
138+
if(locals.size() <= idx) {
139+
locals.resize(idx); // TODO: Expensive!
140+
}
137141

138142
auto value = stack.pop();
139143
locals[inst.arg1] = value; // Store value in local variable
140144
break;
141145
}
142146
case Op::LOCALL: {
143147
// LOCALL ID
148+
ASSURE(!callstack.empty(), "ByteCodeVM: Empty callstack");
144149
auto& locals = callstack.back().locals;
150+
std::cout << "locals.size()=" << locals.size() << " arg1=" << inst.arg1 << " callstack.size()=" << callstack.size() << std::endl;
151+
ASSURE(inst.arg1 < locals.size(), "ByteCodeVM: Local variable index out of bounds");
145152
stack.push(locals[inst.arg1]); // Push local variable onto stack
146153
break;
147154
}
@@ -243,7 +250,10 @@ ProgramState ByteCodeVM::run(size_t maxInstructions) {
243250
// auto parentObj = stack.pop(); // TODO: Also have a parent object and garbage collection
244251
auto addr = heap.size();
245252
stack.push(addr + 1);
246-
heap.resize(addr + inst.arg1 + 1);
253+
auto idx = addr + inst.arg1 + 1;
254+
if(heap.size() <= idx) {
255+
heap.resize(idx);
256+
}
247257
// heap[addr] = parentObj; // Store parent object for garbage collection
248258
break;
249259
}

src/mains/Tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,12 @@ void suiteTestfiles(){
280280
testFile("mfiles/type_annotation.m");
281281
testFile("mfiles/struct.m");
282282
testFile("mfiles/struct_nested.m");
283+
284+
#ifndef WIN
285+
// Those need ffi, which is not implemented on Windows yet
283286
testFile("mfiles/extern.m");
284287
testFile("mfiles/str.m");
288+
#endif
285289

286290
// TODO: blob type (alloc8(size), get(blob, idx), set(blob, idx)):
287291
// synatx sugar for get, set with []
@@ -296,7 +300,9 @@ void suiteTestfiles(){
296300

297301
int main() {
298302
suiteTestfiles();
303+
#ifndef WIN
299304
testLibrary();
305+
#endif
300306
testExecutorData();
301307

302308
return 0;

0 commit comments

Comments
 (0)