01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.bytecode;
05:
06: import com.tc.asm.ClassAdapter;
07: import com.tc.asm.ClassVisitor;
08: import com.tc.asm.Label;
09: import com.tc.asm.MethodVisitor;
10: import com.tc.asm.Opcodes;
11:
12: public class JavaUtilConcurrentLinkedBlockingQueueNodeClassAdapter
13: extends ClassAdapter implements Opcodes {
14:
15: public JavaUtilConcurrentLinkedBlockingQueueNodeClassAdapter(
16: ClassVisitor cv) {
17: super (cv);
18: }
19:
20: public void visitEnd() {
21: addGetItemMethod();
22: super .visitEnd();
23: }
24:
25: private void addGetItemMethod() {
26: MethodVisitor mv = cv.visitMethod(0, "getItem",
27: "()Ljava/lang/Object;", "()TE;", null);
28: mv.visitCode();
29: Label l0 = new Label();
30: mv.visitLabel(l0);
31: mv.visitLineNumber(64, l0);
32: mv.visitVarInsn(ALOAD, 0);
33: mv.visitFieldInsn(GETFIELD,
34: "java/util/concurrent/LinkedBlockingQueue$Node",
35: "item", "Ljava/lang/Object;");
36: mv.visitTypeInsn(INSTANCEOF, "com/tc/object/ObjectID");
37: Label l1 = new Label();
38: mv.visitJumpInsn(IFEQ, l1);
39: Label l2 = new Label();
40: mv.visitLabel(l2);
41: mv.visitLineNumber(65, l2);
42: mv.visitVarInsn(ALOAD, 0);
43: mv.visitVarInsn(ALOAD, 0);
44: mv.visitFieldInsn(GETFIELD,
45: "java/util/concurrent/LinkedBlockingQueue$Node",
46: "item", "Ljava/lang/Object;");
47: mv.visitTypeInsn(CHECKCAST, "com/tc/object/ObjectID");
48: mv.visitMethodInsn(INVOKESTATIC,
49: "com/tc/object/bytecode/ManagerUtil", "lookupObject",
50: "(Lcom/tc/object/ObjectID;)Ljava/lang/Object;");
51: mv.visitFieldInsn(PUTFIELD,
52: "java/util/concurrent/LinkedBlockingQueue$Node",
53: "item", "Ljava/lang/Object;");
54: mv.visitLabel(l1);
55: mv.visitLineNumber(67, l1);
56: mv.visitVarInsn(ALOAD, 0);
57: mv.visitFieldInsn(GETFIELD,
58: "java/util/concurrent/LinkedBlockingQueue$Node",
59: "item", "Ljava/lang/Object;");
60: mv.visitInsn(ARETURN);
61: Label l3 = new Label();
62: mv.visitLabel(l3);
63: mv
64: .visitLocalVariable(
65: "this",
66: "Ljava/util/concurrent/LinkedBlockingQueue$Node;",
67: "Ljava/util/concurrent/LinkedBlockingQueue<TE;>.Node<TE;>;",
68: l0, l3, 0);
69: mv.visitMaxs(2, 1);
70: mv.visitEnd();
71: }
72: }
|