Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 20, 2012
@nominolo Fix warning. f811798
@nominolo Keep default heap size at 2 blocks for unit tests.
The default heap size for the `lcvm` binary remains at 1 MB.
6ce6557
@nominolo Improve printing of trace stats. 3114514
View
4 vm/jit.cc
@@ -12,6 +12,8 @@
#include <sstream>
#include <iomanip>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
_START_LAMBDACHINE_NAMESPACE
@@ -1054,7 +1056,7 @@ printLoggedNYIs(FILE *out)
{
for (uint32_t i = 0; i < NYI__MAX; ++i) {
if (nyiCount[i] > 0)
- fprintf(out, "%3lu x NYI: %s\n", nyiCount[i], nyiDescription[i]);
+ fprintf(out, "%"PRIu64" x NYI: %s\n", nyiCount[i], nyiDescription[i]);
}
}
View
2  vm/jit.hh
@@ -268,6 +268,8 @@ public:
return snaps_[n];
}
+ inline uint32_t numExits() const { return nsnaps_; }
+
#ifdef LC_TRACE_STATS
inline uint64_t traceCompletions() const { return stats_[0]; }
inline uint64_t traceExitsAt(ExitNo n) const {
View
20 vm/main.cc
@@ -32,6 +32,7 @@ int main(int argc, char *argv[]) {
initializeTimer();
Time startup_time = getProcessElapsedTime();
MemoryManager mm;
+ mm.setMinHeapSize(1UL * 1024 * 1024);
Loader loader(&mm, opts->basePath().c_str());
if (!loader.loadWiredInModules())
@@ -153,16 +154,31 @@ void
printTraceStats(FILE *out)
{
#ifdef LC_TRACE_STATS
- fprintf(out, "Trace Statistics:\n");
+ fprintf(out, "Trace Statistics:\n"
+ " TRACE Completions C.Rate Exits"
+ " Exit Points\n");
for (uint32_t traceId = 0; traceId < Jit::numFragments(); ++traceId) {
Fragment *F = Jit::traceById(traceId);
uint64_t completions = F->traceCompletions();
uint64_t exits = F->traceExits();
+ uint64_t entries = completions + exits;
char completionsString[30];
char exitsString[30];
formatWithThousands(completionsString, completions);
formatWithThousands(exitsString, exits);
- fprintf(out, " %04d: %20s %20s\n", traceId, completionsString, exitsString);
+ fprintf(out, " %04d %15s %5.1f%% %14s ",
+ traceId, completionsString, exitsString,
+ 100 * (double)completions / (double)entries);
+ if (exits > 0) {
+ for (uint32_t e = 0; e < F->numExits(); ++e) {
+ uint64_t snapExits = F->traceExitsAt(e);
+ if (snapExits > 0) {
+ fprintf(out, " #%d " COL_GREY "%3.1f%%" COL_RESET, e,
+ 100 * (double)snapExits / (double)exits);
+ }
+ }
+ }
+ fprintf(out, "\n");
}
fprintf(out, "\n");
#else
View
7 vm/memorymanager.cc
@@ -127,7 +127,7 @@ Time gc_time = 0;
MemoryManager::MemoryManager()
: free_(NULL), old_heap_(NULL), topOfStackMask_(kNoMask),
- nextGC_(idivCeil(LC_DEFAULT_HEAP_SIZE, Block::kBlockSize)),
+ minHeapSize_(2), nextGC_(minHeapSize_),
allocated_(0), num_gcs_(0) {
region_ = Region::newRegion(Region::kSmallObjectRegion);
info_tables_ = grabFreeBlock(Block::kInfoTables);
@@ -318,11 +318,8 @@ void MemoryManager::performGC(Capability *cap) {
// TODO: Add sanity check. Everything reachable from the roots must
// be in a k[Static]Closures block now.
-
-
// TODO: Is this correct?
- uint32_t minHeapBlocks = idivCeil(LC_DEFAULT_HEAP_SIZE, Block::kBlockSize);
- nextGC_ = (fullBlocks > minHeapBlocks ? fullBlocks : minHeapBlocks) + 1;
+ nextGC_ = (fullBlocks > minHeapSize_ ? fullBlocks : minHeapSize_) + 1;
gc_time += getProcessElapsedTime() - gc_start;
}
View
6 vm/memorymanager.hh
@@ -225,6 +225,11 @@ public:
nextGC_ = blocks;
}
+ inline void setMinHeapSize(size_t bytes) {
+ minHeapSize_ = idivCeil(bytes, Block::kBlockSize);
+ if (minHeapSize_ < 2) minHeapSize_ = 2;
+ }
+
private:
inline void *allocInto(Block **block, size_t bytes) {
char *ptr = (*block)->alloc(bytes);
@@ -281,6 +286,7 @@ private:
Block *old_heap_; // Only non-NULL during GC
u4 topOfStackMask_;
+ uint64_t minHeapSize_; // in blocks
u4 nextGC_; // if zero, a GC gets triggered.
// Assuming an allocation rate of 16GB/s (pretty high), this counter

No commit comments for this range

Something went wrong with that request. Please try again.