Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'origin/side-traces' into side-traces

Conflicts:
	tests/Bench/SumSquare1.hs
	vm/jit.cc
  • Loading branch information...
commit f5ab76c5146eb3d7e838f714db9c3d99bc02eb96 2 parents 19d93d7 + 8d9215b
Thomas Schilling authored
12 compiler/Lambdachine/Options.hs
View
@@ -10,7 +10,8 @@ data Options = Options
{ inputFile :: FilePath
, package_name :: String
, dumpCoreBinds :: Bool
- , dumpBytecode :: Bool }
+ , dumpBytecode :: Bool
+ , optLevel :: Int }
deriving (Show, Data, Typeable)
options = Options
@@ -19,9 +20,14 @@ options = Options
, dumpCoreBinds = def &= explicit &= name "dump-core-binds"
&= help "Dump GHC's Core."
, dumpBytecode = def &= explicit &= name "dump-bytecode"
- &= help "Dump generated bytecode" }
+ &= help "Dump generated bytecode"
+ , optLevel = def &= opt (0 :: Int) }
&= summary "The Lambdachine Compiler, v0.1"
&= program "lc"
getOptions :: IO Options
-getOptions = cmdArgs options
+getOptions = do
+ opts <- cmdArgs options
+ let level = max 0 (min 2 (optLevel opts))
+ return opts{ optLevel = level }
+
3  compiler/Main.hs
View
@@ -34,7 +34,8 @@ main = do
opts <- Cli.getOptions
runGhc (Just libdir) $ do
dflags0 <- getSessionDynFlags
- let dflags1 = dflags0{ ghcLink = NoLink }
+ let dflags1 = dflags0{ ghcLink = NoLink
+ , optLevel = Cli.optLevel opts }
dflags2 | Cli.package_name opts /= ""
= setPackageName (Cli.package_name opts) dflags1
| otherwise = dflags1
4 tests/Bench/SumSquare1.hs
View
@@ -26,7 +26,7 @@ enumFromTo'Int from@(I# m) to@(I# n) =
sum :: [Int] -> Int
sum l = sum_aux (I# 0#) l
-{-# NOINLINE sum_aux #-}
+{- # 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,7 +39,7 @@ root x = sum [ I# (a# *# b#)
test = root 20 == 23485
-bench = root 15000
+bench = root 15000 == 6329531334376250
#ifdef BENCH_GHC
main = print bench
6 vm/assembler.cc
View
@@ -857,9 +857,11 @@ void Assembler::assemble(IRBuffer *buf, MachineCode *mcode) {
TraceId thisTraceId = Jit::fragments_.size();
if (stopins_ != REF_FIRST) {
buf->setRegsAllocated();
- buf->debugPrint(cerr, thisTraceId);
+ if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER)
+ buf->debugPrint(cerr, thisTraceId);
if (!mergeWithParent()) {
- exit(3);
+ cerr << "NYI: merge with parent failed\n";
+ exit(EXIT_FAILURE);
}
}
6 vm/ir_fold.cc
View
@@ -369,8 +369,10 @@ TRef IRBuffer::optFold() {
return TRef(ref, ir(ref)->t());
if (ref == KLITFOLD)
return literal(fold_.ins.type(), fold_.literal);
- if (ref == FAILFOLD)
- exit(44);
+ if (ref == FAILFOLD) {
+ cerr << "NYI: Recover from FAILFOLD\n";
+ exit(EXIT_FAILURE);
+ }
LC_ASSERT(ref == DROPFOLD);
return TRef();
}
9 vm/jit.cc
View
@@ -169,8 +169,10 @@ void Jit::beginSideTrace(Capability *cap, Word *base, Fragment *parent, SnapNo s
replaySnapshot(parent, snapno, base);
- buf_.debugPrint(cerr, 0);
- buf_.slots_.debugPrint(cerr);
+ if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER) {
+ buf_.debugPrint(cerr, ~0);
+ buf_.slots_.debugPrint(cerr);
+ }
// exit(1);
}
@@ -685,7 +687,6 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
<< parent->traceId() << ") found." COL_RESET "\n";
buf_.emit(IR::kSAVE, IRT_VOID | IRT_GUARD, IR_SAVE_LINK,
parent->traceId());
- buf_.debugPrint(cerr, 1);
finishRecording();
return true;
exit(7);
@@ -732,7 +733,7 @@ void Jit::finishRecording() {
DBG(cerr << "Recorded: " << endl);
asm_.assemble(buffer(), mcode());
if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER)
- buf_.debugPrint(cerr, 1);
+ buf_.debugPrint(cerr, Jit::numFragments());
int tno = fragments_.size();
Please sign in to comment.
Something went wrong with that request. Please try again.