食铁兽是什么动物| 蒲公英有什么功效和作用| 肺气肿是什么| 坐月子吃什么好| 甘油三酯高应该注意什么| 属马的生什么属相的宝宝好| 世袭罔替什么意思| 大便里面有血是什么原因| 排卵日是什么时候| 房子什么朝向好| 节制是什么意思| 肾疼是什么原因| 单发房早是什么意思| 逆向思维是什么意思| 3月14号是什么星座| 考c1驾照需要什么条件| 碘是什么东西| 忐忑什么意思| 为什么会得肠胃炎| 吃什么祛斑| gucci是什么品牌| 三心二意是指什么生肖| 身上出现白块什么原因| 阴道口痛什么原因| 狼毫毛笔是什么毛| 即什么意思| 玫瑰糠疹是什么原因引起的| 锦鲤什么意思| 梦到知了猴是什么意思| 中年人吃什么钙片补钙效果好| 什么人容易得天疱疮| 肚脐眼叫什么穴位| 什么叫引产| 乌龟白眼病用什么药| 神器积分换什么最划算| die是什么意思| 什么人不能坐飞机| 一什么田野| 女人吃什么排卵最快| 万马奔腾什么意思| 病毒性扁桃体发炎吃什么药| 神经纤维由什么组成| 晴字五行属什么| 男龙和什么生肖最配| 看十全十美是什么生肖| 鱼露是什么| 停经吃什么能来月经| 肿物是什么意思| 为什么爱放屁| 什么运动可以让孩子长高| 腰痛吃什么好| 两个禾念什么| 什么风什么什么| 查肝功能能查出什么病| 阿拉伯人属于什么人种| 天月二德是什么意思| 目前除皱最好的方法是什么| 排卵日有什么症状| 尪痹是什么意思| 肾穿刺是什么意思| 脑膜炎有什么症状| 僵尸为什么怕糯米| 沙僧的武器叫什么名字| 血小板低吃什么补得快| 瑜五行属什么| 像狐狸的狗是什么狗| 重庆是什么地形| 地黄泡水喝有什么好处| 吃石斛有什么作用| 观音殿求什么| 脑鸣是什么原因引起的| 肝火旺盛喝什么茶| 口蜜什么剑| 什么是气滞| 梦见自己抬棺材是什么意思| 紫得什么| 一九七二年属什么生肖| 眩晕症是什么原因引起的| 因果循环是什么意思| 生活质量是什么意思| maybach是什么车| 白板是什么意思| 济南是什么城| 人的血压一天中什么时候最高| 脚痒是什么原因| 玉鸟吃什么饲料好| 禾加比读什么| 5月1日什么星座| 甘油三酯高用什么药好| 吃什么补维生素a| 怀孕初期不能吃什么| 壮丁是什么意思| 鼻子经常流鼻涕是什么原因| 总胆红素高说明什么| 比目鱼是什么鱼| 狗狗可以吃什么水果| 洛神花茶有什么功效| 青蛙吃什么| 奔跑吧什么时候播出| 夏天适合用什么护肤品| 心肌缺血用什么药效果最好| 老放屁是什么原因| 68年猴五行属什么| d cup是什么意思| 全腹部ct平扫主要检查什么| 争奇斗艳是什么意思| 91年出生的属什么| 吃维生素b1有什么好处和副作用| 看甲状腺挂什么科| 静脉曲张吃什么食物好| 观音坐莲什么意思| 碳酸饮料喝多了有什么危害| 转诊是什么意思| 补办港澳通行证需要什么材料| 蓝牙耳机什么牌子好| 股票pe是什么意思| 小孩走路迟是什么原因| 心脏病吃什么水果最好| cns是什么意思| 十月二十七是什么星座| 5月13日什么星座| 面瘫是什么原因引起的| 胆结石吃什么药可以化掉结石| 巨细胞病毒抗体阳性是什么意思| 嗓子疼喝什么茶最有效| 螨虫长什么样子图片| 空调有异味是什么原因| 水逆是什么| 肉苁蓉是什么| 尿失禁吃什么药最好| 张三李四王五赵六后面是什么| 胸闷是什么原因引起的| 颈椎病吃什么药好| 脖子痒是什么原因| 她将是你的新娘是什么歌| 卵巢增大是什么原因引起的| 3.8号是什么星座| 钼靶是什么检查| 打蛔虫吃什么药| 黑头是什么| 婴儿吃手是什么原因| 什么时间喝牛奶最佳| 两个方一个土读什么| 5月30号是什么星座| 梦见吃西红柿是什么意思| 突兀什么意思| 干水是什么| 食管裂孔疝是什么病| 吃什么补维生素b| 栩是什么意思| 母乳什么味道| 低烧吃什么药好| 瀹是什么意思| 购物狂是什么心理疾病| 尿蛋白弱阳性什么意思| 扭捏是什么意思| 护理部主任是什么级别| 孕晚期破水是什么症状| snoopy是什么意思| 吃谷维素有什么副作用| 定点医院什么意思| 控评是什么意思| 拜金女是什么意思| 春梦了无痕是什么意思| 无垢是什么意思| 吃饭就吐是什么原因| 强碱是什么| 月经期间应该吃什么食物比较好| 礼部尚书是什么官| 1997年什么命| 舌头痛吃什么药好得快| 单亲家庭是什么意思| 尼古丁是什么东西| 雌二醇低吃什么补得快| 漪什么意思| 什么东西助眠| 二郎神叫什么名字| 刚怀孕肚子有什么变化| 斑是什么原因造成的| 浪琴军旗什么档次| 85年属什么的| 沾沾喜气什么意思| 智齿拔了有什么影响| 太妃糖为什么叫太妃糖| 宝是什么生肖| 1990年属马的是什么命| 嘴干是什么病的征兆| 呼吸困难是什么原因引起的| 小孩眨眼睛是什么原因| 海藻糖是什么糖| 土字旁有什么字| 嗓子哑是什么原因引起的| 虎皮兰开花寓意什么| 孕期血糖高可以吃什么水果| 但愿人长久的下一句是什么| 五加一笔是什么字| 小儿积食吃什么药最好| 不以为然的意思是什么| 脑疝是什么意思| 青梅竹马是什么意思| 肾不好是什么原因引起的| 老是做噩梦是什么原因| 老人高烧不退是什么原因| ppd试验是什么意思| 胸口疼应该挂什么科| 做梦吃鱼是什么意思| 什么叫粳米| 漏尿是什么原因造成的| 愚钝是什么意思| 心动过缓吃什么药最好| 巨蟹座和什么最配| 胸部发炎是什么症状| ask是什么意思| 64岁属什么| 香蕉和什么一起吃能减肥| 寂寞难耐是什么意思| 梦见两口子吵架是什么意思| 酌情是什么意思| 丧门是什么意思| 结婚20年是什么婚姻| 胭脂是什么| 长命百岁的动物是什么| 11月14日什么星座| 气球是什么生肖| 恋爱观是什么| 中国是什么国家| 为什么会斑秃| 锐字五行属什么| 六味地黄丸什么时候吃最好| 什么入伏| 共济失调是什么病| 甲亢是什么| 一花一草一世界的下一句是什么| 97年属什么今年多大| 什么是菩提| 胎儿腿短是什么原因| 田鸡是什么| 清新的什么填空| 石男是什么意思| 乙肝两对半和乙肝五项有什么区别| 气虚血虚吃什么中成药| 小厨宝是什么| 狗狗拉血是什么原因| 公分是什么意思| 什么是牙冠| 十月一日是什么节| 被和谐了是什么意思| dna倍体异常细胞是什么意思| 清肺火肺热吃什么药最有效| 石斤读什么| 名人轶事是什么意思| 高铁上为什么没有e座| ab是什么意思| 菜板什么木材最好| 心绞痛是什么症状| 夜间多梦是什么原因| 男怕初一女怕十五是什么意思| 喉咙不舒服挂什么科| 长黑斑是什么原因引起的| 133是什么意思| 不割包皮有什么影响| 汗青是什么意思| 东宫是什么意思| 七月半是什么日子| 百度Jump to content

四川一八旬老人深陷泥潭8小時 干警用绳索成功施救

From Wikipedia, the free encyclopedia
百度 在总部1000多名研发人员当中,还聘有外国专业人员20多名。

Java bytecode is the instruction set of the Java virtual machine (JVM), the language to which Java and other JVM-compatible source code is compiled.[1] Each instruction is represented by a single byte, hence the name bytecode, making it a compact form of data.[2]

Due to the nature of bytecode, a Java bytecode program is runnable on any machine with a compatible JVM, without the lengthy process of compiling from source code.

Java bytecode is used at runtime either interpreted by a JVM or compiled to machine code via just-in-time (JIT) compilation and run as a native application.

As Java bytecode is designed for a cross-platform compatibility and security, a Java bytecode application tends to run consistently across various hardware and software configurations.[3]

Relation to Java

[edit]

In general, a Java programmer does not need to understand Java bytecode or even be aware of it. However, as suggested in the IBM developerWorks journal, "Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembly helps the C or C++ programmer."[4]

Instruction set architecture

[edit]

The bytecode comprises various instruction types, including data manipulation, control transfer, object creation and manipulation, and method invocation, all integral to Java's object-oriented programming model.[1]

The JVM is both a stack machine and a register machine. Each frame for a method call has an "operand stack" and an array of "local variables".[5]:?2.6? [2] The operand stack is used for passing operands to computations and for receiving the return value of a called method, while local variables serve the same purpose as registers and are also used to pass method arguments. The maximum size of the operand stack and local variable array, computed by the compiler, is part of the attributes of each method.[5]:?4.7.3? Each can be independently sized from 0 to 65535 values, where each value is 32 bits. long and double types, which are 64 bits, take up two consecutive local variables[5]:?2.6.1? (which need not be 64-bit aligned in the local variables array) or one value in the operand stack (but are counted as two units in the depth of the stack).[5]:?2.6.2?

Instruction set

[edit]

Each bytecode is composed of one byte that represents the opcode, along with zero or more bytes for operands.[5]:?2.11?

Of the 256 possible byte-long opcodes, as of 2015, 202 are in use (~79%), 51 are reserved for future use (~20%), and 3 instructions (~1%) are permanently reserved for JVM implementations to use.[5]:?6.2? Two of these (impdep1 and impdep2) are to provide traps for implementation-specific software and hardware, respectively. The third is used for debuggers to implement breakpoints.

Instructions fall into a number of broad groups:

  • Load and store (e.g. aload_0, istore)
  • Arithmetic and logic (e.g. ladd, fcmpl)
  • Type conversion (e.g. i2b, d2i)
  • Object creation and manipulation (new, putfield)
  • Operand stack management (e.g. swap, dup2)
  • Control transfer (e.g. ifeq, goto)
  • Method invocation and return (e.g. invokespecial, areturn)

There are also a few instructions for a number of more specialized tasks such as exception throwing, synchronization, etc.

Many instructions have prefixes and/or suffixes referring to the types of operands they operate on.[5]:?2.11.1? These are as follows:

Prefix/suffix Operand type
i integer
l long
s short
b byte
c character
f float
d double
a reference

For example, iadd will add two integers, while dadd will add two doubles. The const, load, and store instructions may also take a suffix of the form _n, where n is a number from 0–3 for load and store. The maximum n for const differs by type.

The const instructions push a value of the specified type onto the stack. For example, iconst_5 will push an integer (32 bit value) with the value 5 onto the stack, while dconst_1 will push a double (64 bit floating point value) with the value 1 onto the stack. There is also an aconst_null, which pushes a null reference. The n for the load and store instructions specifies the index in the local variable array to load from or store to. The aload_0 instruction pushes the object in local variable 0 onto the stack (this is usually the this object). istore_1 stores the integer on the top of the stack into local variable 1. For local variables beyond 3 the suffix is dropped and operands must be used.

Example

[edit]

Consider the following Java code:

outer:
for (int i = 2; i < 1000; i++) {
    for (int j = 2; j < i; j++) {
        if (i % j == 0)
            continue outer;
    }
    System.out.println(i);
}

A Java compiler might translate the Java code above into bytecode as follows, assuming the above was put in a method:

0:   iconst_2
1:   istore_1
2:   iload_1
3:   sipush  1000
6:   if_icmpge       44
9:   iconst_2
10:  istore_2
11:  iload_2
12:  iload_1
13:  if_icmpge       31
16:  iload_1
17:  iload_2
18:  irem
19:  ifne    25
22:  goto    38
25:  iinc    2, 1
28:  goto    11
31:  getstatic       #84; // Field java/lang/System.out:Ljava/io/PrintStream;
34:  iload_1
35:  invokevirtual   #85; // Method java/io/PrintStream.println:(I)V
38:  iinc    1, 1
41:  goto    2
44:  return

Generation

[edit]

The most common language targeting Java virtual machine by producing Java bytecode is Java. Originally only one compiler existed, the javac compiler from Sun Microsystems, which compiles Java source code to Java bytecode; but because all the specifications for Java bytecode are now available, other parties have supplied compilers that produce Java bytecode. Examples of other compilers include:

  • Eclipse compiler for Java (ECJ)
  • Jikes, compiles from Java to Java bytecode (developed by IBM, implemented in C++)
  • Espresso, compiles from Java to Java bytecode (Java 1.0 only)
  • GNU Compiler for Java (GCJ), compiles from Java to Java bytecode; it can also compile to native machine code and was part of the GNU Compiler Collection (GCC) up until version 6.

Some projects provide Java assemblers to enable writing Java bytecode by hand. Assembly code may be also generated by machine, for example by a compiler targeting a Java virtual machine. Notable Java assemblers include:

  • Jasmin, takes text descriptions for Java classes, written in a simple assembly-like syntax using Java virtual machine instruction set and generates a Java class file[6]
  • Jamaica, a macro assembly language for the Java virtual machine. Java syntax is used for class or interface definition. Method bodies are specified using bytecode instructions.[7]
  • Krakatau Bytecode Tools, currently contains three tools: a decompiler and disassembler for Java classfiles and an assembler to create classfiles.[8]
  • Lilac, an assembler and disassembler for the Java virtual machine.[9]

Others have developed compilers, for different programming languages, to target the Java virtual machine, such as:

Execution

[edit]

There are several Java virtual machines available today to execute Java bytecode, both free and commercial products. If executing bytecode in a virtual machine is undesirable, a developer can also compile Java source code or bytecode directly to native machine code with tools such as the GNU Compiler for Java (GCJ). Some processors can execute Java bytecode natively. Such processors are termed Java processors.

Support for dynamic languages

[edit]

The Java virtual machine provides some support for dynamically typed languages. Most of the extant JVM instruction set is statically typed - in the sense that method calls have their signatures type-checked at compile time, without a mechanism to defer this decision to run time, or to choose the method dispatch by an alternative approach.[12]

JSR 292 (Supporting Dynamically Typed Languages on the Java Platform)[13] added a new invokedynamic instruction at the JVM level, to allow method invocation relying on dynamic type checking (instead of the extant statically type-checked invokevirtual instruction). The Da Vinci Machine is a prototype virtual machine implementation that hosts JVM extensions aimed at supporting dynamic languages. All JVMs supporting JSE 7 also include the invokedynamic opcode.

See also

[edit]

References

[edit]
  1. ^ a b "Java Virtual Machine Specification". Oracle. Retrieved 14 November 2023.
  2. ^ a b Lindholm, Tim (2015). The Java Virtual Machine Specification. Oracle. ISBN 978-0133905908.
  3. ^ Arnold, Ken (1996). "The Java Programming Language". Sun Microsystems. 1 (1): 30–40.
  4. ^ "IBM Developer". developer.ibm.com. Retrieved 20 February 2006.
  5. ^ a b c d e f g Lindholm, Tim; Yellin, Frank; Bracha, Gilad; Buckley, Alex (13 February 2015). The Java Virtual Machine Specification (Java SE 8 ed.).
  6. ^ "Jasmin Home Page". jasmin.sourceforge.net. Retrieved 2 June 2024.
  7. ^ Huang, James Jianbo. "Jamaica: The Java virtual machine (JVM) macro assembler". JavaWorld. Archived from the original on 14 November 2023. Retrieved 2 June 2024.
  8. ^ "Storyyeller/Krakatau". 1 June 2024. Retrieved 2 June 2024 – via GitHub.
  9. ^ "Lilac - a Java assembler". lilac.sourceforge.net. Retrieved 2 June 2024.
  10. ^ "FPC New Features 3.0.0 - Free Pascal wiki". wiki.freepascal.org. Retrieved 2 June 2024.
  11. ^ "FPC JVM - Free Pascal wiki". wiki.freepascal.org. Retrieved 2 June 2024.
  12. ^ Nutter, Charles (3 January 2007). "InvokeDynamic: Actually Useful?". Retrieved 25 January 2008.
  13. ^ "The Java Community Process(SM) Program - JSRs: Java Specification Requests - detail JSR# 292". www.jcp.org. Retrieved 2 June 2024.
[edit]
非那根又叫什么 天津市市长什么级别 逾期不候什么意思 磨砂皮是什么皮 工科和理科有什么区别
血脂是什么意思 一切唯心造是什么意思 心肌缺血吃什么食物好 kdj是什么意思 吃饭出汗多是什么原因
荷叶加什么减肥最快 工段长是什么级别 用醋泡脚有什么好处 眼袋肿了是什么原因 查甲状腺功能挂什么科
爱华仕是什么档次 安宫牛黄丸什么时候吃 土崩瓦解是什么意思 卡司是什么意思 什么时候闰十二月
忌入宅是什么意思hcv8jop4ns8r.cn 捂脸表情什么意思hcv9jop5ns5r.cn 7月8号是什么星座的hcv8jop6ns2r.cn 大腿根部痛是什么原因hcv8jop4ns4r.cn 流口水是什么病hcv8jop1ns6r.cn
胸前有痣代表什么意思hcv7jop7ns4r.cn 治疗阳痿吃什么药hcv9jop5ns3r.cn 一柱擎天什么意思hcv9jop3ns3r.cn 痿证是什么病hcv8jop4ns0r.cn 扒拉是什么意思zhongyiyatai.com
北方五行属什么hcv9jop3ns1r.cn 艺名是什么意思hcv7jop5ns3r.cn 肝硬化失代偿期是什么意思hanqikai.com 小鸡炖什么好吃beikeqingting.com 脂肪肝挂什么科hcv9jop6ns8r.cn
白带拉丝是什么原因0735v.com 胸口闷痛什么原因引起的hcv8jop9ns1r.cn 橱柜用什么材料好hcv9jop3ns2r.cn 蚱蜢吃什么食物hcv9jop3ns9r.cn 吐露是什么意思hcv9jop1ns8r.cn
百度