Skip to content

Commit

Permalink
lib/me/air: cleanup for marking features used by effect.instate0
Browse files Browse the repository at this point in the history
Managed to remove `if (3%%4) e.static_finally` by adding the feature dependance
in `MiddleEnd.martInternallyUsed`.

Remove unused code.
  • Loading branch information
fridis committed Sep 12, 2024
1 parent 9e4ba0f commit 8fbcf91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
4 changes: 0 additions & 4 deletions lib/effect.fz
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ public effect is
c := Effect_Call code
d := Effect_Call2 def
instate0 (Effect_Call R) (Effect_Call2 R effect.this) e c d
if (3%%4) e.static_finally
# NYI: cleanup
c.r.or_else d.r.get


Expand Down Expand Up @@ -311,8 +309,6 @@ public effect is
static_finally => finally




# -------------------- helper features --------------------


Expand Down
23 changes: 0 additions & 23 deletions src/dev/flang/air/Clazz.java
Original file line number Diff line number Diff line change
Expand Up @@ -1815,29 +1815,6 @@ void intrinsicCalled(HasSourcePosition at)
actualGenerics()[0].lookup(Types.resolved.f_Function_call, at);
actualGenerics()[1].lookup(Types.resolved.f_Function_call, at);
argumentFields()[0].resultClazz().lookup(Types.resolved.f_effect_static_finally, at);
_clazzes.addUsedFeature(Types.resolved.f_Function_call, at);
_clazzes.addUsedFeature(Types.resolved.f_effect_static_finally, at);
/*
var ec2 = actualGenerics()[2];
var ec2c = _flu.lookupFeature(ec2.feature(), Types.resolved.f_Function_call.featureName(), null);
var ec2ce = ec2c.valueArguments().get(0);
System.out.println("GOT: "+ec2ce.qualifiedName());
_clazzes.addUsedFeature(ec2ce, at);
var c = actualGenerics()[2].lookup(Types.resolved.f_Function_call, at);
System.out.println("mark used "+c.feature().valueArguments().get(0).qualifiedName());
_clazzes.addUsedFeature(c.feature().valueArguments().get(0), at);
markInstantiated(c, at);
var ca = c.lookup(c.feature().valueArguments().get(0), at);
System.out.println("mark used "+c.feature().valueArguments().get(0).qualifiedName());
_clazzes.addUsedFeature(c.feature().valueArguments().get(0), at);
markInstantiated(ca, at);
var afs = c.argumentFields();
System.out.println("afs is "+afs.length+" "+afs+" for "+c);
*/
// _clazzes.calledDynamically(Types.resolved.f_Function_call, new List<>());
// argumentFields()[1].resultClazz().lookup(Types.resolved.f_Function_call, at);
// argumentFields()[2].resultClazz().lookup(Types.resolved.f_Function_call, at);
break;
case "fuzion.sys.thread.spawn0":
argumentFields()[0].resultClazz().lookup(Types.resolved.f_Function_call, at);
Expand Down
4 changes: 4 additions & 0 deletions src/dev/flang/me/MiddleEnd.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ void markInternallyUsed() {
markUsed(Types.resolved.f_Const_String_utf8_data , SourcePosition.builtIn); // NYI: UNDER DEVELOPMENT: this should be unnecessary?
markUsed(flu.lookupFeature(universe, FeatureName.get(FuzionConstants.UNIT_NAME, 0), null) , SourcePosition.builtIn);
markUsed(flu.lookupFeature(universe, FeatureName.get("void" , 0), null) , SourcePosition.builtIn);

// these are required by effect.instate0
markUsed(Types.resolved.f_effect_static_finally, SourcePosition.builtIn);
markUsed(Types.resolved.f_Function_call, SourcePosition.builtIn);
}


Expand Down

0 comments on commit 8fbcf91

Please sign in to comment.