From 8fbcf915b2d0d22e45a3d7515bf4a325efc15169 Mon Sep 17 00:00:00 2001 From: fridis Date: Thu, 12 Sep 2024 23:08:10 +0200 Subject: [PATCH] lib/me/air: cleanup for marking features used by `effect.instate0` Managed to remove `if (3%%4) e.static_finally` by adding the feature dependance in `MiddleEnd.martInternallyUsed`. Remove unused code. --- lib/effect.fz | 4 ---- src/dev/flang/air/Clazz.java | 23 ----------------------- src/dev/flang/me/MiddleEnd.java | 4 ++++ 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/lib/effect.fz b/lib/effect.fz index 3cf48b9b57..55988fddcf 100644 --- a/lib/effect.fz +++ b/lib/effect.fz @@ -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 @@ -311,8 +309,6 @@ public effect is static_finally => finally - - # -------------------- helper features -------------------- diff --git a/src/dev/flang/air/Clazz.java b/src/dev/flang/air/Clazz.java index 8e0ed07102..649c75319d 100644 --- a/src/dev/flang/air/Clazz.java +++ b/src/dev/flang/air/Clazz.java @@ -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); diff --git a/src/dev/flang/me/MiddleEnd.java b/src/dev/flang/me/MiddleEnd.java index 86ef987523..7d627a0873 100644 --- a/src/dev/flang/me/MiddleEnd.java +++ b/src/dev/flang/me/MiddleEnd.java @@ -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); }