Skip to content

Commit

Permalink
Remove TailCall.TailPosition.NotTail metadata. (#11303)
Browse files Browse the repository at this point in the history
`TailCall.TailPosition.NotTail` metadata is attached to every `IR` element that is not in tail position. Which is true for most IR elements. This is inefficient and unnecessary. This PR removes this metadata and keeps only `TailCall.TailPosition.Tail`. This removes few bytes from `MetadataStorage` from most of IR elements

# Important Notes
To check whether `ir` element is not in tail position, we used to check it with something like this `ir.getMetadata(TailCall) == Some(TailCall.TailPosition.NotTail)`, now, we simply can do it with `ir.getMetadata(TailCall) == None`
  • Loading branch information
Akirathan authored Oct 11, 2024
1 parent eccc3a0 commit d9b3c75
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
@Persistable(clazz = Graph.Link.class, id = 1266, allowInlining = false)
@Persistable(clazz = TypeInference.class, id = 1280)
@Persistable(clazz = FramePointerAnalysis$.class, id = 1281)
@Persistable(clazz = TailCall$TailPosition$Tail$.class, id = 1282)
public final class PassPersistance {
private PassPersistance() {}

Expand All @@ -90,27 +91,6 @@ protected IgnoredBindings.State readObject(Input in)
}
}

@ServiceProvider(service = Persistance.class)
public static final class PersistTail extends Persistance<TailCall.TailPosition> {
public PersistTail() {
super(TailCall.TailPosition.class, true, 1102);
}

@Override
protected void writeObject(TailCall.TailPosition obj, Output out) throws IOException {
out.writeBoolean(obj.isTail());
}

@Override
protected TailCall.TailPosition readObject(Input in)
throws IOException, ClassNotFoundException {
var b = in.readBoolean();
return b
? org.enso.compiler.pass.analyse.TailCall$TailPosition$Tail$.MODULE$
: org.enso.compiler.pass.analyse.TailCall$TailPosition$NotTail$.MODULE$;
}
}

@org.openide.util.lookup.ServiceProvider(service = Persistance.class)
public static final class PersistAliasAnalysisGraphScope extends Persistance<Graph.Scope> {
public PersistAliasAnalysisGraphScope() {
Expand Down
Loading

0 comments on commit d9b3c75

Please sign in to comment.