]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: merge strings.hpp and tuples.hpp into layouts.hpp, because those
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 3 Jul 2015 17:12:57 +0000 (19:12 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Mon, 6 Jul 2015 20:49:38 +0000 (22:49 +0200)
header files were so tiny

GNUmakefile
vm/layouts.hpp
vm/master.hpp
vm/strings.hpp [deleted file]
vm/tuples.hpp [deleted file]

index 951aa6849c461e185f4a83fea5ecc1c597972793..8478e646c2125717aa86cb6a839abffb2cf42866 100644 (file)
@@ -91,7 +91,6 @@ ifdef CONFIG
                vm/mark_bits.hpp \
                vm/free_list.hpp \
                vm/fixup.hpp \
-               vm/tuples.hpp \
                vm/free_list_allocator.hpp \
                vm/write_barrier.hpp \
                vm/object_start_map.hpp \
@@ -100,7 +99,6 @@ ifdef CONFIG
                vm/data_heap.hpp \
                vm/code_heap.hpp \
                vm/gc.hpp \
-               vm/strings.hpp \
                vm/float_bits.hpp \
                vm/io.hpp \
                vm/image.hpp \
index d02f44461dfd0e40d8386725f324eb30a81e968c..263a469dc03c94060d5e2de5069d098b79f2edea 100644 (file)
@@ -107,6 +107,14 @@ inline static cell tag_fixnum(fixnum untagged) {
 
 struct object {
   NO_TYPE_CHECK;
+  // header format (bits indexed with least significant as zero):
+  // bit 0      : free?
+  // if not forwarding:
+  //   bit 1      : forwarding pointer?
+  //   bit 2-5    : tag
+  //   bit 7-end  : hashcode
+  // if forwarding:
+  //   bit 2-end  : forwarding pointer
   cell header;
 
   template <typename Fixup> cell base_size(Fixup fixup) const;
@@ -324,4 +332,15 @@ struct tuple : public object {
   cell* data() const { return (cell*)(this + 1); }
 };
 
+inline static cell tuple_size(const tuple_layout* layout) {
+  cell size = untag_fixnum(layout->size);
+  return sizeof(tuple) + size * sizeof(cell);
+}
+
+inline static cell string_capacity(const string* str) {
+  return untag_fixnum(str->length);
+}
+
+inline static cell string_size(cell size) { return sizeof(string) + size; }
+
 }
index e7a43d27cd765975637726b7aaf9a3f62c95cf0f..dcfc4ff5795feb361fdbc616f7916785b505db15 100644 (file)
@@ -109,7 +109,6 @@ namespace factor { struct factor_vm; }
 #include "mark_bits.hpp"
 #include "free_list.hpp"
 #include "fixup.hpp"
-#include "tuples.hpp"
 #include "free_list_allocator.hpp"
 #include "write_barrier.hpp"
 #include "object_start_map.hpp"
@@ -118,7 +117,6 @@ namespace factor { struct factor_vm; }
 #include "data_heap.hpp"
 #include "code_heap.hpp"
 #include "gc.hpp"
-#include "strings.hpp"
 #include "float_bits.hpp"
 #include "io.hpp"
 #include "image.hpp"
diff --git a/vm/strings.hpp b/vm/strings.hpp
deleted file mode 100644 (file)
index af98133..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace factor {
-
-inline static cell string_capacity(const string* str) {
-  return untag_fixnum(str->length);
-}
-
-inline static cell string_size(cell size) { return sizeof(string) + size; }
-
-}
diff --git a/vm/tuples.hpp b/vm/tuples.hpp
deleted file mode 100644 (file)
index 75f91fc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace factor {
-
-inline static cell tuple_size(const tuple_layout* layout) {
-  cell size = untag_fixnum(layout->size);
-  return sizeof(tuple) + size * sizeof(cell);
-}
-
-}