Java仮想マシン(ジャバかそうマシン、英語: Java virtual machine、Java VM、JVM)は、Javaバイトコードとして定義された命令セットを実行するスタック型の仮想マシン。APIやいくつかのツールとセットでJava実行環境(JRE)としてリリースされている。この環境を移植することで、さまざまな環境でJavaのプログラムを実行することができる。
(12、C6 などの数値は16進法表記)
-0 | -1 | -2 | -3 | -4 | -5 | -6 | -7 | -8 | -9 | -A | -B | -C | -D | -E | -F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0- | 00 nop | 01 aconst_null | 02 iconst_m1 | 03 iconst_0 | 04 iconst_1 | 05 iconst_2 | 06 iconst_3 | 07 iconst_4 | 08 iconst_5 | 09 lconst_0 | 0A lconst_1 | 0B fconst_0 | 0C fconst_1 | 0D fconst_2 | 0E dconst_0 | 0F dconst_1 |
1- | 10 bipush | 11 sipush | 12 ldc | 13 ldc_w | 14 ldc2_w | 15 iload | 16 lload | 17 fload | 18 dload | 19 aload | 1A iload_0 | 1B iload_1 | 1C iload_2 | 1D iload_3 | 1E lload_0 | 1F lload_1 |
2- | 20 lload_2 | 21 lload_3 | 22 fload_0 | 23 fload_1 | 24 fload_2 | 25 fload_3 | 26 dload_0 | 27 dload_1 | 28 dload_2 | 29 dload_3 | 2A aload_0 | 2B aload_1 | 2C aload_2 | 2D aload_3 | 2E iaload | 2F laload |
3- | 30 faload | 31 daload | 32 aaload | 33 baload | 34 caload | 35 saload | 36 istore | 37 lstore | 38 fstore | 39 dstore | 3A astore | 3B istore_0 | 3C istore_1 | 3D istore_2 | 3E istore_3 | 3F lstore_0 |
4- | 40 lstore_1 | 41 lstore_2 | 42 lstore_3 | 43 fstore_0 | 44 fstore_1 | 45 fstore_2 | 46 fstore_3 | 47 dstore_0 | 48 dstore_1 | 49 dstore_2 | 4A dstore_3 | 4B astore_0 | 4C astore_1 | 4D astore_2 | 4E astore_3 | 4F iastore |
5- | 50 lastore | 51 fastore | 52 dastore | 53 aastore | 54 bastore | 55 castore | 56 sastore | 57 pop | 58 pop2 | 59 dup | 5A dup_x1 | 5B dup_x2 | 5C dup2 | 5D dup2_x1 | 5E dup2_x2 | 5F swap |
6- | 60 iadd | 61 ladd | 62 fadd | 63 dadd | 64 isub | 65 lsub | 66 fsub | 67 dsub | 68 imul | 69 lmul | 6A fmul | 6B dmul | 6C idiv | 6D ldiv | 6E fdiv | 6F ddiv |
7- | 70 irem | 71 lrem | 72 frem | 73 drem | 74 ineg | 75 lneg | 76 fneg | 77 dneg | 78 ishl | 79 lshl | 7A ishr | 7B lshr | 7C iushr | 7D lushr | 7E iand | 7F land |
8- | 80 ior | 81 lor | 82 ixor | 83 lxor | 84 iinc | 85 i2l | 86 i2f | 87 i2d | 88 l2i | 89 l2f | 8A l2d | 8B f2i | 8C f2l | 8D f2d | 8E d2i | 8F d2l |
9- | 90 d2f | 91 i2b | 92 i2c | 93 i2s | 94 lcmp | 95 fcmpl | 96 fcmpg | 97 dcmpl | 98 dcmpg | 99 ifeq | 9A ifne | 9B iflt | 9C ifge | 9D ifgt | 9E ifle | 9F if_icmpeq |
A- | A0 if_icmpne | A1 if_icmplt | A2 if_icmpge | A3 if_icmpgt | A4 if_icmple | A5 if_acmpeq | A6 if_acmpne | A7 goto | A8 jsr | A9 ret | AA tableswitch | AB lookupswitch | AC ireturn | AD lreturn | AE freturn | AF dreturn |
B- | B0 areturn | B1 return | B2 getstatic | B3 putstatic | B4 getfield | B5 putfield | B6 invokevirtual | B7 invokespecial | B8 invokestatic | B9 invokeinterface | BA invokedynamic | BB new | BC newarray | BD anewarray | BE arraylength | BF athrow |
C- | C0 checkcast | C1 instanceof | C2 monitorenter | C3 monitorexit | C4 wide | C5 multianewarray | C6 ifnull | C7 ifnonnull | C8 goto_w | C9 jsr_w | CA breakpoint | CB 未定義 | CC 未定義 | CD 未定義 | CE 未定義 | CF 未定義 |
D- | D0 未定義 | D1 未定義 | D2 未定義 | D3 未定義 | D4 未定義 | D5 未定義 | D6 未定義 | D7 未定義 | D8 未定義 | D9 未定義 | DA 未定義 | DB 未定義 | DC 未定義 | DD 未定義 | DE 未定義 | DF 未定義 |
E- | E0 未定義 | E1 未定義 | E2 未定義 | E3 未定義 | E4 未定義 | E5 未定義 | E6 未定義 | E7 未定義 | E8 未定義 | E9 未定義 | EA 未定義 | EB 未定義 | EC 未定義 | ED 未定義 | EE 未定義 | EF 未定義 |
F- | F0 未定義 | F1 未定義 | F2 未定義 | F3 未定義 | F4 未定義 | F5 未定義 | F6 未定義 | F7 未定義 | F8 未定義 | F9 未定義 | FA 未定義 | FB 未定義 | FC 未定義 | FD 未定義 | FE impdep1 | FF impdep2 |
エンタープライズ用(デスクトップ用を包含)としては、オラクル、IBM、HPなどの各社から実装系がリリースされている。OS上でアプリケーションとして動作する形態が一般的である。
Windowsにも標準でJava仮想マシンが実装されていたが、マイクロソフトがサン・マイクロシステムズとの契約に反して自社仕様の拡張機能を付加したため、Windows XP以降のOSではJavaの技術使用ライセンスを失った。
また、オープンソースコミュニティの手によってIKVM.NETという共通言語ランタイム上で動作するJava仮想マシンの実装も進められている。
変わった試みとしてGNU SmalltalkのVM上で構築されたJava仮想マシンが存在する。
picoJava, Jazelle などJava仮想マシンの命令がハードウェア実装されたプロセッサ、すなわちバイトコードを直接実行可能なプロセッサも存在する。
最初のJava仮想マシンの実装(JDK 1.0)はインタプリタ型であったため、動作速度が他のアプリケーションに比べて遅い場合があった。そのため、メソッドの実行直前(Just in Time)にバイトコードをCPUのネイティブコードにコンパイルして実行する形式(JITコンパイラ)を、ボーランドや IBMなどがリリースした。サン・マイクロシステムズの実装もJDK 1.1からJITコンパイラを搭載した。
加えて、JDK 1.2から、サン・マイクロシステムズはHotSpotという高速化技術を導入した。HotSpotはJITコンパイラの一種だが、常にJITコンパイルを行うのではなく、実行回数が規定回数を超えたメソッド (Hotspot) のみをJITコンパイルする。これにより、JITコンパイルによる無駄なリソースの消費を防いだり、インタプリタ実行時のプロファイリング情報をJITコンパイル利用できる利点がある。HotSpotには用途別に、クライアントVM(コンパイルは高速だが生成されるネイティブコードが相対的にあまり最適化されない)と、サーバVM(コンパイルは低速だが生成されるネイティブコードが相対的により最適化される)がある。
This article uses material from the Wikipedia 日本語 article Java仮想マシン, which is released under the Creative Commons Attribution-ShareAlike 3.0 license ("CC BY-SA 3.0"); additional terms may apply (view authors). コンテンツは、特に記載されていない限り、CC BY-SA 4.0のもとで利用可能です。 Images, videos and audio are available under their respective licenses.
®Wikipedia is a registered trademark of the Wiki Foundation, Inc. Wiki 日本語 (DUHOCTRUNGQUOC.VN) is an independent company and has no affiliation with Wiki Foundation.