We compiling again after including the type into the flags field

This commit is contained in:
FelixBrendel
2019-04-21 16:20:07 +02:00
parent 8429c495cb
commit 903d9bdd8c
3 changed files with 11 additions and 12 deletions
+6 -8
View File
@@ -1,19 +1,17 @@
#include "slime.h" #include "slime.h"
// using namespace Slime;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (argc > 1) { if (argc > 1) {
if (string_equal(argv[1], "--run-tests")) { if (Slime::string_equal(argv[1], "--run-tests")) {
return run_all_tests() ? 0 : 1; return Slime::run_all_tests() ? 0 : 1;
} }
interprete_file(argv[1]); Slime::interprete_file(argv[1]);
if (Globals::error) { if (Slime::Globals::error) {
log_error(); Slime::log_error();
return 1; return 1;
} }
} else { } else {
interprete_stdin(); Slime::interprete_stdin();
} }
} }
+3 -2
View File
@@ -53,14 +53,14 @@ namespace Memory {
inline proc get_type(Lisp_Object* node) -> Lisp_Object_Type { inline proc get_type(Lisp_Object* node) -> Lisp_Object_Type {
// the type is in the bits 0 to 5 (including) // the type is in the bits 0 to 5 (including)
return (Lisp_Object_Type) ((u64)node->flags & (u64)0xffffff); return (Lisp_Object_Type) ((u64)node->flags & (u64)0b11111);
} }
inline proc set_type(Lisp_Object* node, Lisp_Object_Type type) { inline proc set_type(Lisp_Object* node, Lisp_Object_Type type) {
// the type is in the bits 0 to 5 (including) // the type is in the bits 0 to 5 (including)
u64 bitmask = (u64)-1; u64 bitmask = (u64)-1;
bitmask -= 0xffffff; bitmask -= 0b11111;
bitmask += (u64) type; bitmask += (u64) type;
node->flags = (u64)(node->flags) | bitmask; node->flags = (u64)(node->flags) | bitmask;
} }
@@ -132,6 +132,7 @@ namespace Memory {
index = free_spots_in_object_memory->data[free_spots_in_object_memory->next_index--]; index = free_spots_in_object_memory->data[free_spots_in_object_memory->next_index--];
} }
Lisp_Object* object = object_memory+index; Lisp_Object* object = object_memory+index;
object->flags = 0;
object->sourceCodeLocation = nullptr; object->sourceCodeLocation = nullptr;
object->userType = nullptr; object->userType = nullptr;
return object; return object;
+2 -2
View File
@@ -12,7 +12,7 @@
#undef _CRT_SECURE_NO_DEPRECATE #undef _CRT_SECURE_NO_DEPRECATE
#undef _CRT_SECURE_NO_WARNINGS #undef _CRT_SECURE_NO_WARNINGS
// namespace Slime { namespace Slime {
# include "./defines.cpp" # include "./defines.cpp"
# include "./structs.cpp" # include "./structs.cpp"
# include "./forward_decls.cpp" # include "./forward_decls.cpp"
@@ -26,4 +26,4 @@
# include "./built_ins.cpp" # include "./built_ins.cpp"
# include "./testing.cpp" # include "./testing.cpp"
# include "./undefines.cpp" # include "./undefines.cpp"
// } }