Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Overload resolution and dynamic dispatch patch
Overload resolution and dynamic dispatch patch [message #870171] Mon, 07 May 2012 06:59 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5838
Registered: July 2009
Senior Member

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<body bgcolor="#FFFFFF" text="#000000">
bug/378577 provides a solution for overload resolution and dynamic
dispatch. (Rather than reviewing each of the 12 commits, I suggest
just synchronizing against master and viewing the 22 file diffs,
many of which are trivial. Otherwise you'll needlessly follow the
evolution of OperationCache to CachedTypeCheckerImpl to
CachedTypeChecker and the introduction and renaming of the
all.overloads option.)<br>
In principle the changes are quite easy because there is a single
point in the control flow at which issue could be addressed. This
means that built-in operations are dynamically dispatchable to
overloads too. Unfortunately this incurs a cost on every operation
call making the dispatch cache mandatory if we are to avoid
significant performance degradation. Fortunately everything seem
localised in the TypeChecker, so providing a cache here helps both
analyzer and evaluator. <br>
There are many downsides to an analyzer cache; it has to be on the
current environment since it is in the current environment that
additional operations or properties may be added. About 20 unit
tests fail if the cache is on the root environment. So if an
application churns environments, new caches are created and the lazy
set up costs may not be justified. Iterators created nested
environments, that don't actually need a separate cache, so maybe
some API trick is needed to allow these to share a parent cache.
Nicolas Rouquette is about to submit a patch for QVTo that provides
lookup caches; this maybe made redundant by the OCL caches or just
interact very badly. The additional operation and property
facilities require the cache to be invalidated (naively - I didn't
go for a smart impact driven update) whenever the environment
changes. I suspect that QVTo and Acceleo may use additional features
and so without review their code could interact badly with an OCL
cache. Imagine; a parser encounters a helper operation, invalidates
the cache, parses the body, populating the cache, then trashes the
cache again for the next helper operation. Revised code will be two
pass parsing; pass one locates all declarations and holds the cache
bypassed; pass 2 will enable the cache and analyze expressions. The
legacy Complete OCL parser has a bugzilla outstanding to do this so
that it can resolve forward references.<br>
To preserve compatibility the cache option is no caching, and
dynamic dispatch is no dynamism.<br>
Because of the dangers enabling caching unthinkingly for analysis,
it may be irresponsible to offer the interactive option to enable
the cache. If and when QVTo or Acceleo choose to exploit the cache
then they can enable it programmatically.<br>
In summary<br>
This is a very simple fix localized to AbstractTypeChecker; (first
[378577] commit). It is a clear fix so a legacy option is not
<b>Dynamic Dispatch</b><br>
With an evaluator only cache, this is relatively simple; the legacy
behaviour option avoids loss of performance and change of behaviour.<br>
<b>Impact Analyzer</b><br>
Seems to be broken by dynamic dispatch. Any solution other than
switching to dependency analysis?<br>
<b>Analysis Cache<br>
Although useful, seems to have too many dangers.<br>
So I think the following changes are needed.<br>
a) remove the option to enable the analysis cache from the UI, allow
applications to enable it programmatically<br>
b) enable the evaluator to create a cache if the analyzer cannot
share one<br>
I'll commit a change for the above in a couple of hours.<br>
&nbsp;&nbsp;&nbsp; Regards<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink<br>
Re: Overload resolution and dynamic dispatch patch [message #870202 is a reply to message #870171] Mon, 07 May 2012 09:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5838
Registered: July 2009
Senior Member
On 07/05/2012 07:59, Ed Willink wrote:
> Hi
> bug/378577 provides a solution for overload resolution and dynamic
> dispatch. ...

Apologies sent to newsgroup rather than developers list. Please ignore.


Ed Willink
Re: Overload resolution and dynamic dispatch patch [message #870213 is a reply to message #870171] Mon, 07 May 2012 09:55 Go to previous message
Axel Uhl is currently offline Axel UhlFriend
Messages: 40
Registered: July 2009
We may consider adjusting the impact analyzer by granting it access to the dynamic dispatch cache. It may, however, lead to a situation where an operation hasn't been evaluated in a given environment yet, hence no cache entry is present for the operation, and hence the look up would provide the IA with too few operation bodies to analyze.

I claim that generally, without having evaluated all expressions on all objects, ensuring that all relevant operation bodies have been evaluated at least once, no EMF-based approach can determine a change impact because expressions affected by the change may simply not be known by the environment.

A cleaner, probably not entirely satisfying approach may involve equipping the IA with a set of EPackage objects which define the "universe" of metamodels to be considered by the IA. The IA could then, at some start-up cost, determine the operation bodies to be considered.


-- Axel
Previous Topic:ocl file parsing
Next Topic:[Announce] Eclipse OCL Core 4.0.0 (Juno) M7 is now available
Goto Forum:

Current Time: Tue Apr 24 14:46:52 GMT 2018

Powered by FUDForum. Page generated in 0.01651 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software