Encoding the Java Virtual Machine’s Instruction Set毕业设计外文文献翻译.doc
《Encoding the Java Virtual Machine’s Instruction Set毕业设计外文文献翻译.doc》由会员分享,可在线阅读,更多相关《Encoding the Java Virtual Machine’s Instruction Set毕业设计外文文献翻译.doc(14页珍藏版)》请在沃文网上搜索。
1、外文资料原文Encoding the Java Virtual Machines Instruction Set 1 Introduction The development of programs that parse and analyze Java Bytecode 9 has a long history and new programs are still developed 2,3,4,7,13. When developing such tools, however, a lot of effort is spent to develop a parser for the byt
2、ecode and for (re-) developing standard control- and data-flow analyses which calculate, e.g., the control-flow graph or the data-dependency graph. To reduce these efforts, we have developed a specification language (OPAL SPL) for encoding the instructions of stack-based intermediate languages. The
3、idea is thatonce the instruction set is completely specified using OPAL SPLgenerating both bytecode parsers and standard analyses is much easier than their manual development. To support this goal, OPAL SPL supports the specification of both the format of bytecode instructions and the effect on the
4、stack and registers these instructions have when executed. An alternative use of an OPAL SPL specification is as input to a generic parser or to generic analyses as illustrated by Fig. 1 Though the language was designed with Java Bytecode specifically in mind and is used to encode the complete instr
5、uction set of the Java Virtual Machine (JVM) , we have striven for a Java-independent specification language. In particular, OPAL SPL focuses on specifying the instruction set rather than the complete class file format, not only because the formers structure is much more regular than the latters,but
6、 also because a specification of the instruction set promises to be most beneficial. Given the primary focus of OPAL SPLgenerating parsers and facilitating basic analyseswe explicitly designed the language such that it is possible to group related instructions. This makes specifications more concise
7、 and allows analyses to treat similar instructions in nearly the same way. For example, the JVMs iload 5 instruction, which loads the integer value stored in register #5, is a special case of the generic iload instruction where the instructions operand is 5. We also designed OPAL SPL in such a way t
8、hat specifications do not prescribe how a framework represents or processes information; i.e., OPAL SPL is representation agnostic. The next section describes the specification language. In Section3we reason about the languages design by discussing the specification of selected JVM instructions. In
9、Section4the validation of specifications is discussed. The evaluation of the approach is presented in Section5. The paper ends with a discussion of related work and a conclusion. 2 Specifying Bytecode Instructions The language for specifying bytecode instructions (OPAL SPL) was primarily designed to
10、 enable a concise specification of the JVMs instruction set. OPAL SPL supports the specification of both an instructions format and its effect on the stack and local variables (registers)when the instruction is executed. It is thus possible to specify which kind of values are popped from and pushed
11、onto the stack as well as which local variables are read or written. Given a specification of the complete instruction set the information required by standard control- and data-flow analyses is then available. However, OPAL SPL is not particularly tied to Java as it abstracts from the particulariti
12、es of the JVM Specification. For example, the JVMs type system is part of an OPAL SPL specification rather than an integral part of the OPAL SPL language itself. Next, we first give an overview of the language before we discuss its semantics. 2.1 Syntax The OPAL Specification Language (OPAL SPL) is
13、an XML-based language. Its grammar is depicted in Fig.2using an EBNF-like format. Non-terminals are written in capital letters (INSTRUCTIONS, TYPES, etc.), the names of XML-elements are written in small letters (types, stack, etc.) and the names of XML-attributes start with “” (type, var, etc.). We
14、refer to the content of an XML-element using symbols that start with“/” (/VALUEEXPRESSION, /EXPECTEDVALUE, etc.). “” is used to specify nesting of elements. “( ),?,+,*,|” have the usual semantics. For example,exceptionsspecifies that the XML-elementexceptionshas one or moreexceptionchild elements th
15、at always have the attributetype. 2.2 Semantics Format Specification Each specification written in OPAL SPL consists of four major parts (line 1 in Fig.2). The first part(types, lines 23) specifies the type system that is used by the underlying virtual machine. The second part (exceptions, line 4) d
16、eclares the exceptions that may be thrown when instructions are executed. The third part (functions, line 5) declares the functions that are used in instruction specifications. The fourth part is the specification of the instructions themselves (lines 612), each of which may resort to the declared f
17、unctions to access information not simply stored along with the instruction. For example,invoke instructions do not store the signature and declaring class of the called methods. Instead, a reference to an entry in the so-called constant pool is stored. Only this constant pool entry has all informat
18、ion about the method. To obtain, e.g., the return type of the called method, an abstract function TYPE method refreturn type(method ref) is declared that takes a reference to the entry as input and returns the methods return type. Using abstract function declarations, we abstractin the specification
19、 of the instructionsfrom the concrete representation of such information by the enclosing by tecode toolkit. The specification of an instruction consists of up to four parts: the instructions format (lines 78), a description of the effect the instruction has on the stack when executed (lines 910), a
20、 descriptions of the registers it affects upon execution (lines 1112), and information about the exceptions that may be thrown during execution (end of line 6). An instructions format is specified by sequences which describe how an instruction is stored. Theu1, u2andu4elements (line 8) of each forma
21、t sequence specify that the current value is an unsigned integer value with 1, 2 and 4 bytes, respectively. Similarly, thei1, i2 andi4 elements (line 8) are used to specify that the current value is a (1, 2 or 4 byte) signed integer value. The values can be bound to variables using thevarat tribute
22、and can be given a second semantics using thetype attribute. For example,is a twobyte signed integer value that is bound to the variable value and has type short with respect to the instruction sets type system. Additionally, it is possible to specify expected values (line 8). This enables the selec
23、tion of the format sequence to be used for reading in the instruction. E.g., 171. specifies that this sequence matches if the value of the first byte is 171. A sequences list element is used to specify that a variable number of values need to be read. The concrete number of elements is determined by
24、 the count attribute. The attributes value is an expression that can use values that were previously assigned to a variable. The sequence elements implicit and implicit type are used to bind implicit value and type information to variables that can later on be used in type or value expressions(line
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
10 积分
下载 | 加入VIP,下载更划算! |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Encoding the Java Virtual Machine Instruction Set 毕业设计 外文 文献 翻译
链接地址:http://www.wodocx.com/p-823830.html