Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
DiSL
DiSL
Commits
2f0ef17f
Commit
2f0ef17f
authored
Jul 19, 2011
by
Lukáš Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DiSL ported to asm 4.0
parent
23061bdd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
43 deletions
+35
-43
.classpath
.classpath
+10
-11
src/ch/usi/dag/disl/DiSL.java
src/ch/usi/dag/disl/DiSL.java
+1
-4
src/ch/usi/dag/disl/snippet/parser/SnippetParser.java
src/ch/usi/dag/disl/snippet/parser/SnippetParser.java
+7
-17
src/ch/usi/dag/disl/staticinfo/StaticInfo.java
src/ch/usi/dag/disl/staticinfo/StaticInfo.java
+2
-0
src/ch/usi/dag/disl/util/InsnListHelper.java
src/ch/usi/dag/disl/util/InsnListHelper.java
+14
-10
test/.classpath
test/.classpath
+1
-1
No files found.
.classpath
View file @
2f0ef17f
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"
/>
<classpathentry
kind=
"lib"
path=
"lib/asm-all-3.3.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat-agent.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat-runtime.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/asm-debug-all-4.0_RC1.jar"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat-agent.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat-runtime.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/jborat.jar"
/>
<classpathentry
kind=
"lib"
path=
"lib/asm-debug-all-4.0_RC1.jar"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
src/ch/usi/dag/disl/DiSL.java
View file @
2f0ef17f
...
...
@@ -180,10 +180,7 @@ public class DiSL implements Instrumentation {
staticAnalysisInstances
=
new
HashMap
<
Class
<?>,
Object
>();
// instrument all methods in a class
for
(
Object
methodObj
:
classNode
.
methods
)
{
// cast - ASM still uses Java 1.4 interface
MethodNode
methodNode
=
(
MethodNode
)
methodObj
;
for
(
MethodNode
methodNode
:
classNode
.
methods
)
{
instrumentMethod
(
classNode
,
methodNode
);
}
...
...
src/ch/usi/dag/disl/snippet/parser/SnippetParser.java
View file @
2f0ef17f
...
...
@@ -80,10 +80,7 @@ public class SnippetParser {
// get static initialization code
InsnList
origInitCodeIL
=
null
;
for
(
Object
methodObj
:
classNode
.
methods
)
{
// cast - ASM still uses Java 1.4 interface
MethodNode
method
=
(
MethodNode
)
methodObj
;
for
(
MethodNode
method
:
classNode
.
methods
)
{
// get the code
if
(
method
.
name
.
equals
(
Constants
.
STATIC_INIT_NAME
))
{
...
...
@@ -102,10 +99,7 @@ public class SnippetParser {
// add local vars from this class to others
syntheticLocalVars
.
putAll
(
slVars
);
for
(
Object
methodObj
:
classNode
.
methods
)
{
// cast - ASM still uses Java 1.4 interface
MethodNode
method
=
(
MethodNode
)
methodObj
;
for
(
MethodNode
method
:
classNode
.
methods
)
{
// skip the constructor
if
(
method
.
name
.
equals
(
Constants
.
CONSTRUCTOR_NAME
))
{
...
...
@@ -129,15 +123,13 @@ public class SnippetParser {
}
private
Map
<
String
,
SyntheticLocalVar
>
parseSyntheticLocalVars
(
String
className
,
List
<?>
fields
)
throws
AnnotParserException
{
String
className
,
List
<
FieldNode
>
fields
)
throws
AnnotParserException
{
Map
<
String
,
SyntheticLocalVar
>
result
=
new
HashMap
<
String
,
SyntheticLocalVar
>();
for
(
Object
fieldObj
:
fields
)
{
// cast - ASM still uses Java 1.4 interface
FieldNode
field
=
(
FieldNode
)
fieldObj
;
for
(
FieldNode
field
:
fields
)
{
if
(
field
.
invisibleAnnotations
==
null
)
{
throw
new
AnnotParserException
(
"DiSL annotation for field "
...
...
@@ -235,11 +227,9 @@ public class SnippetParser {
// more annotations on one snippet
// supported but we will have multiple snippets ;)
for
(
Object
annotation
Obj
:
method
.
invisibleAnnotations
)
{
for
(
AnnotationNode
annotation
:
method
.
invisibleAnnotations
)
{
MethodAnnotationData
annotData
=
// cast - ASM still uses Java 1.4 interface
parseMethodAnnotation
((
AnnotationNode
)
annotationObj
);
MethodAnnotationData
annotData
=
parseMethodAnnotation
(
annotation
);
// if this is unknown annotation
if
(!
annotData
.
isKnown
())
{
...
...
src/ch/usi/dag/disl/staticinfo/StaticInfo.java
View file @
2f0ef17f
...
...
@@ -155,6 +155,8 @@ public class StaticInfo {
// and store for later use
staticAnalysisInstances
.
put
(
methodClass
,
saInst
);
}
// TODO ! analysis invoke setter method
// invoke static analysis method
Object
result
=
stAnMethod
.
invoke
(
saInst
,
saInfo
);
...
...
src/ch/usi/dag/disl/util/InsnListHelper.java
View file @
2f0ef17f
...
...
@@ -66,7 +66,7 @@ public class InsnListHelper {
public
static
InsnList
cloneList
(
InsnList
src
,
AbstractInsnNode
from
,
AbstractInsnNode
to
)
{
Map
<
AbstractInsnNode
,
AbstractInsnNode
>
map
=
new
HashMap
<
AbstractInsnNode
,
AbstractInsn
Node
>();
Map
<
LabelNode
,
LabelNode
>
map
=
new
HashMap
<
LabelNode
,
Label
Node
>();
InsnList
dst
=
new
InsnList
();
...
...
@@ -74,7 +74,7 @@ public class InsnListHelper {
for
(
AbstractInsnNode
instr
:
src
.
toArray
())
{
if
(
instr
instanceof
LabelNode
)
{
LabelNode
label
=
new
LabelNode
(
new
Label
());
map
.
put
(
instr
,
label
);
map
.
put
(
(
LabelNode
)
instr
,
label
);
}
}
...
...
@@ -203,21 +203,25 @@ public class InsnListHelper {
case
AbstractInsnNode
.
LOOKUPSWITCH_INSN
:
{
// Covers LOOKUPSWITCH
for
(
Object
label
:
((
LookupSwitchInsnNode
)
instruction
).
labels
)
{
bb_begins
.
add
((
AbstractInsnNode
)
label
);
LookupSwitchInsnNode
lsin
=
(
LookupSwitchInsnNode
)
instruction
;
for
(
LabelNode
label
:
lsin
.
labels
)
{
bb_begins
.
add
(
label
);
}
bb_begins
.
add
(
((
LookupSwitchInsnNode
)
instruction
)
.
dflt
);
bb_begins
.
add
(
lsin
.
dflt
);
break
;
}
case
AbstractInsnNode
.
TABLESWITCH_INSN
:
{
// Covers TABLESWITCH
for
(
Object
label
:
((
TableSwitchInsnNode
)
instruction
).
labels
)
{
bb_begins
.
add
((
AbstractInsnNode
)
label
);
TableSwitchInsnNode
tsin
=
(
TableSwitchInsnNode
)
instruction
;
for
(
LabelNode
label
:
tsin
.
labels
)
{
bb_begins
.
add
(
label
);
}
bb_begins
.
add
(
((
TableSwitchInsnNode
)
instruction
)
.
dflt
);
bb_begins
.
add
(
tsin
.
dflt
);
break
;
}
...
...
@@ -226,8 +230,8 @@ public class InsnListHelper {
}
}
for
(
Object
try_catch_block
:
method
.
tryCatchBlocks
)
{
bb_begins
.
add
(
((
TryCatchBlockNode
)
try_catch_block
)
.
handler
);
for
(
TryCatchBlockNode
try_catch_block
:
method
.
tryCatchBlocks
)
{
bb_begins
.
add
(
try_catch_block
.
handler
);
}
// Sort
...
...
test/.classpath
View file @
2f0ef17f
...
...
@@ -4,6 +4,6 @@
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER"
/>
<classpathentry
combineaccessrules=
"false"
kind=
"src"
path=
"/DiSL"
/>
<classpathentry
kind=
"lib"
path=
"/DiSL/lib/jborat.jar"
/>
<classpathentry
kind=
"lib"
path=
"/DiSL/lib/asm-
all-3.3
.jar"
/>
<classpathentry
kind=
"lib"
path=
"/DiSL/lib/asm-
debug-all-4.0_RC1
.jar"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment