JVM学习笔记-操作数栈(Operand Stack)
Like the local variables, the operand stack is organized as an array of words.
But unlike the local variables, which are accessed via array indices,
the operand stack is accessed by pushing and popping values.
If an instruction pushes a value onto the operand stack, a later instruction can pop and use that value.
和局部变量区一样,操作数栈也是被组织成一个以字长为单位的数组。
但是和前者不同的是,它不是通过索引来访问,
而是通过标准的栈操作—压栈和出栈—来访问的。
比如,如果某个指令把一个值压入到操作数栈中,稍后另一个指令就可以弹出这个值来使用。
variables
variable
英 ['veərɪəb(ə)l] 美 ['vɛrɪəbl]
adj. 变量的;可变的;易变的,多变的;变异的,[生物] 畸变的
n. [数] 变量;可变物,可变因素
比较级 more variable最高级 most variable
![]()
词根:vary
adj.
varied 多变的;各式各样的;杂色的
varying 不同的;变化的
adv.
variably 易变地;不定地
n.
variation 变化;[生物] 变异,变种
variance 变异;变化;不一致;分歧;[数] 方差
variability 可变性,变化性;[生物][数] 变异性
variate [数] 变量;改变
variedness 变化;杂色
v.
varied 改变;使多样化(vary的过去式和过去分词形式)
varying 变化,改变(vary的现在分词)
vi.
vary 变化;变异;违反
vt.
vary 改变;使多样化;变奏
View Code
organized
英 [ˈɔːɡəˌnaɪzd] 美 ['ɔrɡənaɪzd]
adj. 有组织的;安排有秩序的;做事有条理的
v. 组织(organize的过去分词)
![]()
词根:organize
adj.
organizational 组织的;编制的
organised 有组织的;组织起来的(等于organized)
organismal 生物的;有机体的
n.
organization 组织;机构;体制;团体
organism 有机体;生物体;微生物
organisation 组织;团体(等于organization)
organizer 组织者;承办单位;[生物] 组织导体
v.
organised 组织;构成(organise的过去式)
vi.
organize 组织起来;成立组织
organise 组织起来;组织工会
vt.
organize 组织;使有系统化;给予生机;组织成立工会等
organise 组织(等于organize);有机化;给予生机
View Code
via
英 [ˈvaɪə,ˈviːə] 美 [ˈvaɪə, ˈviə]
prep. 渠道,通过;经由
同近义词
prep.
取道,通过;经由
by way ofTHRU through
indices
英 ['ɪndɪsiːz] 美 ['ɪndɪsiz]
n. 指数;目录(index的复数)
![]()
词根:index
adj.
indexical 像索引排列的;索引的
indexless 无索引的
n.
indexer 编索引的人;分度器
indexing [图情] 标引;[数] 指标化;编制指数
indexation [计划] 指数化
v.
indexing 指出(index的ing形式);编入索引中
View Code
pushing
英 ['pʊʃɪŋ] 美 [pʊʃɪŋ]
adj. 奋斗的;莽撞的;有精力的;富有进取心的
n. 推挤;推人犯规(篮球术语)
v. 推;促进;逼迫(push的ing形式)
![]()
词根:push
adj.
pushy 有进取心的;爱出风头的;有冲劲的;固执己见的
pushful 富有进取心的;有精力的
n.
push 推;决心;奋力;攻击;干劲;进取心
pusher 推进器;推进式飞机;推销员;非法销售者
vi.
push 推;推进;增加;伸展;努力争取
vt.
push 推动;增加;推行;逼迫
View Code
popping
英 ['pɒpɪŋ] 美 ['pɑpɪŋ]
adj. 间歇的;凸出的
n. 爆音;突然跳出;爆孔;机器舞
v. 出现;爆开;敲击;抛出(pop的ing形式)
![]()
词根:pop
abbr.
pop 邮局协议(post office protocol)
adj.
pop 流行的;通俗的;热门的
adv.
pop 突然;砰地
n.
pop 流行音乐;汽水;砰然声;枪击
popper 服药成瘾者;发出啪声的人或物;爆竹;炮手;爆玉米花机
vi.
pop 突然出现;爆开;射击;瞪大;发出爆裂声
vt.
pop 取出;开枪打;抛出;突然伸出;突然行动
View Code
instruction
英 [ɪn'strʌkʃ(ə)n] 美 [ɪn'strʌkʃən]
n. 指令,命令;指示;教导;用法说明
![]()
词根:instruct
adj.
instructive 有益的;教育性的
instructional 教学的;指导的,教育的
adv.
instructively 有益地;教育地
n.
instructor 指导书;教员;指导者
instructress 女教师;女指导
vt.
instruct 指导;通知;命令;教授
View Code
The virtual machine stores the same data types in the operand stack that it stores in the local variables:
int, long, float, double, reference, and returnType.
It converts values of type byte, short, and char to int before pushing them onto the operand stack.
虚拟机在操作数栈中存储数据的方式和在局部变量区中是一样的:如int、long、float、double、reference和returnType的存储。
对于byte、short以及char类型的值在压入到操作数栈之前,也会被转换为int。
convert
英 [kən'vɜːt] 美 [kən'vɝt]
vt. 使转变;转换…;使…改变信仰
vi. 转变,变换;皈依;改变信仰
n. 皈依者;改变宗教信仰者
![]()
词根:convert
adj.
convertible 可改变的;同意义的;可交换的
converted 修改的;改变信仰的
n.
conversion 转换;变换;[金融] 兑换;改变信仰
converter [电] 变流器,整流器;转化器
convertible 有活动折篷的汽车
convertibility 可变换,可兑换;可改变性
v.
converted 转变;改变信仰(convert的过去式和过去分词形式)
View Code
Other than the program counter, which canít be directly accessed by instructions,
the Java Virtual Machine has no registers.
The Java Virtual Machine is stack-based rather than register-based
because its instructions take their operands from the operand stack rather than from registers.
Instructions can also take operands from other places,
such as immediately following the opcode (the byte representing the instruction) in the bytecode stream,
or from the constant pool.
The Java Virtual Machine instruction set's main focus of attention, however, is the operand stack.
不同于程序计数器,Java虚拟机没有寄存器,程序计数器也无法被程序指令直接访问。
Java虚拟机的指令是从操作数栈中而不是从寄存器中取得操作数的,
因此它的运行方式是基于栈的而不是基于寄存器的。
虽然指令也可以从其他地方取得操作数,
比如从字节码流中跟随在操作码(代表指令的字节)之后的字节中或从常量池中,
但是主要还是从操作数栈中获得操作数。
registers
美 ['rɛdʒɪstɚ]
n. 登记;暂存器;登记簿;登记员(register的复数)
v. 登记;挂号邮寄;指示(register的三单形式)
![]()
词根:registry
adj.
registered 注册的;记名的;登记过的;(家畜等)附有血统证明的
n.
registration 登记;注册;挂号
registry 注册;登记处;挂号处;船舶的国籍
registrar 登记员;注册主任;专科住院医师
registrant 登记者
View Code
immediately
英 [ɪ'miːdɪətlɪ] 美 [ɪ'midɪətli]
adv. 立即,立刻;直接地
conj. 一…就
词根:immediate
adj.
immediate 立即的;直接的;最接近的
n.
immediacy 直接;目前
immediateness 即刻;直接
opcode
[ɑpkod]
n. 操作码;作业码
abbr.
Operation code 操作码
representing
英 美
v. 代表;表示,表现(represent的ing形式)
![]()
词根:represent
adj.
representative 典型的,有代表性的;代议制的
representational 代表的;具象派的
representable 能被代表的;能上演的;能被描绘的
n.
representative 代表;典型;众议员
representation 代表;表现;表示法;陈述
View Code
attention
英 [ə'tenʃ(ə)n] 美 [ə'tɛnʃən]
n. 注意力;关心;立正!(口令)
![]()
词根:attentive
adj.
attentive 留意的,注意的
attentional 注意的;保养的
adv.
attentively 注意地;聚精会神地;周到地
n.
attentiveness 注意力;专注
View Code
operate
英 ['ɒpəreɪt] 美 ['ɑpə'ret]
vi. 运转;动手术;起作用
vt. 操作;经营;引起;对…开刀
过去式 operated过去分词 operated现在分词 operating
![]()
词根:operate
adj.
operating 操作的;[外科] 外科手术的
operational 操作的;运作的
operative 有效的;运转着的;从事生产劳动的
operant 操作的;有效的
operable 可操作的;可动手术的
n.
operation 操作;经营;[外科] 手术;[数][计] 运算
operator 经营者;操作员;话务员;行家
operative 侦探;技工
operand [计] 操作数;[计] 运算对象
operant 自发反应;操作性制约;发生作用之人或物
operationalism 操作主义(等于operationism)
v.
operating 操作(operate的ing形式);动手术
View Code
The Java Virtual Machine uses the operand stack as a work space.
Many instructions pop values from the operand stack, operate on them, and push the result.
For example, the iadd instruction adds two integers by popping two ints off the top of the operand stack,
adding them, and pushing the int result.
Here is how a Java Virtual Machine would add two local variables that
contain ints and store the int result in a third local variable:
虚拟机把操作数栈作为它的工作区——大多数指令都要从这里弹出数据,执行运算,然后把结果压回操作数栈。
比如,iadd指令就要从操作数栈中弹出两个整数,执行加法运算,其结果又压回到操作数栈中,
看看下面的示例,它演示了虚拟机是如何把两个int类型的局部变量相加,再把结果保存到第三个局部变量的:
graphical
英 ['græfɪk(ə)l] 美 ['ɡræfɪkl]
adj. 图解的;绘画的;生动的
词根:graphic
adj.
graphic 形象的;图表的;绘画似的
adv.
graphically 生动地;活灵活现地;用图表表示;轮廓分明地
begin
iload_0 // push the int in local variable 0 onto the stack
iload_1 // push the int in local variable 1 onto the stack
iadd // pop two ints, add them, push result
istore_2 // pop int, store into local variable 2
end
In this sequence of bytecodes, the first two instructions, iload_0 and iload_1,
push the ints stored in local variable positions zero and one onto the operand stack.
The iadd instruction pops those two int values, adds them, and pushes the int result back onto the operand stack.
The fourth instruction, istore_2,
pops the result of the add off the top of the operand stack and stores it into local variable position two.
In Figure 5-10, you can see a graphical depiction of the state of the local variables and operand stack
while executing the above instructions.
In this figure, unused slots of the local variables and operand stack are left blank.
在这个字节码序列里,前两个指令iload_0和iload_1
将存储在局部变量中索引为0和1的整数压入操作数栈中,
其后iadd指令从操作数栈中弹出那两个整数相加,再将结果压入操作数栈。
第四条指令istore_2则从操作数栈中弹出结果,并把它存储到局部变量区索引为2的位置。
图5-10详细表述了这个过程中局部变量和操作数栈的状态变化,
图中没有使用的局部变量区和操作数栈区域以空白表示。
figure
英 ['fɪgə] 美 ['fɪɡjɚ]
n. 数字;人物;图形;价格;(人的)体形;画像
vi. 计算;出现;扮演角色
vt. 计算;认为;描绘;象征
过去式 figured过去分词 figured现在分词 figuring
![]()
词根:figure
adj.
figurative 比喻的;修饰丰富的;形容多的
figured 华丽的;有形状的;用图画表现的;有图案的
figural 借喻的;具有人的形象的;比喻的
n.
figuration 成形;外形;定形;比喻表达法;图案装饰法
figurant (戏剧电影中的)群众演员;男配角演员
v.
figured 以图画或图表描绘;设想(figure的过去式和过去分词)
View Code
depiction
英 [dɪ'pɪkʃn] 美 [dɪ'pɪkʃən]
n. 描写,叙述
![]()
词根:depict
adj.
depictive 描写的;描述的
vt.
depict 描述;描画
View Code
above
英 [ə'bʌv] 美 [ə'bʌv]
prep. 超过;在……上面;在……之上
adv. 在上面;在上文
adj. 上文的
n. 上文