Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 7 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 19, 2012
@nominolo Disable all debug components if NDEBUG is on. 5d40504
@nominolo Add missing #include. d391cc3
@nominolo Add benchmarking target to SumFromTo1. c15c216
@nominolo Reduce verbosity in NDEBUG mode. ae501db
@nominolo Support for dual GHC/lcvm benchmarks.
Running a benchmark no longer requires manual modification.  The two
versions are now selected via the preprocessor.  To compile for
benchmarking with GHC use -DBENCH_GHC.
19d93d7
@nominolo Merge remote-tracking branch 'origin/side-traces' into side-traces
Conflicts:
	tests/Bench/SumSquare1.hs
	vm/jit.cc
f5ab76c
@nominolo Remove more debug printing. 3cf43e3
View
4 Makefile.in
@@ -350,6 +350,10 @@ clean-bytecode:
.PHONY: gtest
gtest: $(GTEST_A)
+bench-ghc/%: tests/Bench/%.hs
+ @mkdir -p bench-ghc
+ $(HC) -O2 -fforce-recomp -DBENCH_GHC $(BENCH_HC_OPTS) -rtsopts -o $@ $<
+
-include $(SRCS:%.c=$(DEPDIR)/%.P)
-include $(UTILSRCS:%.cc=$(DEPDIR)/%.P)
-include $(DEPDIR)/vm/unittest.P
View
19 tests/Bench/SumFromTo1.hs
@@ -1,13 +1,22 @@
-{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash, CPP #-}
-- RUN: %bc_vm_chk
-- CHECK: @Result@ IND -> GHC.Bool.True`con_info
+#ifdef BENCH_GHC
+import Prelude ( print )
+#else
module Bench.SumFromTo1 where
+#endif
import GHC.Prim
import GHC.Bool
import GHC.Types
+#ifdef USE_NOINLINE
{-# NOINLINE enumFromTo #-}
+{-# NOINLINE sum_aux #-}
+{-# NOINLINE root #-}
+#endif
+
enumFromTo :: Int -> Int -> [Int]
enumFromTo from@(I# m) to@(I# n) =
if m ># n then [] else
@@ -22,7 +31,6 @@ one = I# 1#
sum :: [Int] -> Int
sum l = sum_aux (I# 0#) l
-{-# NOINLINE sum_aux #-}
sum_aux :: Int -> [Int] -> Int
sum_aux !acc [] = acc
sum_aux !(I# a) (I# x:xs) = sum_aux (I# (a +# x)) xs
@@ -39,9 +47,14 @@ succInt (I# m) = I# (m +# 1#)
eqInt :: Int -> Int -> Bool
eqInt (I# m) (I# n) = m ==# n
-{-# NOINLINE root #-}
root upper =
let !l = sum (enumFromTo one upper) in
(l `plusInt` l) `eqInt` (upper `timesInt` (succInt upper))
test = root (I# 100#)
+
+bench = root (I# 200000000#)
+
+#ifdef BENCH_GHC
+main = print bench
+#endif
View
19 tests/Bench/SumSquare1.hs
@@ -1,14 +1,23 @@
-{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash #-}
+{-# LANGUAGE NoImplicitPrelude, BangPatterns, MagicHash, CPP #-}
-- RUN: %bc_vm_chk
-- CHECK: @Result@ IND -> GHC.Bool.True`con_info
+#ifdef BENCH_GHC
+import Prelude ( print )
+#else
module Bench.SumSquare1 where
---import Prelude ( print )
+#endif
import GHC.Prim
import GHC.List
import GHC.Base
import GHC.Num
+#ifdef USE_NOINLINE
+{-# NOINLINE enumFromTo'Int #-}
+{-# NOINLINE sum_aux #-}
+{-# NOINLINE root #-}
+#endif
+
enumFromTo'Int :: Int -> Int -> [Int]
enumFromTo'Int from@(I# m) to@(I# n) =
if m ># n then [] else
@@ -30,6 +39,8 @@ root x = sum [ I# (a# *# b#)
test = root 20 == 23485
-test2 = root 11000 == 1830679628709250
+bench = root 15000 == 6329531334376250
---main = print test2
+#ifdef BENCH_GHC
+main = print bench
+#endif
View
4 vm/assembler.cc
@@ -4,6 +4,7 @@
#include <iostream>
#include <fstream>
+#include <string.h>
#define MCLIM_REDZONE 64
@@ -1367,7 +1368,8 @@ debugPrintParallelAssign(ostream &out, ParAssign *assign) {
void
Assembler::parallelAssign(ParAssign *assign, Reg optTmp)
{
- debugPrintParallelAssign(cerr, assign);
+ if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER)
+ debugPrintParallelAssign(cerr, assign);
memset(assign->status, 0, sizeof(assign->status[0]) * assign->size);
assign->tmpsInUse = 0;
View
4 vm/config.hh
@@ -40,10 +40,14 @@
#define DEBUG_TRACE_ENTEREXIT 0x00000020L
#define DEBUG_FALSE_LOOP_FILT 0x00000040L
+#ifdef NDEBUG
+# define DEBUG_COMPONENTS 0
+#else
// #define DEBUG_COMPONENTS 0xffffffffL
// #define DEBUG_COMPONENTS (DEBUG_MEMORY_MANAGER|DEBUG_INTERPRETER)
// #define DEBUG_COMPONENTS (DEBUG_ASSEMBLER|DEBUG_TRACE_ENTEREXIT)
#define DEBUG_COMPONENTS (DEBUG_ASSEMBLER)
// #define DEBUG_COMPONENTS (DEBUG_TRACE_RECORDER|DEBUG_INTERPRETER)
+#endif
#endif
View
6 vm/jit.cc
@@ -546,7 +546,9 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
case BcIns::kMOV_RES: {
if (!(IRRef)lastResult_) {
- DBG(cerr << "NYI: MOV_RES with out-of trace input." << endl);
+#if !defined(NDEBUG)
+ cerr << "NYI: MOV_RES with out-of trace input." << endl;
+#endif
goto abort_recording;
}
buf_.setSlot(ins->a(), lastResult_);
@@ -936,7 +938,7 @@ void Fragment::restoreSnapshot(ExitNo exitno, ExitState *ex) {
cap->traceExitHpLim_ = ex->hplim;
if (snapins->opcode() != IR::kHEAPCHK && sn.bumpExitCounter()) {
- cerr << COL_RED "HOTSIDE" COL_RESET "\n";
+ DBG(cerr << COL_RED "HOTSIDE" COL_RESET "\n");
cap->jit()->beginSideTrace(cap, base, this, exitno);
cap->setState(Capability::STATE_RECORD);
}

No commit comments for this range

Something went wrong with that request. Please try again.