java 기초 지식:KVM 의 상수 탱크

http://www.knowsky.com/362058.html
 
 class   ,“   ”             。

    
    
Java          ,          ,                     ( int、long  )    ( String   )     ,                 ,  :

         ;

         ;

         。

 C   ,                ,    ,         (             )       ,    ,           ;

  Java       ,       。   ,                          ,   class    ,              ,      ,                      。

  , Java      “  ”  ,class    “  ”     ,       class        ,       ,     “   ”。

      “    ”  ,              ,      “     ” “     ”。

              ,       11   ,   :

      

 

  

CONSTANT_Utf8

1

UTF-8   Unicode   

CONSTANT_Integer

3

int   

CONSTANT_Float

4

Float   

CONSTANT_Long

5

Long   

CONSTANT_Double

6

double   

CONSTANT_Class

7

   class     

CONSTANT_String

8

String   

CONSTANT_Fieldref

9

          

CONSTANT_Methodref

10

           

CONSTANT_InterfaceMedthodref

11

            

CONSTANT_NameAndType

12

           

                  ,                 。

    kvm             。

 

    :

 KVM    kvm/vmcommon/h/pool.h ,             :

Word-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> 
#define CONSTANT_Utf8                       1
#define CONSTANT_Integer                    3
#define CONSTANT_Float                      4
#define CONSTANT_Long                       5
#define CONSTANT_Double                     6
#define CONSTANT_Class                      7
#define CONSTANT_String                     8
#define CONSTANT_Fieldref                   9
#define CONSTANT_Methodref                  10
#define CONSTANT_InterfaceMethodref    11
#define CONSTANT_NameAndType            12
             : 
union constantPoolEntryStrUCt {
    struct { 
        unsigned short classIndex;
        unsigned short nameTypeIndex;
    }               method;  /* Also used by Fields */
    CLASS           clazz;
    INTERNED_STRING_INSTANCE String;
    cell           *cache;   /* Either clazz or String */
    cell            integer;
    long            length;
    NameTypeKey     nameTypeKey;
    NameKey         nameKey;
    UString         ustring;
};
class   ,         ,             ,               ,           ,        ,  KVM   union        ,union                   ,             ,      。

  ,               ,           ?         

    :http://www.knowsky.com/362058.html

좋은 웹페이지 즐겨찾기