Commit 0a66a224 authored by Yudi Zheng's avatar Yudi Zheng
Browse files

Access to uninitialized object in dynamic context and processor context will cause verify error.

parent 3b279c4a
......@@ -259,7 +259,7 @@ public class Weaver {
}
WeavingCode wCode = new WeavingCode(info, methodNode, code,
loc, snippet, shadow, index);
snippet, shadow, index);
wCode.transform(staticInfoHolder, piResolver);
methodNode.instructions.insertBefore(loc, wCode.getiList());
......@@ -298,7 +298,7 @@ public class Weaver {
}
WeavingCode wCode = new WeavingCode(info, methodNode,
code, loc.getNext(), snippet, region, index);
code, snippet, region, index);
wCode.transform(staticInfoHolder, piResolver);
methodNode.instructions.insert(loc, wCode.getiList());
......@@ -334,8 +334,7 @@ public class Weaver {
}
WeavingCode wCode = new WeavingCode(info, methodNode, code,
region.getRegionStart(), snippet, region,
last_index);
snippet, region, last_index);
wCode.transform(staticInfoHolder, piResolver);
// Create a try-catch clause
......
......@@ -44,7 +44,6 @@ public class WeavingCode {
private WeavingInfo info;
private MethodNode method;
private SnippetCode code;
private AbstractInsnNode weavingLocation;
private InsnList iList;
private AbstractInsnNode[] iArray;
private Snippet snippet;
......@@ -53,13 +52,11 @@ public class WeavingCode {
private int maxLocals;
public WeavingCode(WeavingInfo weavingInfo, MethodNode method,
SnippetCode src, AbstractInsnNode loc, Snippet snippet,
Shadow shadow, int index) {
SnippetCode src, Snippet snippet, Shadow shadow, int index) {
this.info = weavingInfo;
this.method = method;
this.code = src.clone();
this.weavingLocation = loc;
this.snippet = snippet;
this.shadow = shadow;
this.index = index;
......@@ -199,11 +196,6 @@ public class WeavingCode {
if ((method.access & Opcodes.ACC_STATIC) != 0) {
iList.insert(instr, new InsnNode(Opcodes.ACONST_NULL));
} else if (method.name.equals("<init>")
&& AsmHelper.before(weavingLocation,
AsmHelper.findFirstValidMark(method))) {
// TODO warn user that fetching object before initialization will violate the verifying
iList.insert(instr, new InsnNode(Opcodes.ACONST_NULL));
} else {
iList.insert(instr, new VarInsnNode(Opcodes.ALOAD,
-method.maxLocals));
......@@ -640,11 +632,6 @@ public class WeavingCode {
if ((method.access & Opcodes.ACC_STATIC) != 0) {
iList.insert(instr, new InsnNode(Opcodes.ACONST_NULL));
} else if (method.name.equals("<init>")
&& AsmHelper.before(weavingLocation,
AsmHelper.findFirstValidMark(method))) {
// TODO warn user that fetching object before initialization will violate the verifying
iList.insert(instr, new InsnNode(Opcodes.ACONST_NULL));
} else {
iList.insert(instr, new VarInsnNode(Opcodes.ALOAD,
-method.maxLocals));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment