Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bump default minimum heap size to 1M.

  • Loading branch information...
commit 5cb5da76c12cffe04a7299a7e52690688ad2ee98 1 parent 66cee8a
@nominolo authored
Showing with 14 additions and 2 deletions.
  1. +7 −0 vm/common.hh
  2. +3 −0  vm/config.hh
  3. +4 −2 vm/memorymanager.cc
View
7 vm/common.hh
@@ -104,6 +104,13 @@ typedef int64_t i8;
#define wordsof(x) ((sizeof(x) + sizeof(Word)-1) / sizeof(Word))
#define countof(x) (sizeof(x) / sizeof(*x))
+// Computes ceil(x / y) using only integer division.
+#define idivCeil(x, y) \
+ ({ typeof(x) _idivCeilX = (x); \
+ typeof(y) _idivCeilY = (y); \
+ (void) (&_idivCeilX == &_idivCeilY); /* type check */ \
+ (_idivCeilX + (_idivCeilY - 1)) / _idivCeilY; })
+
#define byte_offset(from, to) (cast(u1*, (to)) - cast(u1*, (from)))
static inline int32_t byteOffset32(void *from, void *to) {
View
3  vm/config.hh
@@ -32,6 +32,9 @@
#define HOT_SIDE_EXIT_THRESHOLD 7
+#define LC_DEFAULT_HEAP_SIZE (1UL * 1024 * 1024)
+
+
#define DEBUG_MEMORY_MANAGER 0x00000001L
#define DEBUG_LOADER 0x00000002L
#define DEBUG_INTERPRETER 0x00000004L
View
6 vm/memorymanager.cc
@@ -127,7 +127,8 @@ Time gc_time = 0;
MemoryManager::MemoryManager()
: free_(NULL), old_heap_(NULL), topOfStackMask_(kNoMask),
- nextGC_(2), allocated_(0), num_gcs_(0) {
+ nextGC_(idivCeil(LC_DEFAULT_HEAP_SIZE, Block::kBlockSize)),
+ allocated_(0), num_gcs_(0) {
region_ = Region::newRegion(Region::kSmallObjectRegion);
info_tables_ = grabFreeBlock(Block::kInfoTables);
static_closures_ = grabFreeBlock(Block::kStaticClosures);
@@ -320,7 +321,8 @@ void MemoryManager::performGC(Capability *cap) {
// TODO: Is this correct?
- nextGC_ = (fullBlocks > 2 ? fullBlocks : 2) + 1;
+ uint32_t minHeapBlocks = idivCeil(LC_DEFAULT_HEAP_SIZE, Block::kBlockSize);
+ nextGC_ = (fullBlocks > minHeapBlocks ? fullBlocks : minHeapBlocks) + 1;
gc_time += getProcessElapsedTime() - gc_start;
}
Please sign in to comment.
Something went wrong with that request. Please try again.