...
{
static int a;
descriptor: I
flags: ACC_STATIC
public com.fonxian.entity.LockDemo();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 6: 0
//同步方法
public synchronized void writer();
descriptor: ()V
flags: ACC_PUBLIC, ACC_SYNCHRONIZED
Code:
stack=2, locals=1, args_size=1
0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #3 // String writer方法开始调用
5: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: getstatic #5 // Field a:I
11: iconst_1
12: iadd
13: putstatic #5 // Field a:I
16: bipush 20
18: invokestatic #6 // Method waitNs:(I)V
21: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
24: ldc #7 // String writer方法调用结束
26: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
29: return
LineNumberTable:
line 11: 0
line 12: 8
line 13: 16
line 14: 21
line 15: 29
//静态同步方法
public static synchronized void reader();
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC, ACC_SYNCHRONIZED
Code:
stack=2, locals=1, args_size=0
0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #8 // String reader方法开始调用
5: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: getstatic #5 // Field a:I
11: istore_0
12: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
15: ldc #9 // String reader方法调用结束
17: invokevirtual #4 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
20: return
LineNumberTable:
line 18: 0
line 19: 8
line 20: 12
line 21: 20
//同步代码块
public void writer2();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=2, locals=3, args_size=1
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: getstatic #5 // Field a:I
7: iconst_1
8: isub
9: putstatic #5 // Field a:I
12: aload_1
13: monitorexit
14: goto 22
17: astore_2
18: aload_1
19: monitorexit
20: aload_2
21: athrow
22: return
Exception table:
from to target type
4 14 17 any
17 20 17 any
LineNumberTable:
line 25: 0
line 26: 4
line 27: 12
line 28: 22
StackMapTable: number_of_entries = 2
frame_type = 255 /* full_frame */
offset_delta = 17
locals = [ class com/fonxian/entity/LockDemo, class java/lang/Object ]
stack = [ class java/lang/Throwable ]
frame_type = 250 /* chop */
offset_delta = 4
static {};
descriptor: ()V
flags: ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: iconst_0
1: putstatic #5 // Field a:I
4: return
LineNumberTable:
line 8: 0
}
SourceFile: "LockDemo.java"