Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
DiSL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DiSL
DiSL
Commits
9add01a7
Commit
9add01a7
authored
Jun 07, 2014
by
Lubomir Bulej
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various cosmetic changes to simplify merging of the remaining bits from the newagent branch.
parent
15c55396
Changes
56
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
2517 additions
and
2348 deletions
+2517
-2348
src-disl/ch/usi/dag/disl/annotation/After.java
src-disl/ch/usi/dag/disl/annotation/After.java
+78
-66
src-disl/ch/usi/dag/disl/annotation/AfterReturning.java
src-disl/ch/usi/dag/disl/annotation/AfterReturning.java
+78
-66
src-disl/ch/usi/dag/disl/annotation/AfterThrowing.java
src-disl/ch/usi/dag/disl/annotation/AfterThrowing.java
+77
-66
src-disl/ch/usi/dag/disl/annotation/ArgumentProcessor.java
src-disl/ch/usi/dag/disl/annotation/ArgumentProcessor.java
+33
-18
src-disl/ch/usi/dag/disl/annotation/Before.java
src-disl/ch/usi/dag/disl/annotation/Before.java
+77
-65
src-disl/ch/usi/dag/disl/annotation/GuardMethod.java
src-disl/ch/usi/dag/disl/annotation/GuardMethod.java
+17
-10
src-disl/ch/usi/dag/disl/annotation/Guarded.java
src-disl/ch/usi/dag/disl/annotation/Guarded.java
+25
-13
src-disl/ch/usi/dag/disl/annotation/Instrumentation.java
src-disl/ch/usi/dag/disl/annotation/Instrumentation.java
+12
-7
src-disl/ch/usi/dag/disl/annotation/ProcessAlso.java
src-disl/ch/usi/dag/disl/annotation/ProcessAlso.java
+37
-19
src-disl/ch/usi/dag/disl/annotation/SyntheticLocal.java
src-disl/ch/usi/dag/disl/annotation/SyntheticLocal.java
+45
-35
src-disl/ch/usi/dag/disl/annotation/ThreadLocal.java
src-disl/ch/usi/dag/disl/annotation/ThreadLocal.java
+13
-8
src-disl/ch/usi/dag/disl/classcontext/ClassContext.java
src-disl/ch/usi/dag/disl/classcontext/ClassContext.java
+12
-9
src-disl/ch/usi/dag/disl/classparser/AbstractParser.java
src-disl/ch/usi/dag/disl/classparser/AbstractParser.java
+12
-13
src-disl/ch/usi/dag/disl/coderep/Code.java
src-disl/ch/usi/dag/disl/coderep/Code.java
+100
-100
src-disl/ch/usi/dag/disl/coderep/StaticContextMethod.java
src-disl/ch/usi/dag/disl/coderep/StaticContextMethod.java
+43
-23
src-disl/ch/usi/dag/disl/exception/ReflectionException.java
src-disl/ch/usi/dag/disl/exception/ReflectionException.java
+16
-10
src-disl/ch/usi/dag/disl/exclusion/ExclusionSet.java
src-disl/ch/usi/dag/disl/exclusion/ExclusionSet.java
+138
-152
src-disl/ch/usi/dag/disl/guard/ArgumentContextImpl.java
src-disl/ch/usi/dag/disl/guard/ArgumentContextImpl.java
+23
-23
src-disl/ch/usi/dag/disl/guard/GuardContextImpl.java
src-disl/ch/usi/dag/disl/guard/GuardContextImpl.java
+22
-22
src-disl/ch/usi/dag/disl/guard/GuardHelper.java
src-disl/ch/usi/dag/disl/guard/GuardHelper.java
+242
-242
src-disl/ch/usi/dag/disl/guardcontext/GuardContext.java
src-disl/ch/usi/dag/disl/guardcontext/GuardContext.java
+8
-8
src-disl/ch/usi/dag/disl/localvar/AbstractLocalVar.java
src-disl/ch/usi/dag/disl/localvar/AbstractLocalVar.java
+58
-58
src-disl/ch/usi/dag/disl/localvar/LocalVars.java
src-disl/ch/usi/dag/disl/localvar/LocalVars.java
+46
-20
src-disl/ch/usi/dag/disl/localvar/SyntheticLocalVar.java
src-disl/ch/usi/dag/disl/localvar/SyntheticLocalVar.java
+23
-23
src-disl/ch/usi/dag/disl/localvar/ThreadLocalVar.java
src-disl/ch/usi/dag/disl/localvar/ThreadLocalVar.java
+25
-25
src-disl/ch/usi/dag/disl/marker/AbstractDWRMarker.java
src-disl/ch/usi/dag/disl/marker/AbstractDWRMarker.java
+2
-4
src-disl/ch/usi/dag/disl/marker/AbstractInsnMarker.java
src-disl/ch/usi/dag/disl/marker/AbstractInsnMarker.java
+15
-13
src-disl/ch/usi/dag/disl/marker/AbstractMarker.java
src-disl/ch/usi/dag/disl/marker/AbstractMarker.java
+83
-65
src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java
src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java
+13
-14
src-disl/ch/usi/dag/disl/marker/BasicBlockMarker.java
src-disl/ch/usi/dag/disl/marker/BasicBlockMarker.java
+16
-15
src-disl/ch/usi/dag/disl/marker/BodyMarker.java
src-disl/ch/usi/dag/disl/marker/BodyMarker.java
+15
-17
src-disl/ch/usi/dag/disl/marker/BytecodeMarker.java
src-disl/ch/usi/dag/disl/marker/BytecodeMarker.java
+28
-28
src-disl/ch/usi/dag/disl/marker/EmptyMarker.java
src-disl/ch/usi/dag/disl/marker/EmptyMarker.java
+18
-19
src-disl/ch/usi/dag/disl/processorcontext/ArgumentContext.java
...isl/ch/usi/dag/disl/processorcontext/ArgumentContext.java
+5
-3
src-disl/ch/usi/dag/disl/processorcontext/ArgumentProcessorContext.java
...i/dag/disl/processorcontext/ArgumentProcessorContext.java
+19
-20
src-disl/ch/usi/dag/disl/resolver/GuardMethod.java
src-disl/ch/usi/dag/disl/resolver/GuardMethod.java
+17
-17
src-disl/ch/usi/dag/disl/resolver/GuardResolver.java
src-disl/ch/usi/dag/disl/resolver/GuardResolver.java
+58
-58
src-disl/ch/usi/dag/disl/resolver/SCResolver.java
src-disl/ch/usi/dag/disl/resolver/SCResolver.java
+38
-38
src-disl/ch/usi/dag/disl/scope/Scope.java
src-disl/ch/usi/dag/disl/scope/Scope.java
+13
-6
src-disl/ch/usi/dag/disl/scope/ScopeImpl.java
src-disl/ch/usi/dag/disl/scope/ScopeImpl.java
+203
-292
src-disl/ch/usi/dag/disl/scope/WildCard.java
src-disl/ch/usi/dag/disl/scope/WildCard.java
+36
-42
src-disl/ch/usi/dag/disl/snippet/ProcInvocation.java
src-disl/ch/usi/dag/disl/snippet/ProcInvocation.java
+14
-14
src-disl/ch/usi/dag/disl/snippet/Shadow.java
src-disl/ch/usi/dag/disl/snippet/Shadow.java
+144
-145
src-disl/ch/usi/dag/disl/snippet/Snippet.java
src-disl/ch/usi/dag/disl/snippet/Snippet.java
+103
-103
src-disl/ch/usi/dag/disl/snippet/SnippetCode.java
src-disl/ch/usi/dag/disl/snippet/SnippetCode.java
+42
-42
src-disl/ch/usi/dag/disl/staticcontext/AbstractStaticContext.java
.../ch/usi/dag/disl/staticcontext/AbstractStaticContext.java
+9
-6
src-disl/ch/usi/dag/disl/staticcontext/BasicBlockStaticContext.java
...h/usi/dag/disl/staticcontext/BasicBlockStaticContext.java
+15
-20
src-disl/ch/usi/dag/disl/staticcontext/StaticContext.java
src-disl/ch/usi/dag/disl/staticcontext/StaticContext.java
+6
-8
src-disl/ch/usi/dag/disl/staticcontext/generator/SCGenerator.java
.../ch/usi/dag/disl/staticcontext/generator/SCGenerator.java
+161
-161
src-disl/ch/usi/dag/disl/transformer/Transformer.java
src-disl/ch/usi/dag/disl/transformer/Transformer.java
+13
-11
src-disl/ch/usi/dag/disl/util/AsmHelper.java
src-disl/ch/usi/dag/disl/util/AsmHelper.java
+10
-7
src-disl/ch/usi/dag/disl/util/ReflectionHelper.java
src-disl/ch/usi/dag/disl/util/ReflectionHelper.java
+132
-48
src-disl/ch/usi/dag/disl/util/cfg/CtrlFlowGraph.java
src-disl/ch/usi/dag/disl/util/cfg/CtrlFlowGraph.java
+6
-9
src-disl/ch/usi/dag/disl/utilinstr/codemerger/CodeMerger.java
...disl/ch/usi/dag/disl/utilinstr/codemerger/CodeMerger.java
+4
-5
src-disl/ch/usi/dag/disl/weaver/pe/InvocationInterpreter.java
...disl/ch/usi/dag/disl/weaver/pe/InvocationInterpreter.java
+17
-15
src-disl/ch/usi/dag/disl/weaver/pe/PartialEvaluator.java
src-disl/ch/usi/dag/disl/weaver/pe/PartialEvaluator.java
+2
-2
No files found.
src-disl/ch/usi/dag/disl/annotation/After.java
View file @
9add01a7
package
ch.usi.dag.disl.annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Target
;
import
ch.usi.dag.disl.classcontext.ClassContext
;
import
ch.usi.dag.disl.dynamiccontext.DynamicContext
;
import
ch.usi.dag.disl.marker.Marker
;
import
ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
;
import
ch.usi.dag.disl.staticcontext.StaticContext
;
/**
* Marks a method as a DiSL snippet to be inserted after the marked code region.
* The snippet code will be executed both after normal and exceptional exit from
* the marked code region.
* <p>
* The After annotation instructs DiSL to insert the snippet body after the
* marked region. The snippet will be invoked after a normal exit of the region
* or after an exit caused by an exception.
*
* <b>Note:</b> This is a general contract. The actual implementation depends on
* the particular marker used with the snippet.
* <p>
* <b>note:</b> This is only general contract. It depends on particular marker
* how the contract will be implemented.
*
* The annotation has the following parameters which control the inlining of a
* snippet into target code:
* <ul>
* <li>{@link #marker}
* <li>{@link #args}
* <li>{@link #guard}
* <li>{@link #scope}
* <li>{@link #order}
* <li>{@link #dynamicBypass}
* </ul>
* <p>
* <b>usage:</b>
*
* This annotation can be only used with methods. In particular, a method
* representing a snippet must be {@code static}, must not return any value, and
* must not throw any exceptions.
* <p>
* There are multiple optional parameters the annotation takes. Browse them for
* more details on usage.
* The method can declare parameters the following types:
* <ul>
* <li>{@link #marker}</li>
* <li>{@link #args}</li>
* <li>{@link #guard}</li>
* <li>{@link #scope}</li>
* <li>{@link #order}</li>
* <li>{@link #dynamicBypass}</li>
* <li>{@link StaticContext} (or another type implementing it),
* <li>{@link DynamicContext},
* <li>{@link ClassContext}, and
* <li>{@link ArgumentProcessorContext}.
* </ul>
*
* <p>
* This annotation should be used only with static methods that does not return
* any value or throw any exception.
*
* <p>
* The method might be specified with arguments of following types.
* {@link ch.usi.dag.disl.staticcontext.StaticContext StaticContext (or
* derived)}, {@link ch.usi.dag.disl.dynamiccontext.DynamicContext
* DynamicContext}, {@link ch.usi.dag.disl.classcontext.ClassContext
* ClassContext} and
* {@link ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
* ArgumentProcessContext}. There's no restriction on order or number of these
* arguments.
* The ordering and the number of the parameters is arbitrary.
*/
@Documented
@Target
(
ElementType
.
METHOD
)
public
@interface
After
{
// NOTE if you want to change names, you need to change
// SnippetParser.SnippetAnnotationData class
// NOTE because of implementation of annotations in java the defaults
// are not retrieved from here but from class mentioned above
//
// NOTE
//
// If you change any names here, you also need to change them
// in the DiSL class parser. Only do that if absolutely necessary,
// because this annotation is part of the DiSL public API.
//
// Also note that the defaults are not retrieved from here, but
// are set in the DiSL class parser.
//
/**
*
<p>
*
Marker class defines a region where the snippet is applied
.
*
*
Selects the marker class. A marker determines the region of code within a
*
method where to apply the snippet
.
*
* @see ch.usi.dag.disl.marker.Marker Implementation details
*/
Class
<?
extends
Marker
>
marker
();
Class
<?
extends
Marker
>
marker
();
/**
* Optional argument for the marker class, passed as a {@link String}.
* <p>
* Argument for the marker (as string).
*
* <p>
* Default value means none.
* Default value: {@code ""}, means "no arguments".
*/
String
args
()
default
""
;
// cannot be null :(
String
args
()
default
""
;
/**
* Selects methods in which to apply the snippet.
* <p>
* S
cope of the methods, where the snippet is applied.
*
* S
ee the {@link ch.usi.dag.disl.scope} package for more information about
*
the scoping language.
* <p>
* Default value means everything.
*
* @see ch.usi.dag.disl.scope.ScopeImpl Implementation details
* Default value: {@code "*"}, means "everywhere".
*/
String
scope
()
default
"*"
;
/**
* Selects the guard class. A guard class determines whether a snippet
* will be inlined at a particular location or not. In general, guards
* provide more fine-grained control compared to scopes.
* <p>
* The guard class defining if the snippet will be inlined in particular
* region or not.
*
* <p>
* Default value means none.
* Default value: {@code void.class}, means "no guard used".
*/
Class
<?
extends
Object
>
guard
()
default
Object
.
class
;
// cannot be null :(
Class
<?
extends
Object
>
guard
()
default
void
.
class
;
/**
* Determines snippet order when multiple snippets are to be inlined
* at the same location. The smaller the number, the closer to the boundary
* of the marked code region will be the snippet inlined.
* <p>
* Defines ordering of the snippets. Smaller number indicates that snippet
* will be inlined closer to the instrumented code.
*
* <p>
* Default is 100.
* Default value: {@code 100}
*/
int
order
()
default
100
;
/**
* Controls automatic bypass activation. This is an advanced option that
* allows to turn off automatic bypass activation for inlined snippets. This
* can be used when a snippet does not use any other (instrumented) classes,
* or when manual control over bypass activation is desired.
* <p>
* You can in general disable dynamic bypass on snippets, that are not using
* any other class. (Advanced option)
*
* <p>
* <b>note:</b> Usage of dynamic bypass is determined by the underlying
* NOTE: Usage of dynamic bypass is determined by the underlying
* instrumentation framework.
* <p>
* Default value: {@code true}, means "automatic bypass activation".
*/
boolean
dynamicBypass
()
default
true
;
}
src-disl/ch/usi/dag/disl/annotation/AfterReturning.java
View file @
9add01a7
package
ch.usi.dag.disl.annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Target
;
import
ch.usi.dag.disl.classcontext.ClassContext
;
import
ch.usi.dag.disl.dynamiccontext.DynamicContext
;
import
ch.usi.dag.disl.marker.Marker
;
import
ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
;
import
ch.usi.dag.disl.staticcontext.StaticContext
;
/**
* <p>
* The AfterReturning annotation instructs DiSL to insert the snippet body after
* the marked region. The snippet will be invoked after a normal exit of the
* Marks a method as a DiSL snippet to be inserted after the marked code region.
* The snippet code will be executed after a normal exit from the marked code
* region.
*
* <p>
* <b>note:</b> This is only general contract. It depends on particular marker
* how the contract will be implemented.
*
* <b>Note:</b> This is a general contract. The actual implementation depends on
* the particular marker used with the snippet.
* <p>
* <b>usage:</b>
*
* <p>
* There are multiple optional parameters the annotation takes. Browse them for
* more details on usage.
* The annotation has the following parameters which control the inlining of a
* snippet into target code:
* <ul>
* <li>{@link #marker}
</li>
* <li>{@link #args}
</li>
* <li>{@link #guard}
</li>
* <li>{@link #scope}
</li>
* <li>{@link #order}
</li>
* <li>{@link #dynamicBypass}
</li>
* <li>{@link #marker}
* <li>{@link #args}
* <li>{@link #guard}
* <li>{@link #scope}
* <li>{@link #order}
* <li>{@link #dynamicBypass}
* </ul>
*
* <p>
* This annotation
should be used only with static methods that does not return
*
any value or throw any exception.
*
* This annotation
can be only used with methods. In particular, a method
*
representing a snippet must be {@code static}, must not return any value, and
*
must not throw any exceptions.
* <p>
* The method might be specified with arguments of following types.
* {@link ch.usi.dag.disl.staticcontext.StaticContext StaticContext (or
* derived)}, {@link ch.usi.dag.disl.dynamiccontext.DynamicContext
* DynamicContext}, {@link ch.usi.dag.disl.classcontext.ClassContext
* ClassContext} and
* {@link ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
* ArgumentProcessContext}. There's no restriction on order or number of these
* arguments.
* The method can declare parameters the following types:
* <ul>
* <li>{@link StaticContext} (or another type implementing it),
* <li>{@link DynamicContext},
* <li>{@link ClassContext}, and
* <li>{@link ArgumentProcessorContext}.
* </ul>
* <p>
* The ordering and the number of the parameters is arbitrary.
*/
@Documented
@Target
(
ElementType
.
METHOD
)
public
@interface
AfterReturning
{
// NOTE if you want to change names, you need to change
// SnippetParser.SnippetAnnotationData class
// NOTE because of implementation of annotations in java the defaults
// are not retrieved from here but from class mentioned above
//
// NOTE
//
// If you change any names here, you also need to change them
// in the DiSL class parser. Only do that if absolutely necessary,
// because this annotation is part of the DiSL public API.
//
// Also note that the defaults are not retrieved from here, but
// are set in the DiSL class parser.
//
/**
*
<p>
*
Marker class defines a region where the snippet is applied
.
*
*
Selects the marker class. A marker determines the region of code within a
*
method where to apply the snippet
.
*
* @see ch.usi.dag.disl.marker.Marker Implementation details
*/
Class
<?
extends
Marker
>
marker
();
Class
<?
extends
Marker
>
marker
();
/**
* Optional argument for the marker class, passed as a {@link String}.
* <p>
* Argument for the marker (as string).
*
* <p>
* Default value means none.
* Default value: {@code ""}, means "no arguments".
*/
String
args
()
default
""
;
// cannot be null :(
String
args
()
default
""
;
/**
* Selects methods in which to apply the snippet.
* <p>
* S
cope of the methods where the snippet is applied.
*
* S
ee the {@link ch.usi.dag.disl.scope} package for more information about
*
the scoping language.
* <p>
* Default value means everything.
*
* @see ch.usi.dag.disl.scope.ScopeImpl Implementation details
* Default value: {@code "*"}, means "everywhere".
*/
String
scope
()
default
"*"
;
/**
* Selects the guard class. A guard class determines whether a snippet
* will be inlined at a particular location or not. In general, guards
* provide more fine-grained control compared to scopes.
* <p>
* The guard class defining if the snippet will be inlined in particular
* region or not.
*
* <p>
* Default value means none.
* Default value: {@code void.class}, means "no guard used".
*/
Class
<?
extends
Object
>
guard
()
default
Object
.
class
;
// cannot be null :(
Class
<?
extends
Object
>
guard
()
default
void
.
class
;
/**
* Determines snippet order when multiple snippets are to be inlined
* at the same location. The smaller the number, the closer to the boundary
* of the marked code region will be the snippet inlined.
* <p>
* Defines ordering of the snippets. Smaller number indicates that snippet
* will be inlined closer to the instrumented code.
*
* <p>
* Default is 100.
* Default value: {@code 100}
*/
int
order
()
default
100
;
/**
* Controls automatic bypass activation. This is an advanced option that
* allows to turn off automatic bypass activation for inlined snippets. This
* can be used when a snippet does not use any other (instrumented) classes,
* or when manual control over bypass activation is desired.
* <p>
* You can in general disable dynamic bypass on snippets that are not using
* any other class. (Advanced option)
*
* <p>
* <b>note:</b> Usage of dynamic bypass is determined by the underlying
* NOTE: Usage of dynamic bypass is determined by the underlying
* instrumentation framework.
* <p>
* Default value: {@code true}, means "automatic bypass activation".
*/
boolean
dynamicBypass
()
default
true
;
}
src-disl/ch/usi/dag/disl/annotation/AfterThrowing.java
View file @
9add01a7
package
ch.usi.dag.disl.annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Target
;
import
ch.usi.dag.disl.classcontext.ClassContext
;
import
ch.usi.dag.disl.dynamiccontext.DynamicContext
;
import
ch.usi.dag.disl.marker.Marker
;
import
ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
;
import
ch.usi.dag.disl.staticcontext.StaticContext
;
/**
* Marks a method as a DiSL snippet to be inserted after the marked code region.
* The snippet code will be executed after an exit cause by an exception.
* <p>
* The AfterThrowing annotation instructs DiSL to insert the snippet body after
* the marked region. The snippet will be invoked after an exit caused by an
* exception.
*
* <b>Note:</b> This is a general contract. The actual implementation depends on
* the particular marker used with the snippet.
* <p>
* <b>note:</b> This is only general contract. It depends on particular marker
* how the contract will be implemented.
*
* The annotation has the following parameters which control the inlining of a
* snippet into target code:
* <ul>
* <li>{@link #marker}
* <li>{@link #args}
* <li>{@link #guard}
* <li>{@link #scope}
* <li>{@link #order}
* <li>{@link #dynamicBypass}
* </ul>
* <p>
* <b>usage:</b>
*
* This annotation can be only used with methods. In particular, a method
* representing a snippet must be {@code static}, must not return any value, and
* must not throw any exceptions.
* <p>
* There are multiple optional parameters the annotation takes. Browse them for
* more details on usage.
* The method can declare parameters the following types:
* <ul>
* <li>{@link #marker}</li>
* <li>{@link #args}</li>
* <li>{@link #guard}</li>
* <li>{@link #scope}</li>
* <li>{@link #order}</li>
* <li>{@link #dynamicBypass}</li>
* <li>{@link StaticContext} (or another type implementing it),
* <li>{@link DynamicContext},
* <li>{@link ClassContext}, and
* <li>{@link ArgumentProcessorContext}.
* </ul>
*
* <p>
* This annotation should be used only with static methods that does not return
* any value or throw any exception.
*
* <p>
* The method might be specified with arguments of following types.
* {@link ch.usi.dag.disl.staticcontext.StaticContext StaticContext (or
* derived)}, {@link ch.usi.dag.disl.dynamiccontext.DynamicContext
* DynamicContext}, {@link ch.usi.dag.disl.classcontext.ClassContext
* ClassContext} and
* {@link ch.usi.dag.disl.processorcontext.ArgumentProcessorContext
* ArgumentProcessContext}. There's no restriction on order or number of these
* arguments.
* The ordering and the number of the parameters is arbitrary.
*/
@Documented
@Target
(
ElementType
.
METHOD
)
public
@interface
AfterThrowing
{
// NOTE if you want to change names, you need to change
// SnippetParser.SnippetAnnotationData class
// NOTE because of implementation of annotations in java the defaults
// are not retrieved from here but from class mentioned above
//
// NOTE
//
// If you change any names here, you also need to change them
// in the DiSL class parser. Only do that if absolutely necessary,
// because this annotation is part of the DiSL public API.
//
// Also note that the defaults are not retrieved from here, but
// are set in the DiSL class parser.
//
/**
*
<p>
*
Marker class defines a region where the snippet is applied
.
*
*
Selects the marker class. A marker determines the region of code within a
*
method where to apply the snippet
.
*
* @see ch.usi.dag.disl.marker.Marker Implementation details
*/
Class
<?
extends
Marker
>
marker
();
Class
<?
extends
Marker
>
marker
();
/**
* Optional argument for the marker class, passed as a {@link String}.
* <p>
* Argument for the marker (as string).
*
* <p>
* Default value means none.
* Default value: {@code ""}, means "no arguments".
*/
String
args
()
default
""
;
// cannot be null :(
String
args
()
default
""
;
/**
* Selects methods in which to apply the snippet.
* <p>
* S
cope of the methods, where the snippet is applied.
*
* S
ee the {@link ch.usi.dag.disl.scope} package for more information about
*
the scoping language.
* <p>
* Default value means everything.
*
* @see ch.usi.dag.disl.scope.ScopeImpl Implementation details
* Default value: {@code "*"}, means "everywhere".
*/
String
scope
()
default
"*"
;
/**
* Selects the guard class. A guard class determines whether a snippet
* will be inlined at a particular location or not. In general, guards
* provide more fine-grained control compared to scopes.
* <p>
* The guard class defining if the snippet will be inlined in particular
* region or not.
*
* <p>
* Default value means none.
* Default value: {@code void.class}, means "no guard used".
*/
Class
<?
extends
Object
>
guard
()
default
Object
.
class
;
// cannot be null :(
Class
<?
extends
Object
>
guard
()
default
void
.
class
;
/**
* Determines snippet order when multiple snippets are to be inlined
* at the same location. The smaller the number, the closer to the boundary
* of the marked code region will be the snippet inlined.
* <p>
* Defines ordering of the snippets. Smaller number indicates that snippet
* will be inlined closer to the instrumented code.
*
* <p>
* Default is 100.
* Default value: {@code 100}
*/
int
order
()
default
100
;
/**
* Controls automatic bypass activation. This is an advanced option that
* allows to turn off automatic bypass activation for inlined snippets. This
* can be used when a snippet does not use any other (instrumented) classes,
* or when manual control over bypass activation is desired.
* <p>
* You can in general disable dynamic bypass on snippets, that are not using
* any other class. (Advanced option)
*
* <p>
* <b>note:</b> Usage of dynamic bypass is determined by the underlying
* NOTE: Usage of dynamic bypass is determined by the underlying
* instrumentation framework.
* <p>
* Default value: {@code true}, means "automatic bypass activation".
*/
boolean
dynamicBypass
()
default
true
;
}
src-disl/ch/usi/dag/disl/annotation/ArgumentProcessor.java
View file @
9add01a7
package
ch.usi.dag.disl.annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Target
;
import
ch.usi.dag.disl.classcontext.ClassContext
;
import
ch.usi.dag.disl.dynamiccontext.DynamicContext
;
import
ch.usi.dag.disl.processorcontext.ArgumentContext
;
import
ch.usi.dag.disl.staticcontext.StaticContext
;
/**
* Annotated class defines method for processing method arguments. The specified
* methods will be inlined into snippets to process one method argument value.
* <br>
* <br>
* First argument of the method is a type, that will be processed by the method.
* The allowed types are all basic types, String and Object class. The processed
* type can be extend in some special cases by ProcessAlso annotation.
* During run-time, the argument will contain a processed method argument value.
* ArgumentContext can be used to fetch additional data about the argument.
* <br>
* <br>
* This annotation should be used with classes.
* <br>
* The method should be static, not return any values and not throw any
* exceptions.
* <br>
* Method argument can be StaticContext, DynamicContext, ClassContext and
* ArgumentContext.
* Indicates that the class contains methods for processing method arguments
* with corresponding types. Methods corresponding to argument types will be
* invoked with the type and value of the argument. The invocations of the
* argument processor methods will be inlined into each snippet that uses the
* argument processor.
* <p>
* An argument processor <b>method</b> has the argument type as its first
* parameter. Only primitive, {@link String}, and {@link Object} types are
* allowed. In some cases, the type accepted by the argument processor method
* can be extended using the {@link ProcessAlso} annotation. At runtime, the
* second parameter of the argument processor will contain the value of the
* argument being processed.
* <p>
* Additional information (e.g. position) about the argument can be obtained
* using the {@link ArgumentContext} interface. To use it, an argument processor
* method must have a parameter of type {@link ArgumentContext}. Other allowed
* contexts are {@link StaticContext}, {@link DynamicContext}, and
* {@link ClassContext}.
* <p>
* All argument processor methods must be static, may not return any values, and
* may not throw any exceptions.
*/