- 浏览: 352360 次
- 性别:
- 来自: 南京
博客专栏
-
设计模式那些事儿
浏览量:5772
文章分类
- 全部博客 (85)
- news (3)
- java面试题 (3)
- java基础 (2)
- 英语短文 (2)
- 英语演讲 (2)
- Weekly Address (5)
- 英语写作 (2)
- 转载 (1)
- 2010 FIFA World Cup (5)
- Scrum (1)
- 计算机基础 (2)
- java引用对象 (1)
- 英语阅读 (1)
- Ext (6)
- Javascript (3)
- Web编程 (4)
- 战国策 (7)
- html (1)
- java (33)
- concurrency (1)
- jvm (31)
- 方法区 (9)
- 栈 (5)
- 堆 (1)
- 程序计数器 (1)
- 本地方法栈 (1)
- class file (5)
- 常量池 (2)
- attributes (1)
- 连接模型 (1)
- applet (1)
- gc (5)
- 垃圾收集 (5)
- 方法调用 (2)
- IBM (0)
- 门户(Portal) (0)
- Solr (1)
- Lucene (1)
- 全文检索 (1)
- 设计模式 (4)
- 责任链模式 (1)
- 责任链 (1)
- COR (1)
- Pattern (1)
最新评论
-
Nabulio:
是不错的
Java的Integer与int互转 -
shihengli2010:
学习了 !Integer i = 100; Integer ...
Java的Integer与int互转 -
flex涵:
还可以,差不多就是这个意思.
Java的Integer与int互转 -
lijingshou:
相当好用。。。
输入年月日格式yyyyMMdd,判断是否是周末 -
denverj:
你好,是这本书的英文版,名字叫<Inside the J ...
JVM学习笔记-帧数据区(Frame Data)
Methods
Each method declared in a class or interface or generated by the compiler is described in the class file by a method_info table. The two types of compiler-generated methods that may appear in class files are instance initialization methods (named <init) and class initialization methods (named <clinit). For more information on the compiler-generated methods, see Chapter 7, "The Lifetime of a Class." The format of the method_info table is shown in Table 6-22.
在class文件中,每个在类和接口中声明的方法,或者由编译器产生的方法,都由一个可变长度的method_info表来描述。同一个类中不能存在两个名字及描述符完全相同的方法。需要注意的是,在java程序设计语言中,尽管在同一个类或者接口中声明的两个方法不能有同样的特征签名(除返回类型之外的描述符),但在同一个class文件中,两个方法可以拥有同样的特征签名,前提是它们的返回值不能相同。换句话说:在Java源文件的同一个类里,如果声明了两个具有相同名字和相同参数类型、但返回值不同的方法,这个程序将无法编译通过。在Java程序设计语言中,不能仅仅通过返回值的不同来重载方法。但是同样的两个方法可以和谐地在一个class文件中共存。
有可能在class文件中出现的两种编译器产生的方法是:实例初始化(名为<init>)和类与接口初始化方法(名为<clinit>)。Method_info表的格式如表6-22所示。
Table 6-22. Format of a method_info table
Type | Name | Count |
u2 | access_flags | 1 |
u2 | name_index | 1 |
u2 | descriptor_index | 1 |
u2 | attributes_count | 1 |
attribute_info | attributes | attributes_count |
Method_info表中各项如下:
access_flags
The modifiers used in declaring the method are placed into the methodís access_flags item. Table 6-23 shows the bits used by each flag.
在声明方法时使用的修饰符存放在方法的access_flags项中,表6-23列出了各个标志所使用的位。1.2版本中加进了ACC_STRICT标志,它指明方法中的所有表达式都必须使用FP-strict模式进行计算。
Table 6-23. Flags in the access_flags item of method_info tables
Flag Name | Value | Meaning if Set | Set By |
ACC_PUBLIC | 0x0001 | Method is public | Classes and all methods of interfaces |
ACC_PRIVATE | 0x0002 | Method is private | Classes only |
ACC_PROTECTED | 0x0004 | Method is protected | Classes only |
ACC_STATIC | 0x0008 | Method is static | Classes only |
ACC_FINAL | 0x0010 | Method is final | Classes only |
ACC_SYNCHRONIZED | 0x0020 | Method is synchronized | Classes only |
ACC_NATIVE | 0x0100 | Method is native | Classes only |
ACC_ABSTRACT | 0x0400 | Method is abstract | Classes and all methods of interfaces |
For methods declared in a class (not an interface), at most one of ACC_PUBLIC, ACC_PRIVATE, and ACC_PROTECTED may be set. If a methodís ACC_FINAL flag is set, then its ACC_SYNCHRONIZED, ACC_NATIVE, and ACC_ABSTRACT flags must not be set. If a methodís ACC_PRIVATE or ACC_STATIC flag is set, then its ACC_ABSTRACT flag must not be set. All methods declared in interfaces must have their ACC_PUBLIC and ACC_ABSTRACT flags set.
类(不包括接口)中声明的方法只能拥有ACC_PUBLIC、ACC_PRIVATE、ACC_PROTECTED这三个标志中的一个。如果设定了一个方法的ACC_ABSTRACT标志,那么它的ACC_PRIVATE、ACC_STATIC、ACC_FINAL、ACC_SYNCHRONIZED、ACC_NATIVE以及ACC_STRICT标志都必须清除。接口中声明的所有方法必须有ACC_PUBLIC和ACC_ABSTRACT标志,除此以外接口方法不能使用其他标志,但接口初始化方法(<clinit>)可以使用ACC_STRICT标志。
Instance initialization (<init) methods may only use flags ACC_PUBLIC, ACC_PRIVATE, and ACC_PROTECTED. Because class initialization (<clinit) methods are invoked by the Java Virtual Machine, never directly by Java bytecodes, the the access_flags for <clinit methods is ignored.
实例初始化方法(<init>)可以只使用ACC_PUBLIC、ACC_PRIVATE和ACC_PROTECTED标志。因为类与接口初始化方法(<clinit>)只由Java虚拟机直接调用,永远不会被Java字节码直接调用,这样,<clinit>方法的access_flags中的标志位,除去ACC_STRICT之外的所有位都应该被忽略。
All unused bits in access_flags must be set to zero and ignored by Java Virtual Machine implementations.
在access_flags中未用到的位都被设为0,Java虚拟机实现也将忽略它们。
name_index
The name_index gives the index of a CONSTANT_Utf8_info entry that gives the simple (not fully qualified) name of the method.
Name_index项提供了CONSTANT_Utf8_info入口的索引,该入口给出了方法的简单名称(不是全限定名)。在class文件中的每一个方法的名称,都必须或者未<init>,或者为<clinit>,或者是Java程序设计语言中有效的方法名称(简单名称,不是全限定名)。
descriptor_index
The descriptor_index gives the index of a CONSTANT_Utf8_info entry that gives the descriptor of the method.
Descriptor_index提供了CONSTANT_Utf8_info入口的索引,该入口给出了方法的描述符。
attributes_count and attributes
The attributes item is a list of attribute_info tables. The attributes_count indicates the number of attribute_info tables in the list. Three kinds of attributes that are defined by the Java Virtual Machine specification that may appear in this item are Code, Exceptions, and Synthetic. These three attributes are described in detail later in this chapter.
Attributes项是由多个attribute_info表组成的列表。Attribute_count给出了列表中attribute_info表的数量。一个字段在其列表中可以有任意数量的属性。在此项中可能会出现的由Java虚拟机规范定义的四种属性是:Code、Deprecated、Exceptions和Synthetic。这四种属性将在本章后面进一步阐述。Java虚拟机只需要识别Code和Exception属性。虚拟机实现必须忽略任何无法识别的属性。
发表评论
-
java书籍
2011-12-15 15:31 0线程 Java Concurrency in Pra ... -
JVM学习笔记-本地方法调用(Invoking a Native Method)
2011-11-25 11:56 1158Invoking a Native Method ... -
JVM学习笔记-调用Java方法(Invoking a Java Method)
2011-11-25 11:35 1513Invoking a Java Method As m ... -
JVM学习笔记-分代收集器(Generational Collectors)
2011-11-23 14:41 1923Generational Collectors ... -
JVM学习笔记-拷贝收集器(Copying Collectors)
2011-11-22 16:34 1603Copying Collectors Copy ... -
JVM学习笔记-压缩收集器(Compacting Collectors)
2011-11-22 16:17 1324Compacting Collectors G ... -
JVM学习笔记-跟踪收集器(Tracing Collectors)
2011-11-22 16:04 1910Tracing Collectors Trac ... -
JVM学习笔记-引用计数收集器(Reference Counting Collectors)
2011-11-22 15:46 2490Reference Counting Collect ... -
applet notinited的解决方案
2011-11-13 14:45 4519最近项目当中正好使用到了applet,这个很少接触过的东东。 ... -
JVM学习笔记-动态连接和解析(Dynamic Linking and Resolution)
2011-11-08 11:09 3436When you compile a Java pro ... -
JVM学习笔记-属性格式(Attributes Types)
2011-11-07 12:15 1483Attributes The Java Vir ... -
JVM学习笔记-属性(Attributes)
2011-11-07 12:03 1514Attributes As mentioned ... -
JVM学习笔记-字段(Fields)
2011-11-07 11:17 1909Each field (class variable a ... -
JVM学习笔记-特殊字符串(Special Strings)
2011-11-05 14:33 1668Special Strings 特殊字符串 T ... -
JVM学习笔记-Class文件(Class File)
2011-11-05 14:39 1591What is a Java Class Fi ... -
JVM学习笔记-本地方法栈(Native Method Stacks)
2011-11-02 10:16 19183本地方法栈(Native Me ... -
JVM学习笔记-帧数据区(Frame Data)
2011-10-28 09:16 1720In addition to the local var ... -
JVM学习笔记-操作数栈(Operand Stack)
2011-10-27 11:12 14084Like the local variables, th ... -
JVM学习笔记-局部变量区(Local Variables)
2011-10-27 10:42 2993The local variables secti ... -
JVM学习笔记-栈帧(The Stack Frame)
2011-10-27 10:35 2518The stack frame has three pa ...
相关推荐
jvm 调优笔记-jvm
Moonbox(月光宝盒)是JVM-Sandbox生态下的,基于jvm-sandbox-repeater重新开发的一款流量回放平台产品。在jvm-sandbox-repeater基础上提供了更加丰富功能,同时便于线上部署和使用,更多对比参考。 使用场景 你...
nginx-upstream-jvm-route 支持nginx版本1.15 解决nginx: [emerg] invalid parameter "srun_id=tomcat1" 问题
赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...
JVM调优总结 -Xms -Xmx -Xmn -Xss
代码如下:failed to create jvm error code -4 这一般应是内存不够用所致,解决方法参考如下。 打开 Android Studio 安装目录下的bin目录,查找并打开文件 studio.exe.vmoptions,修改代码: 代码如下:-Xmx512m 为...
赠送jar包:metrics-jvm-3.1.5.jar; 赠送原API文档:metrics-jvm-3.1.5-javadoc.jar; 赠送源代码:metrics-jvm-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-jvm-3.1.5.pom; 包含翻译后的API文档:...
JVM性学习笔记-基本原理,内存模型,JVM参数设置,类加载器原理,JDK自带工具
jvm-full-gc调优-jvm-full-gc
nginx-upstream-jvm-route-0.1.tar.gz 用来实现Nginx Tomcat 集群session复制的问题!
mini-jvm in rust实现jvm,jvm-rs-main.zip
JVM调优总结 -Xms -Xmx -Xmn -Xss JVM调优总结 -Xms -Xmx -Xmn -Xss
安装方法(进入Nginx源码目录): #patch -p0 < /path/to/this/directory/jvm_route.patch # ./configure --prefix=/usr/nginx-0.8.1 --with-http_stub_status_module --add-module=/path/to/this/directory/ #...
JVM,MIB,可通过SNMP协议监控JVM运行情况
一份JVM学习的笔记,含查看JVM运行时信息\JVM垃圾收集信息\JVM锁信息等
JVM规范--高手总结 Java相关 1 1.1Java定义 1 1.2Java的开发流程 1 1.3Java运行的原理 2 1.4半编译半解释 3 1.5平台无关性 4 JVM内存模型 4 2.1 JVM规范 5 2.2 Sun JVM 8 2.3 SUN JVM内存管理(优化) 10 2.4 SUN JVM...
Java分布式应用学习笔记-谈JVM
jvm性能调优-jvm内存模型和优化-performance-jvm-memorymodel-optimize
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
jvm调优学习-optimizeJVM