Comments (5)
It doesn’t currently, and it doesn’t need to, but that would be a good enhancement.
Basically, we don’t have a lot of code using functions that affect permissions around control flow, and where we do, Ward already complains about it and it’s easy to refactor. Stuff like:
void foo ()
{
lock ();
if (bar ()) {
unlock ();
return 0;
}
baz ();
unlock ();
return 1;
}
from ward.
hmm. i'm not entirely convinced we'll always have conflicts if we just treat return as a fallthru. or perhaps we will but they might be difficult to understand. but it does look like the right thing would happen for things like lock/unlock, so i'm content to revisit this in the future.
from ward.
An easy hack would be to convert the graph to a tree by duplicating segments, maybe with sharing so there’s no actual copying:
if (a ()) goto skip;
b ();
skip: c ();
(a → { b, c }, b → c) ⇒ (a & (c1 | b & c2))
a a
/ \ / \
b | => b |
\ / | |
c c c
But of course this doesn’t work with back-edges.
from ward.
It occurs to me that we could also decompose call trees into one “function” for each basic block. So the example you gave could be:
foo = foo1
foo1 = f1 & (foo2 | foo3)
foo2 = f2 & foo4
foo3 = f3 & foo4
foo4 = 0
(Then during inference, some basic optimisations like TCO would show up: when we’re inferring a node in tail position, we wouldn’t need to add another stack frame.)
from ward.
Yea I think I basically agree with this. One property that we should have is that we enjoy an abstraction property
: it should be sound to abstract out any CallTree
into a separate toplevel function and have an inference result that is no less precise than before. (I think in general abstraction may lose precision - not sure if that can happen in ward).
I'm not sure what you mean about TCO or stack frames
from ward.
Related Issues (20)
- Add support for writing a CallMap to disk and loading it instead of the original C file HOT 3
- Something isn't right with static functions in a CallMap
- Termination condition is wrong HOT 1
- Is simplifyCallTree is wrong on Choice Nop t ? HOT 2
- Conflicts and failed restrictions beneath 'Choice' nodes aren't reported HOT 3
- Differentiate “need” from “use” HOT 1
- Ward should define a preprocessor symbol HOT 1
- Verbose mode with boring statistics?
- Upload to Hackage
- Flesh out warnings and errors
- Poor performance on real-world codebase HOT 6
- Error disappears when a module is added HOT 5
- Errors are reported on a single line
- Feature proposal: Parametric permissions HOT 2
- Formally specify type system
- Generate HTML report HOT 1
- Fix SGen issues HOT 1
- Make annotations mandatory in some cases
- Remove mentions of "permission" attribute HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ward.