⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual.html

📁 一个用于对.class文件进行插桩的开源工具
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- Content Stylesheet for Site -->        <!-- start the processing -->    <!-- ====================================================================== -->    <!-- Main Page Section -->    <!-- ====================================================================== -->    <html>        <head>            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>                                                    <meta name="author" value="Markus Dahm">            <meta name="email" value="markus.dahm@berlin.de">                        <title>BCEL - Byte Code Engineering Library (BCEL)</title>        </head>        <body bgcolor="#ffffff" text="#000000" link="#525D76">                    <table border="0" width="100%" cellspacing="0">                <!-- TOP IMAGE -->                <tr>                    <td align="left"><a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" border="0"/></a></td><td align="right"><a href="http://jakarta.apache.org/bcel"><img src="./images/bcel-logo.gif" alt="BCEL" border="0"/></a></td>                </tr>            </table>            <table border="0" width="100%" cellspacing="4">                <tr><td colspan="2">                    <hr noshade="" size="1"/>                </td></tr>                                <tr>                    <!-- LEFT SIDE NAVIGATION -->                    <td width="20%" valign="top" nowrap="true">                                <p><strong>BCEL</strong></p>        <ul>                    <li>    <a href="./index.html">Front Page</a></li>                    <li>    <a href="./news.html">News & Status</a></li>                </ul>            <p><strong>Documentation</strong></p>        <ul>                    <li>    <a href="./manual.html">Manual</a></li>                    <li>    <a href="./faq.html">FAQ</a></li>                </ul>            <p><strong>Download</strong></p>        <ul>                    <li>    <a href="http://jakarta.apache.org/site/binindex.html">Binaries</a></li>                    <li>    <a href="http://jakarta.apache.org/site/sourceindex.html">Source Code</a></li>                </ul>            <p><strong>Get Involved</strong></p>        <ul>                    <li>    <a href="http://cvs.apache.org/viewcvs/jakarta-bcel/">CVS Repository</a></li>                    <li>    <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a></li>                    <li>    <a href="http://jakarta.apache.org/site/bugs.html">Issue Tracking</a></li>                    <li>    <a href="./contributors.html">Contributors</a></li>                    <li>    <a href="./license.html">License</a></li>                    <li>    <a href="./projects.html">Projects</a></li>                </ul>                        </td>                    <td width="80%" align="left" valign="top">                                                                    <table border="0" cellspacing="0" cellpadding="2" width="100%">      <tr><td bgcolor="#525D76">        <font color="#ffffff" face="arial,helvetica,sanserif">          <a name="Abstract"><strong>Abstract</strong></a>        </font>      </td></tr>      <tr><td>        <blockquote>                                    <p>    Extensions and improvements of the programming language Java and    its related execution environment (Java Virtual Machine, JVM) are    the subject of a large number of research projects and    proposals. There are projects, for instance, to add parameterized    types to Java, to implement <a href="http://aspectj.org/">Aspect-Oriented Programming</a>, to    perform sophisticated static analysis, and to improve the run-time    performance.  </p>                                                <p>    Since Java classes are compiled into portable binary class files    (called <em>byte code</em>), it is the most convenient and    platform-independent way to implement these improvements not by    writing a new compiler or changing the JVM, but by transforming    the byte code. These transformations can either be performed    after compile-time, or at load-time. Many programmers are doing    this by implementing their own specialized byte code manipulation    tools, which are, however, restricted in the range of their    re-usability.  </p>                                                <p>    To deal with the necessary class file transformations, we    introduce an API that helps developers to conveniently implement    their transformations.  </p>                            </blockquote>        </p>      </td></tr>      <tr><td><br/></td></tr>    </table>                                                <table border="0" cellspacing="0" cellpadding="2" width="100%">      <tr><td bgcolor="#525D76">        <font color="#ffffff" face="arial,helvetica,sanserif">          <a name="1 Introduction"><strong>1 Introduction</strong></a>        </font>      </td></tr>      <tr><td>        <blockquote>                                    <p>    The <a href="http://java.sun.com/">Java</a> language has become    very popular and many research projects deal with further    improvements of the language or its run-time behavior. The    possibility to extend a language with new concepts is surely a    desirable feature, but the implementation issues should be hidden    from the user. Fortunately, the concepts of the Java Virtual    Machine permit the user-transparent implementation of such    extensions with relatively little effort.  </p>                                                <p>    Because the target language of Java is an interpreted language    with a small and easy-to-understand set of instructions (the    <em>byte code</em>), developers can implement and test their    concepts in a very elegant way. One can write a plug-in    replacement for the system's <em>class loader</em> which is    responsible for dynamically loading class files at run-time and    passing the byte code to the Virtual Machine (see section ).    Class loaders may thus be used to intercept the loading process    and transform classes before they get actually executed by the    JVM. While the original class files always remain unaltered, the    behavior of the class loader may be reconfigured for every    execution or instrumented dynamically.  </p>                                                <p>    The <font face="helvetica,arial">BCEL</font> API (Byte Code    Engineering Library), formerly known as JavaClass, is a toolkit    for the static analysis and dynamic creation or transformation of    Java class files. It enables developers to implement the desired    features on a high level of abstraction without handling all the    internal details of the Java class file format and thus    re-inventing the wheel every time. <font face="helvetica,arial">BCEL    </font> is written entirely in Java and freely available under the    terms of the <a href="license.html">Apache Software License</a>.  </p>                                                <p>    This manual is structured as follows: We give a brief description    of the Java Virtual Machine and the class file format in <a href="#2 The Java Virtual Machine">section 2</a>. <a href="#3 The     BCEL API">Section 3</a> introduces the <font face="helvetica,arial">BCEL</font> API. <a href="#4 Application     areas">Section 4</a> describes some typical application areas and    example projects. The appendix contains code examples that are to    long to be presented in the main part of this paper. All examples    are included in the down-loadable distribution.  </p>                            </blockquote>        </p>      </td></tr>      <tr><td><br/></td></tr>    </table>                                                <table border="0" cellspacing="0" cellpadding="2" width="100%">      <tr><td bgcolor="#525D76">        <font color="#ffffff" face="arial,helvetica,sanserif">          <a name="2 The Java Virtual Machine"><strong>2 The Java Virtual Machine</strong></a>        </font>      </td></tr>      <tr><td>        <blockquote>                                    <p>    Readers already familiar with the Java Virtual Machine and the    Java class file format may want to skip this section and proceed    with <a href="#3 The BCEL API">section 3</a>.  </p>                                                <p>    Programs written in the Java language are compiled into a portable    binary format called <em>byte code</em>. Every class is    represented by a single class file containing class related data    and byte code instructions. These files are loaded dynamically    into an interpreter (<a href="http://java.sun.com/docs/books/vmspec/index.html">Java    Virtual Machine</a>, aka. JVM) and executed.  </p>                                                <p>    <a href="#Figure 1">Figure 1</a> illustrates the procedure of    compiling and executing a Java class: The source file    (<tt>HelloWorld.java</tt>) is compiled into a Java class file    (<tt>HelloWorld.class</tt>), loaded by the byte code interpreter    and executed. In order to implement additional features,    researchers may want to transform class files (drawn with bold    lines) before they get actually executed. This application area    is one of the main issues of this article.  </p>                                                <p align="center">  <a name="Figure 1">  <img src="images/jvm.gif" />  <br />  Figure 1: Compilation and execution of Java classes</a>  </p>                                                <p>    Note that the use of the general term "Java" implies in fact two    meanings: on the one hand, Java as a programming language, on the    other hand, the Java Virtual Machine, which is not necessarily    targeted by the Java language exclusively, but may be used by <a href="http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html">other    languages</a> as well. We assume the reader to be familiar with    the Java language and to have a general understanding of the    Virtual Machine.  </p>                            </blockquote>        </p>      </td></tr>      <tr><td><br/></td></tr>    </table>                                                <table border="0" cellspacing="0" cellpadding="2" width="100%">      <tr><td bgcolor="#525D76">        <font color="#ffffff" face="arial,helvetica,sanserif">          <a name="2.1 Java class file format"><strong>2.1 Java class file format</strong></a>        </font>      </td></tr>      <tr><td>        <blockquote>                                    <p>    Giving a full overview of the design issues of the Java class file    format and the associated byte code instructions is beyond the    scope of this paper. We will just give a brief introduction    covering the details that are necessary for understanding the rest    of this paper. The format of class files and the byte code    instruction set are described in more detail in the <a href="http://java.sun.com/docs/books/vmspec/index.html">Java    Virtual Machine Specification</a>. Especially, we will not deal    with the security constraints that the Java Virtual Machine has to    check at run-time, i.e. the byte code verifier.  </p>                                                <p>    <a href="#Figure 2">Figure 2</a> shows a simplified example of the    contents of a Java class file: It starts with a header containing    a "magic number" (<tt>0xCAFEBABE</tt>) and the version number,    followed by the <em>constant pool</em>, which can be roughly    thought of as the text segment of an executable, the <em>access    rights</em> of the class encoded by a bit mask, a list of    interfaces implemented by the class, lists containing the fields    and methods of the class, and finally the <em>class    attributes</em>, e.g.,  the <tt>SourceFile</tt> attribute telling    the name of the source file. Attributes are a way of putting    additional, user-defined information into class file data    structures. For example, a custom class loader may evaluate such    attribute data in order to perform its transformations. The JVM    specification declares that unknown, i.e., user-defined attributes    must be ignored by any Virtual Machine implementation.  </p>                                                <p align="center">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -