Replies: 10 comments
-
Here is my proposal. The motivation for doing this to allow debug information (i.e. original source information) to be represented in a sane way. I would hope that once these changes are in place we could standardise the way debug information is represented in the Boogie IVL. Attributes on commands and basic blocksIn this discussion I am only concerned with the unstructured form of Boogie. Currently you can only have attributes on the following commands
also it is not possible to but attributes on a basic block. This limitations potentially make it harder to represent debug information. I'd like to propose (informally) the following syntax
for commands which allows attributes on all commands in the unstructured form of Boogie. The only controversial command is the assign command. I'm not really sure where to put the attribute because the command is infix where as all other commands are prefix. This is my guess but I'd happily change it if there is a good reason to do so. And for basic blocks something like
Attribute sets and referencesTo avoid repetition it would be good to allow common attributes to declared (e.g. a source file name) in one place. I'm imagining global attribute set declarations like so which are in their own namespace.
The
As you can see the IMPLEMENTATION DETAIL: When doing identifier resolution attribute sets would have to be resolved before anything else in the Boogie program and we would need to do so until a fixed point is reached (we would need to detect cycles as this is done). then these could be referenced like so...
This is equivalent to
As you can see using attribute references and sets is much more concise (leading to smaller FeedbackThis is only a rough sketch of my idea. It probably needs refining so suggestions are welcome. I suspect it would be worth trying to implement some of it to see what parsing issues arise. For example we would need to disallow |
Beta Was this translation helpful? Give feedback.
-
I like the direction where this is going. My main concern is that in SMACK we use both Boogie and Corral and can easily switch between the two. So we would like to keep their input languages in sync since if they diverge a lot supporting both tools will become a nightmare. |
Beta Was this translation helpful? Give feedback.
-
@zvonimir Initially I don't think the introduction of what I propose (attribute sets, attribute references and attributes supported on all commands and basic blocks) should break many things because Corral uses Boogie's libraries and so when Corral is upgraded to use Boogie's new libraries (with my proposed additions in) it will gain the ability to parse these boogie programs with the new features but still be able to parse old programs (modulo the use of However once the proposed features land in Boogie we could use them to define a standard way of representing debug information via attributes. In that case once we decided what this was it would be a very good idea to change Corral to use this new standard. So what I'm proposing here paves the way for us to define a standard way of representing debug information but right now I'm not trying to define that (the representation of debug info). I'm just trying to get the features in place so that we can do it in the future. |
Beta Was this translation helpful? Give feedback.
-
All these are nice ideas Dan. I agree that Boogie's support for debug info needs some overhaul. Btw, I am a bit skeptical about the assign command's attribute being at the beginning (i.e. {:attribute "foo"} [, ...] := [, ...]). I wonder if it makes more sense and improves readability to have it in the end or maybe after the := op. But this is just a suggestion. |
Beta Was this translation helpful? Give feedback.
-
@pdeligia I'm also sceptical of where I've placed the attributes for the assign command which is why I'm raising this issue early so we can discuss it. I guess our options are
Something we might want to bear in mind is... what if in the future we want to add attributes to expressions too. In that case only the first two options are usable. |
Beta Was this translation helpful? Give feedback.
-
Hi Dan,
More importantly, I think the job of the compiler would become even harder Of course, none of these are fundamental restrictions, just inertia.
Akash On Thu, Apr 23, 2015 at 3:52 AM, Dan Liew notifications@github.com wrote:
|
Beta Was this translation helpful? Give feedback.
-
Custom attributes have been useful for a variety of purposes. Allowing them in more places is a good idea. For commands like (As a remark, attributes, including triggers, on quantifiers go after the Regarding Akash’s concern about program transformations that may destroy attribute information (like on basic blocks and return statements), I think we are already vulnerable to this problem today. For example, I acknowledge that there can be considerable repetition in some uses of attributes, which invites the design of constructs that reduce such clutter. My opinion, however, is that it’s better to use existing constructs in the language to achieve this. For example, you can declare a constant with an attribute:
and then reference this constant in other attributes:
It would be easy enough to embellish the attributing-finding routines in the Boogie implementation to trace through such
Rustan |
Beta Was this translation helpful? Give feedback.
-
My intention is to allow attributes on basic blocks, whether or not we
I don't agree. From a philosophical perspective using extra From a practical perspective it is very inefficient in terms of the space used on disk (i.e. for the It also sometimes breaks an optimisation of my tool if there are branches
My tool tries to look one instruction ahead when it sees a
Currently I would not expect a program transformation to preserve attributes on basic blocks if they are coalesced. If we decide on a standard way of representing debug information using attributes on commands and basic blocks then ideally all program transforms should preserve these particular attributes if possible. This is not a new problem, for example LLVM represents its debug information using metadata which is attached to commands and program transformations are expected to preserve the debug information.
Maybe. I don't envisage putting debug information on basic blocks. I would rather debug information be attached to commands.
Ideally I'd like to save space in RAM too so these attribute sets should be a new type of top level declaration in the in memory representation of the boogie program and the attribute references should be preserved (i.e. all references point to the same instance in memory).
Ideally when we emit a program the attribute references and sets should be preserved, i.e. the emitted program should be just as compact as the original program. |
Beta Was this translation helpful? Give feedback.
-
I agree that having attributes on block labels, etc. is a good idea. Regarding debugging information, my intention wasn't to contradict or Akash On Fri, Apr 24, 2015 at 1:38 PM, Dan Liew notifications@github.com wrote:
|
Beta Was this translation helpful? Give feedback.
-
Sounds sensible
That's interesting. I guess this has a few advantages
But I see several disadvantages to this
Admittedly my arguments aren't particularly strong but I'm sure others can chime in with their views on this. |
Beta Was this translation helpful? Give feedback.
-
Boogie currently doesn't allow attributes on all commands (e.g. assignment, goto). There doesn't seem to be a good reason for this. Allowing this would allow debug information to represented in a sane way (currently people just add
assume true
which is ugly).Beta Was this translation helpful? Give feedback.
All reactions