Skip to content

Commit

Permalink
eta573 Rename core runtime ready for review
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajkumar Natarajan committed Apr 4, 2018
1 parent 01216f1 commit 6466d87
Show file tree
Hide file tree
Showing 135 changed files with 263 additions and 327 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -18,4 +18,9 @@ result
utils/scripts/lib/
release.log
binaries/
.gradle
.gradle
.idea
rts/.classpath
rts/.project
rts/.settings/
rts/rts.iml
13 changes: 7 additions & 6 deletions compiler/ETA/CodeGen/Rts.hs
Expand Up @@ -15,8 +15,9 @@ import qualified Data.Text as T
merge :: Text -> Text -> Text
merge x y = T.append x . T.cons '/' $ y

rts, apply, thunk, stg, exception, io, util, stm, par, interp, conc :: Text -> Text
rts, eta, apply, thunk, stg, exception, io, util, stm, par, interp, conc :: Text -> Text
rts = merge "eta/runtime"
eta = merge "eta"
apply = merge (rts "apply")
thunk = merge (rts "thunk")
stg = merge (rts "stg")
Expand Down Expand Up @@ -58,15 +59,15 @@ stgConstr, stgClosure, stgContext, capability, task, stgInd, stgIndStatic, stgTh
stgFun, stgTSO, stackFrame, rtsConfig, rtsOptsEnbled, exitCode, stgArray,
stgByteArray, rtsUnsigned, stgMutVar, stgMVar, stgTVar, rtsGroup, hsResult,
stgBCO, stgWeak :: Text
stgConstr = stg "DataCon"
stgClosure = stg "Closure"
stgConstr = eta "DataCon"
stgClosure = eta "Closure"
stgContext = stg "StgContext"
capability = stg "Capability"
capability = rts "Capability"
task = stg "Task"
stgInd = thunk "UpdatableThunk"
stgIndStatic = thunk "CAF"
stgThunk = thunk "Thunk"
stgFun = apply "Function"
stgThunk = eta "Thunk"
stgFun = eta "Function"
stgTSO = stg "TSO"
stackFrame = stg "StackFrame"
rtsConfig = rts "RtsConfig"
Expand Down
9 changes: 2 additions & 7 deletions libraries/base/java-utils/Utils.java
Expand Up @@ -6,13 +6,11 @@
import java.util.Set;
import java.util.List;
import java.util.HashSet;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

import java.nio.ByteOrder;
import java.nio.ByteBuffer;
import java.nio.file.Files;
Expand All @@ -35,20 +33,17 @@
import java.nio.channels.WritableByteChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import eta.runtime.Runtime;
import eta.runtime.RuntimeLogging;
import eta.runtime.stg.TSO;
import eta.runtime.stg.StgContext;
import eta.runtime.stg.Closure;
import eta.runtime.stg.Capability;
import eta.Closure;
import eta.runtime.Capability;
import eta.runtime.io.MemoryManager;

import ghc_prim.ghc.types.datacons.Czh;
import ghc_prim.ghc.types.datacons.ZC;
import ghc_prim.ghc.types.tycons.ZMZN;
import ghc_prim.ghc.Types;

import java.lang.management.ManagementFactory;
import com.sun.management.OperatingSystemMXBean;

Expand Down
1 change: 0 additions & 1 deletion libraries/ghc-prim/java/Utils.java
@@ -1,7 +1,6 @@
package eta.ghc_prim;

import java.nio.ByteBuffer;

import eta.runtime.io.MemoryManager;

public class Utils {
Expand Down
2 changes: 1 addition & 1 deletion libraries/integer/java/Utils.java
Expand Up @@ -2,7 +2,7 @@

import java.math.BigInteger;
import eta.runtime.stg.StgContext;
import eta.runtime.stg.Closure;
import eta.Closure;

public class Utils {
/**
Expand Down
@@ -1,11 +1,7 @@
package eta.runtime.stg;
package eta;

import eta.runtime.stg.StgContext;
import java.io.Serializable;

import eta.runtime.stg.Capability;
import eta.runtime.stg.TSO;
import eta.runtime.thunk.Thunk;

import static eta.runtime.RuntimeLogging.barf;

public abstract class Closure implements Serializable {
Expand Down
@@ -1,4 +1,7 @@
package eta.runtime.stg;
package eta;

import eta.runtime.stg.Print;
import eta.runtime.stg.StgContext;

import static eta.runtime.RuntimeLogging.barf;

Expand Down
@@ -1,11 +1,10 @@
package eta.runtime.apply;
package eta;

import eta.runtime.apply.PAPSlow;
import eta.runtime.apply.PAP1_1;
import eta.runtime.stg.Print;
import eta.runtime.stg.Value;
import eta.runtime.stg.Closure;
import eta.runtime.stg.StgContext;
import eta.runtime.stg.ArgumentStack;

import static eta.runtime.RuntimeLogging.barf;

public abstract class Function extends Value {
Expand Down
@@ -1,25 +1,21 @@
package eta.runtime.thunk;
package eta;

import java.lang.reflect.Field;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;

import eta.runtime.stg.Print;
import eta.runtime.stg.Value;
import eta.runtime.stg.Capability;
import eta.runtime.stg.Closure;
import eta.runtime.Capability;
import eta.runtime.stg.StgContext;
import eta.runtime.stg.TSO;
import eta.runtime.thunk.*;
import eta.runtime.util.UnsafeUtil;
import eta.runtime.message.MessageBlackHole;
import eta.runtime.exception.Exception;
import eta.runtime.exception.EtaException;
import eta.exception.Exception;
import eta.exception.EtaException;
import eta.runtime.exception.EtaAsyncException;
import eta.runtime.exception.Raise;
import eta.runtime.exception.StgException;
import static eta.runtime.util.UnsafeUtil.UNSAFE;
import static eta.runtime.RuntimeLogging.barf;
import static eta.runtime.stg.TSO.WhyBlocked.*;

public abstract class Thunk extends Closure {
Expand Down Expand Up @@ -279,7 +275,7 @@ protected static boolean handleException(StgContext context, java.lang.Exception
if (raise == null) {
context.raise = raise = new Raise(((EtaException) thrw).exception);
}
ui.updatee.updateCode(context, raise);
ui.getUpdatee().updateCode(context, raise);
} //TODO: Handle EtaAsyncExceptions?
throw thrw;
}
Expand Down
@@ -1,7 +1,7 @@
package eta.runtime.thunk;
package eta;

import eta.runtime.stg.Closure;
import eta.runtime.stg.StgContext;
import eta.runtime.thunk.UpdateInfo;

public abstract class UpdatableThunk extends Thunk {

Expand All @@ -28,7 +28,7 @@ public final Closure evaluate(StgContext context) {
context.popUpdate();
context.trampoline = trampoline;
}
if (ui.marked) {
if (ui.isMarked()) {
return updateCode(context, result);
} else {
updateWithIndirection(result);
Expand Down
@@ -1,5 +1,6 @@
package eta.runtime.stg;
package eta;

import eta.runtime.stg.StgContext;
import static eta.runtime.RuntimeLogging.barf;

public abstract class Value extends Closure {
Expand Down
@@ -1,6 +1,7 @@
package eta.runtime.exception;
package eta.exception;

import eta.runtime.stg.Closure;
import eta.Closure;
import eta.runtime.exception.StgException;
import eta.runtime.stg.Closures;

public class EtaException extends StgException {
Expand Down
@@ -1,15 +1,14 @@
package eta.runtime.exception;
package eta.exception;

import java.util.Arrays;
import java.util.ListIterator;

import eta.runtime.stg.Capability;
import eta.Closure;
import eta.runtime.exception.StgException;
import eta.runtime.exception.EtaAsyncException;
import eta.runtime.Capability;
import eta.runtime.stg.TSO;
import eta.runtime.stg.Closure;
import eta.runtime.stg.Closures;
import eta.runtime.stg.StgContext;
import eta.runtime.thunk.UpdateInfo;

import eta.runtime.Runtime;
import eta.runtime.message.MessageBlackHole;
import eta.runtime.message.MessageThrowTo;
Expand Down
@@ -1,4 +1,4 @@
package eta.runtime.stg;
package eta.runtime;

import java.util.List;
import java.util.LinkedList;
Expand All @@ -12,15 +12,11 @@
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import java.lang.ref.WeakReference;

import eta.runtime.Runtime;
import eta.runtime.io.IO;
import eta.runtime.io.MemoryManager;
import eta.runtime.concurrent.Concurrent;
import eta.runtime.concurrent.WorkerThread;
import eta.runtime.exception.Exception;
import eta.exception.Exception;
import eta.runtime.exception.FiberYieldException;
import eta.runtime.interpreter.Interpreter;
import eta.runtime.message.Message;
Expand All @@ -29,12 +25,15 @@
import eta.runtime.message.MessageShutdown;
import eta.runtime.message.MessageWakeup;
import eta.runtime.parallel.Parallel;
import eta.Closure;
import eta.runtime.stg.Closures;
import eta.runtime.stg.StgContext;
import eta.runtime.stg.TSO;
import eta.runtime.storage.Block;
import eta.runtime.storage.LocalHeap;
import eta.runtime.thunk.BlockingQueue;
import eta.runtime.thunk.Thunk;
import eta.Thunk;
import eta.runtime.thunk.UpdateInfo;
import eta.runtime.thunk.WhiteHole;
import eta.runtime.util.MPSCLongQueue;
import static eta.runtime.stg.TSO.*;
import static eta.runtime.stg.TSO.WhatNext;
Expand Down
10 changes: 1 addition & 9 deletions rts/src/main/java/eta/runtime/Runtime.java
@@ -1,17 +1,9 @@
package eta.runtime;

import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

import eta.runtime.stg.Capability;
import eta.runtime.stg.Closure;
import eta.Closure;
import eta.runtime.stg.Closures;
import eta.runtime.stg.TSO;
import eta.runtime.stg.WeakPtr;
import eta.runtime.io.MemoryManager;
import eta.runtime.exception.RuntimeInternalError;


public class Runtime {

Expand Down
5 changes: 1 addition & 4 deletions rts/src/main/java/eta/runtime/RuntimeLogging.java
@@ -1,11 +1,8 @@
package eta.runtime;

import eta.runtime.Runtime;
import eta.runtime.stg.Capability;
import eta.runtime.stg.Closure;
import eta.Closure;
import eta.runtime.stg.TSO;
import eta.runtime.exception.RuntimeInternalError;

import java.util.concurrent.atomic.AtomicBoolean;

public class RuntimeLogging {
Expand Down
3 changes: 2 additions & 1 deletion rts/src/main/java/eta/runtime/apply/Function1.java
@@ -1,6 +1,7 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Function;
import eta.Closure;
import eta.runtime.stg.StgContext;

public class Function1 extends Function {
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function1_1.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function1_1 extends Function1 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function1_2.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function1_2 extends Function1 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function1_3.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function1_3 extends Function1 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function1_4.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function1_4 extends Function1 {
public Closure x1;
Expand Down
3 changes: 2 additions & 1 deletion rts/src/main/java/eta/runtime/apply/Function2.java
@@ -1,6 +1,7 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Function;
import eta.Closure;
import eta.runtime.stg.StgContext;

public class Function2 extends Function {
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function2_1.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function2_1 extends Function2 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function2_2.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function2_2 extends Function2 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function2_3.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function2_3 extends Function2 {
public Closure x1;
Expand Down
2 changes: 1 addition & 1 deletion rts/src/main/java/eta/runtime/apply/Function2_4.java
@@ -1,6 +1,6 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Closure;

public class Function2_4 extends Function2 {
public Closure x1;
Expand Down
3 changes: 2 additions & 1 deletion rts/src/main/java/eta/runtime/apply/Function3.java
@@ -1,6 +1,7 @@
package eta.runtime.apply;

import eta.runtime.stg.Closure;
import eta.Function;
import eta.Closure;
import eta.runtime.stg.StgContext;

public class Function3 extends Function {
Expand Down

0 comments on commit 6466d87

Please sign in to comment.