Java Magazine, Sept/Oct 2017
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2017 44 java 9 8 invokespecial 4 Method java util HashMap init V 11 astore_ 3 12 aload_ 3 13 ldc 5 String now 15 ldc 6 String bar 17 invokevirtual 7 Method java util HashMap put Ljava lang Object Ljava lang Object Ljava lang Object 20 pop 21 aload_ 3 22 astore 4 24 aload 4 26 ldc 8 String foo 28 ldc 9 String baz 30 invokeinterface 10 3 InterfaceMethod java util Map put Ljava lang Object Ljava lang Object Ljava lang Object 35 pop Indented lines are continued from the previous line Ed Java programmers who are new to looking at code at the JVM level might be surprised to learn that Java method calls are actually turned into one of several possible bytecodes of the form invoke Lets take a closer look at the first part of the decompiled code 0 invokestatic 2 Method java lang System currentTimeMillis J 3 lstore_ 1 The static call to System currentTimeMillis is turned into an invokestatic opcode that appears at position 0 in the bytecode This method takes no parameters so nothing needs to be loaded onto the evaluation stack before the call is dispatched
You must have JavaScript enabled to view digital editions.