Skip to content

Commit 8630330

Browse files
author
Rajkumar Natarajan
committed
eta573 Rename core runtime ready for review
1 parent 01216f1 commit 8630330

139 files changed

Lines changed: 282 additions & 344 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ result
1818
utils/scripts/lib/
1919
release.log
2020
binaries/
21-
.gradle
21+
.gradle
22+
.idea
23+
rts/.classpath
24+
rts/.project
25+
rts/.settings/
26+
rts/rts.iml

compiler/ETA/CodeGen/Closure.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ lfClass hasStdLayout _arity fvs (LFThunk {..}) =
7171
| hasStdLayout = T.pack (show fvs)
7272
| otherwise = mempty
7373
lfClass hasStdLayout args fvs (LFReEntrant {..})
74-
= stgFun <> funExt
74+
= etaFun <> funExt
7575
where funExt
7676
| hasStdLayout = T.pack (show args) <> fvsText
7777
| args <= 6 = T.pack (show args)

compiler/ETA/CodeGen/Layout.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ slowCall dflags loadContext fun argFtCodes
230230
where n = length argFtCodes
231231
ft = locFt fun
232232
code = loadLoc fun
233-
realCls = fromMaybe stgClosure $ locClass fun
233+
realCls = fromMaybe etaClosure $ locClass fun
234234
(arity, fts) = slowCallPattern $ map (\(a,_,_) -> a) argFtCodes
235235
slowCode = directCall' loadContext True True realCls
236236
(mkApFast arity realCls fts)
@@ -239,7 +239,7 @@ slowCall dflags loadContext fun argFtCodes
239239
directCall :: Code -> Type -> CgLoc -> RepArity -> [(ArgRep, Maybe FieldType, Maybe Code)] -> (Code, Maybe Code)
240240
directCall loadContext funType fun arity argFtCodes
241241
| Just staticCode <- loadStaticMethod fun argFts
242-
= directCall' loadContext True True stgClosure
242+
= directCall' loadContext True True etaClosure
243243
staticCode arity ((P, Nothing, Nothing):argFtCodes)
244244
| arity' == arity =
245245
directCall' loadContext True True realCls (mkApFast arity' realCls fts) arity'
@@ -249,7 +249,7 @@ directCall loadContext funType fun arity argFtCodes
249249
code = loadLoc fun
250250
ft = locFt fun
251251
entryCode = enterMethod loadContext fun
252-
realCls = fromMaybe stgClosure $ locClass fun
252+
realCls = fromMaybe etaClosure $ locClass fun
253253
argFts' = catMaybes . take arity $ map (\(_,ft,_) -> ft) argFtCodes
254254
-- All this logic is to get around some weird issues with
255255
-- the java monad type inlining. Ideally, argFts = staticFts
@@ -308,7 +308,7 @@ genApplyCall :: Code -> Int -> [FieldType] -> [(ArgRep, Maybe FieldType, Maybe C
308308
genApplyCall loadContext arity fts args =
309309
loadContext
310310
<> fold loadCodes
311-
<> mkApFast arity stgClosure fts
311+
<> mkApFast arity etaClosure fts
312312
where loadCodes = mapMaybe (\(_, _, a) -> a) args
313313

314314
getRepFtCodes :: [StgArg] -> CodeGen [(ArgRep, Maybe FieldType, Maybe Code)]

compiler/ETA/CodeGen/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ externaliseId _dflags id = do
246246
cgTyCon :: TyCon -> CodeGen ()
247247
cgTyCon tyCon = unless (null dataCons) $ do
248248
dflags <- getDynFlags
249-
(_, CgState {..}) <- newTypeClosure (tyConClass dflags tyCon) stgConstr
249+
(_, CgState {..}) <- newTypeClosure (tyConClass dflags tyCon) etaDataCon
250250
mapM_ (cgDataCon cgClassName) dataCons
251251
when (isEnumerationTyCon tyCon) $
252252
cgEnumerationTyCon cgClassName tyCon

compiler/ETA/CodeGen/Rts.hs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ import qualified Data.Text as T
1515
merge :: Text -> Text -> Text
1616
merge x y = T.append x . T.cons '/' $ y
1717

18-
rts, apply, thunk, stg, exception, io, util, stm, par, interp, conc :: Text -> Text
18+
rts, eta, etaex, apply, thunk, stg, exception, io, util, stm, par, interp, conc :: Text -> Text
1919
rts = merge "eta/runtime"
20+
eta = merge "eta"
21+
etaex = merge "eta/exception"
2022
apply = merge (rts "apply")
2123
thunk = merge (rts "thunk")
2224
stg = merge (rts "stg")
@@ -32,16 +34,16 @@ closureType, indStaticType, contextType, capabilityType, taskType, funType, tsoT
3234
frameType, conType, thunkType, rtsConfigType, exitCodeType,
3335
rtsOptsEnbledType, stgArrayType, stgByteArrayType, stgMutVarType, stgMVarType,
3436
hsResultType, stgTVarType, stgBCOType, stgWeakType :: FieldType
35-
closureType = obj stgClosure
37+
closureType = obj etaClosure
3638
indStaticType = obj stgIndStatic
3739
contextType = obj stgContext
3840
capabilityType = obj capability
3941
taskType = obj task
40-
funType = obj stgFun
42+
funType = obj etaFun
4143
tsoType = obj stgTSO
4244
frameType = obj stackFrame
43-
conType = obj stgConstr
44-
thunkType = obj stgThunk
45+
conType = obj etaDataCon
46+
thunkType = obj etaThunk
4547
rtsConfigType = obj rtsConfig
4648
rtsOptsEnbledType = obj rtsOptsEnbled
4749
exitCodeType = obj exitCode
@@ -54,19 +56,19 @@ hsResultType = obj hsResult
5456
stgBCOType = obj stgBCO
5557
stgWeakType = obj stgWeak
5658

57-
stgConstr, stgClosure, stgContext, capability, task, stgInd, stgIndStatic, stgThunk,
58-
stgFun, stgTSO, stackFrame, rtsConfig, rtsOptsEnbled, exitCode, stgArray,
59+
etaDataCon, etaClosure, stgContext, capability, task, stgInd, stgIndStatic, etaThunk,
60+
etaFun, stgTSO, stackFrame, rtsConfig, rtsOptsEnbled, exitCode, stgArray,
5961
stgByteArray, rtsUnsigned, stgMutVar, stgMVar, stgTVar, rtsGroup, hsResult,
6062
stgBCO, stgWeak :: Text
61-
stgConstr = stg "DataCon"
62-
stgClosure = stg "Closure"
63+
etaDataCon = eta "DataCon"
64+
etaClosure = eta "Closure"
6365
stgContext = stg "StgContext"
64-
capability = stg "Capability"
66+
capability = rts "Capability"
6567
task = stg "Task"
66-
stgInd = thunk "UpdatableThunk"
68+
stgInd = eta "UpdatableThunk"
6769
stgIndStatic = thunk "CAF"
68-
stgThunk = thunk "Thunk"
69-
stgFun = apply "Function"
70+
etaThunk = eta "Thunk"
71+
etaFun = eta "Function"
7072
stgTSO = stg "TSO"
7173
stackFrame = stg "StackFrame"
7274
rtsConfig = rts "RtsConfig"
@@ -206,14 +208,15 @@ resumeInterruptsMethod :: Code
206208
resumeInterruptsMethod =
207209
invokevirtual $ mkMethodRef stgTSO "resumeInterrupts" [jbool] void
208210

209-
stgExceptionGroup, ioGroup, stmGroup, concGroup, parGroup, interpGroup, stgGroup :: Text
211+
stgExceptionGroup, ioGroup, stmGroup, concGroup, parGroup, interpGroup, stgGroup, applyGroup :: Text
210212
stgExceptionGroup = exception "Exception"
211213
ioGroup = io "IO"
212214
stmGroup = stm "STM"
213215
concGroup = conc "Concurrent"
214216
stgGroup = stg "Stg"
215217
parGroup = par "Parallel"
216218
interpGroup = interp "Interpreter"
219+
applyGroup = apply "Apply"
217220

218221
-- Types
219222
byteArrayBuf :: Code
@@ -275,7 +278,7 @@ getTagMethod :: Code -> Code
275278
getTagMethod code
276279
= code
277280
<> gconv closureType conType
278-
<> invokevirtual (mkMethodRef stgConstr "getTag" [] (ret jint))
281+
<> invokevirtual (mkMethodRef etaDataCon "getTag" [] (ret jint))
279282

280283
printStream :: Text
281284
printStream = "java/io/PrintStream"

compiler/ETA/CodeGen/Types.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,15 @@ enterMethod loadContext cgLoc
328328
<> gconv closureType (obj closureCls)
329329
<> loadContext
330330
<> invokevirtual (mkMethodRef closureCls "enter" [contextType] (ret closureType))
331-
where closureCls = fromMaybe stgClosure (locClass cgLoc)
331+
where closureCls = fromMaybe etaClosure (locClass cgLoc)
332332

333333
evaluateMethod :: Code -> CgLoc -> Code
334334
evaluateMethod loadContext cgLoc
335335
= loadLoc cgLoc
336336
<> gconv closureType (obj closureCls)
337337
<> loadContext
338338
<> invokevirtual (mkMethodRef closureCls "evaluate" [contextType] (ret closureType))
339-
where closureCls = fromMaybe stgClosure (locClass cgLoc)
339+
where closureCls = fromMaybe etaClosure (locClass cgLoc)
340340

341341
type RecIndexes = [(Int, Id)]
342342
type RecInfo = (Text, Text, Text, FieldRef, Code, RecIndexes)

libraries/base/java-utils/Utils.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
import java.util.Set;
77
import java.util.List;
88
import java.util.HashSet;
9-
109
import java.io.File;
1110
import java.io.IOException;
1211
import java.io.PrintStream;
1312
import java.io.InputStream;
1413
import java.io.UnsupportedEncodingException;
15-
1614
import java.nio.ByteOrder;
1715
import java.nio.ByteBuffer;
1816
import java.nio.file.Files;
@@ -35,20 +33,17 @@
3533
import java.nio.channels.WritableByteChannel;
3634
import java.security.MessageDigest;
3735
import java.security.NoSuchAlgorithmException;
38-
3936
import eta.runtime.Runtime;
4037
import eta.runtime.RuntimeLogging;
4138
import eta.runtime.stg.TSO;
4239
import eta.runtime.stg.StgContext;
43-
import eta.runtime.stg.Closure;
44-
import eta.runtime.stg.Capability;
40+
import eta.Closure;
41+
import eta.runtime.Capability;
4542
import eta.runtime.io.MemoryManager;
46-
4743
import ghc_prim.ghc.types.datacons.Czh;
4844
import ghc_prim.ghc.types.datacons.ZC;
4945
import ghc_prim.ghc.types.tycons.ZMZN;
5046
import ghc_prim.ghc.Types;
51-
5247
import java.lang.management.ManagementFactory;
5348
import com.sun.management.OperatingSystemMXBean;
5449

libraries/ghc-prim/java/Utils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package eta.ghc_prim;
22

33
import java.nio.ByteBuffer;
4-
54
import eta.runtime.io.MemoryManager;
65

76
public class Utils {

libraries/integer/java/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.math.BigInteger;
44
import eta.runtime.stg.StgContext;
5-
import eta.runtime.stg.Closure;
5+
import eta.Closure;
66

77
public class Utils {
88
/**

rts/src/main/java/eta/runtime/stg/Closure.java renamed to rts/src/main/java/eta/Closure.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
package eta.runtime.stg;
1+
package eta;
22

3+
import eta.runtime.stg.StgContext;
34
import java.io.Serializable;
4-
5-
import eta.runtime.stg.Capability;
6-
import eta.runtime.stg.TSO;
7-
import eta.runtime.thunk.Thunk;
8-
95
import static eta.runtime.RuntimeLogging.barf;
106

117
public abstract class Closure implements Serializable {

0 commit comments

Comments
 (0)