diff --git a/src/defines.h b/src/defines.h index 19424c9..2775463 100644 --- a/src/defines.h +++ b/src/defines.h @@ -7,6 +7,19 @@ #pragma once +/************************** + * CONFIG + **************************/ + +#define USE_PACKED_VALUES false + + + + + + +/**************************/ + #include #include diff --git a/src/instruction.cpp b/src/instruction.cpp index f089ea7..cc952e9 100644 --- a/src/instruction.cpp +++ b/src/instruction.cpp @@ -1121,6 +1121,11 @@ void Instruction::execute(VM *vm) const vv.push_back(v2); vm->push(v1); } + else if (v1.type == TYPE_LAMBDA) + { + Code* code = v1.lambda()->code(); + vm->push(new Lambda(code->append(Instruction(v2)))); + } } break; } diff --git a/src/main.cpp b/src/main.cpp index 31d794f..0453e71 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,7 +85,7 @@ int main (int argc, const char * argv[]) else if (input == "info") { cout << " arch: " << (sizeof(void*) == 4 ? "x86" : "x86-64") << endl; - cout << " size of value : " << sizeof(Value) << endl; + cout << " size of value : " << sizeof(Value) << (sizeof(Value) == sizeof(value_data) + sizeof(Type) ? " (packed)" : "") << endl; cout << " size of instruction : " << sizeof(Instruction) << endl; cout << " size of opcode : " << sizeof(Opcode) << endl; } diff --git a/src/value.h b/src/value.h index 5ddccc2..f75bb31 100644 --- a/src/value.h +++ b/src/value.h @@ -57,7 +57,11 @@ union value_data bool operator==(const value_data& o) const { return i == o.i; } }; +#if defined(USE_PACKED_VALUES) && USE_PACKED_VALUES +class __attribute__((packed)) Value final +#else class Value final +#endif { public: value_data data; diff --git a/src/vm.h b/src/vm.h index b89f3b9..48fbdeb 100644 --- a/src/vm.h +++ b/src/vm.h @@ -58,8 +58,6 @@ class VM void push(const Value& value) { - std::string str = value.svalue(); - std::cout << "pushing " << str << std::endl << std::flush; valueStack->push_back(value); }