-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
287 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
keyword | ||
======= | ||
=============================== | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
lang | ||
======= | ||
=============================== | ||
`java.lang` | ||
|
||
.. toctree:: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
util | ||
======= | ||
=============================== | ||
`java.util` | ||
|
||
.. toctree:: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
JVM Specification | ||
=============================== | ||
Java Virtual Machine Specification | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
:numbered: 0 | ||
|
||
jvms4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Chapter 4. The class File Format | ||
|
||
## 4.1. The ClassFile Structure | ||
``` | ||
ClassFile { | ||
u4 magic; | ||
u2 minor_version; | ||
u2 major_version; | ||
u2 constant_pool_count; | ||
cp_info constant_pool[constant_pool_count-1]; | ||
u2 access_flags; | ||
u2 this_class; | ||
u2 super_class; | ||
u2 interfaces_count; | ||
u2 interfaces[interfaces_count]; | ||
u2 fields_count; | ||
field_info fields[fields_count]; | ||
u2 methods_count; | ||
method_info methods[methods_count]; | ||
u2 attributes_count; | ||
attribute_info attributes[attributes_count]; | ||
} | ||
``` | ||
|
||
## 4.3. Descriptors | ||
|
||
### 4.3.2. Field Descriptors | ||
|
||
FieldType term | Type | Interpretation | ||
---|---|--- | ||
`B` | `byte` | signed byte | ||
`C` | `char` | Unicode character code point in the Basic Multilingual Plane, encoded with UTF-16 | ||
`D` | `double` | double-precision floating-point value | ||
`F` | `float` | single-precision floating-point value | ||
`I` | `int` | integer | ||
`J` | `long` | long integer | ||
`L` ClassName ; | `reference` | an instance of class ClassName | ||
`S` | `short` | signed short | ||
`Z` | `boolean` | `true` or `false` | ||
`[` | `reference` | one array dimension | ||
|
||
## 4.4. The Constant Pool | ||
``` | ||
cp_info { | ||
u1 tag; | ||
u1 info[]; | ||
} | ||
``` | ||
|
||
Constant Type | Value | ||
---|--- | ||
`CONSTANT_Class` | 7 | ||
`CONSTANT_Fieldref` | 9 | ||
`CONSTANT_Methodref` | 10 | ||
`CONSTANT_InterfaceMethodref` | 11 | ||
`CONSTANT_String` | 8 | ||
`CONSTANT_Integer` | 3 | ||
`CONSTANT_Float` | 4 | ||
`CONSTANT_Long` | 5 | ||
`CONSTANT_Double` | 6 | ||
`CONSTANT_NameAndType` | 12 | ||
`CONSTANT_Utf8` | 1 | ||
`CONSTANT_MethodHandle` | 15 | ||
`CONSTANT_MethodType` | 16 | ||
`CONSTANT_InvokeDynamic` | 18 | ||
|
||
## 4.5. Fields | ||
``` | ||
field_info { | ||
u2 access_flags; | ||
u2 name_index; | ||
u2 descriptor_index; | ||
u2 attributes_count; | ||
attribute_info attributes[attributes_count]; | ||
} | ||
``` | ||
|
||
Flag Name | Value | Interpretation | ||
---|---|--- | ||
`ACC_PUBLIC` | 0x0001 | Declared `public`; may be accessed from outside its package. | ||
`ACC_PRIVATE` | 0x0002 | Declared `private`; usable only within the defining class. | ||
`ACC_PROTECTED` | 0x0004 | Declared `protected`; may be accessed within subclasses. | ||
`ACC_STATIC` | 0x0008 | Declared `static`. | ||
`ACC_FINAL` | 0x0010 | Declared `final`; never directly assigned to after object construction (JLS §17.5). | ||
`ACC_VOLATILE` | 0x0040 | Declared `volatile`; cannot be cached. | ||
`ACC_TRANSIENT` | 0x0080 | Declared `transient`; not written or read by a persistent object manager. | ||
`ACC_SYNTHETIC` | 0x1000 | Declared synthetic; not present in the source code. | ||
`ACC_ENUM` | 0x4000 | Declared as an element of an `enum`. | ||
|
||
## 4.6. Methods | ||
``` | ||
method_info { | ||
u2 access_flags; | ||
u2 name_index; | ||
u2 descriptor_index; | ||
u2 attributes_count; | ||
attribute_info attributes[attributes_count]; | ||
} | ||
``` | ||
|
||
Flag Name | Value | Interpretation | ||
---|---|--- | ||
`ACC_PUBLIC` | 0x0001 | Declared `public`; may be accessed from outside its package. | ||
`ACC_PRIVATE` | 0x0002 | Declared `private`; accessible only within the defining class. | ||
`ACC_PROTECTED` | 0x0004 | Declared `protected`; may be accessed within subclasses. | ||
`ACC_STATIC` | 0x0008 | Declared `static`. | ||
`ACC_FINAL` | 0x0010 | Declared `final`; must not be overridden (§5.4.5). | ||
`ACC_SYNCHRONIZED` | 0x0020 | Declared `synchronized`; invocation is wrapped by a monitor use. | ||
`ACC_BRIDGE` | 0x0040 | A bridge method, generated by the compiler. | ||
`ACC_VARARGS` | 0x0080 | Declared with variable number of arguments. | ||
`ACC_NATIVE` | 0x0100 | Declared `native`; implemented in a language other than Java. | ||
`ACC_ABSTRACT` | 0x0400 | Declared `abstract`; no implementation is provided. | ||
`ACC_STRICT` | 0x0800 | Declared `strictfp`; floating-point mode is FP-strict. | ||
`ACC_SYNTHETIC` | 0x1000 | Declared synthetic; not present in the source code. | ||
|
||
## 4.7. Attributes | ||
``` | ||
attribute_info { | ||
u2 attribute_name_index; | ||
u4 attribute_length; | ||
u1 info[attribute_length]; | ||
} | ||
``` | ||
|
||
## References | ||
- [Chapter 4. The class File Format](https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
深入理解Java虚拟机 | ||
=============================== | ||
深入理解Java虚拟机:JVM高级特性与最佳实践 | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
:numbered: 0 | ||
|
||
UnderstandingTheJvm | ||
UnderstandingTheJvm02 | ||
UnderstandingTheJvm03 | ||
UnderstandingTheJvm04 | ||
UnderstandingTheJvm05 | ||
UnderstandingTheJvm06 | ||
UnderstandingTheJvm07 | ||
UnderstandingTheJvm08 | ||
UnderstandingTheJvm09 | ||
UnderstandingTheJvm10 | ||
UnderstandingTheJvm11 | ||
UnderstandingTheJvm12 | ||
UnderstandingTheJvm13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package t5750.util; | ||
|
||
import java.io.FileOutputStream; | ||
|
||
public class FileUtil { | ||
public static void write(byte[] b, String name) { | ||
try { | ||
FileOutputStream out = new FileOutputStream(name); | ||
out.write(b); | ||
out.close(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package t5750.util; | ||
|
||
public class Global { | ||
public static final String T5750 = "t5750"; | ||
/** | ||
* Javassist separator | ||
*/ | ||
public static final String JAVASSIST_SEPARATOR = "/"; | ||
public static final String POINT = "java.awt.Point"; | ||
public static final String PATH_POINT = POINT.replace(".", | ||
Global.JAVASSIST_SEPARATOR); | ||
public static final String INTEGER = "java.lang.Integer"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.