VM: merge strings.hpp and tuples.hpp into layouts.hpp, because those
header files were so tinydb4
parent
66eb9f1fe5
commit
46423dfebf
|
@ -91,7 +91,6 @@ ifdef CONFIG
|
||||||
vm/mark_bits.hpp \
|
vm/mark_bits.hpp \
|
||||||
vm/free_list.hpp \
|
vm/free_list.hpp \
|
||||||
vm/fixup.hpp \
|
vm/fixup.hpp \
|
||||||
vm/tuples.hpp \
|
|
||||||
vm/free_list_allocator.hpp \
|
vm/free_list_allocator.hpp \
|
||||||
vm/write_barrier.hpp \
|
vm/write_barrier.hpp \
|
||||||
vm/object_start_map.hpp \
|
vm/object_start_map.hpp \
|
||||||
|
@ -100,7 +99,6 @@ ifdef CONFIG
|
||||||
vm/data_heap.hpp \
|
vm/data_heap.hpp \
|
||||||
vm/code_heap.hpp \
|
vm/code_heap.hpp \
|
||||||
vm/gc.hpp \
|
vm/gc.hpp \
|
||||||
vm/strings.hpp \
|
|
||||||
vm/float_bits.hpp \
|
vm/float_bits.hpp \
|
||||||
vm/io.hpp \
|
vm/io.hpp \
|
||||||
vm/image.hpp \
|
vm/image.hpp \
|
||||||
|
|
|
@ -107,6 +107,14 @@ inline static cell tag_fixnum(fixnum untagged) {
|
||||||
|
|
||||||
struct object {
|
struct object {
|
||||||
NO_TYPE_CHECK;
|
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;
|
cell header;
|
||||||
|
|
||||||
template <typename Fixup> cell base_size(Fixup fixup) const;
|
template <typename Fixup> cell base_size(Fixup fixup) const;
|
||||||
|
@ -324,4 +332,15 @@ struct tuple : public object {
|
||||||
cell* data() const { return (cell*)(this + 1); }
|
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; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,6 @@ namespace factor { struct factor_vm; }
|
||||||
#include "mark_bits.hpp"
|
#include "mark_bits.hpp"
|
||||||
#include "free_list.hpp"
|
#include "free_list.hpp"
|
||||||
#include "fixup.hpp"
|
#include "fixup.hpp"
|
||||||
#include "tuples.hpp"
|
|
||||||
#include "free_list_allocator.hpp"
|
#include "free_list_allocator.hpp"
|
||||||
#include "write_barrier.hpp"
|
#include "write_barrier.hpp"
|
||||||
#include "object_start_map.hpp"
|
#include "object_start_map.hpp"
|
||||||
|
@ -118,7 +117,6 @@ namespace factor { struct factor_vm; }
|
||||||
#include "data_heap.hpp"
|
#include "data_heap.hpp"
|
||||||
#include "code_heap.hpp"
|
#include "code_heap.hpp"
|
||||||
#include "gc.hpp"
|
#include "gc.hpp"
|
||||||
#include "strings.hpp"
|
|
||||||
#include "float_bits.hpp"
|
#include "float_bits.hpp"
|
||||||
#include "io.hpp"
|
#include "io.hpp"
|
||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
|
|
|
@ -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; }
|
|
||||||
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue