锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲爱情岛论坛永久,亚洲乱码一区二区三区国产精品,色窝窝亚洲av网http://blogjava.net/DLevin/category/51678.htmlIn general the OO style is to use a lot of little objects with a lot of little methods that give us a lot of plug points for overriding and variation. To do is to be -Nietzsche, To bei is to do -Kant, Do be do be do -Sinatrazh-cnThu, 13 Aug 2015 10:50:28 GMTThu, 13 Aug 2015 10:50:28 GMT60娣卞叆perf4j婧愮爜http://www.tkk7.com/DLevin/archive/2015/04/19/424527.htmlDLevinDLevinSun, 19 Apr 2015 05:35:00 GMThttp://www.tkk7.com/DLevin/archive/2015/04/19/424527.htmlhttp://www.tkk7.com/DLevin/comments/424527.htmlhttp://www.tkk7.com/DLevin/archive/2015/04/19/424527.html#Feedback1http://www.tkk7.com/DLevin/comments/commentRss/424527.htmlhttp://www.tkk7.com/DLevin/services/trackbacks/424527.html闃呰鍏ㄦ枃

DLevin 2015-04-19 13:35 鍙戣〃璇勮
]]>
娣卞叆ASM婧愮爜涔婥lassReader銆丆lassVisitor銆丆lassWriterhttp://www.tkk7.com/DLevin/archive/2014/06/25/414292.htmlDLevinDLevinWed, 25 Jun 2014 13:14:00 GMThttp://www.tkk7.com/DLevin/archive/2014/06/25/414292.htmlhttp://www.tkk7.com/DLevin/comments/414292.htmlhttp://www.tkk7.com/DLevin/archive/2014/06/25/414292.html#Feedback1http://www.tkk7.com/DLevin/comments/commentRss/414292.htmlhttp://www.tkk7.com/DLevin/services/trackbacks/414292.html姒傝堪ASM鏄?Java涓瘮杈冩祦琛岀殑鐢ㄦ潵璇誨啓瀛楄妭鐮佺殑綾誨簱錛岀敤鏉ュ熀浜庡瓧鑺傜爜灞傞潰瀵逛唬鐮佽繘琛屽垎鏋愬拰杞崲銆傚湪璇誨啓鐨勮繃紼嬩腑鍙互鍔犲叆鑷畾涔夌殑閫昏緫浠ュ寮烘垨淇敼鍘熸潵宸茬紪璇戝ソ鐨勫瓧鑺傜爜錛屾瘮濡侰GLIB鐢ㄥ畠鏉ュ疄鐜板姩鎬佷唬鐞嗐侫SM琚璁$敤浜庡湪榪愯鏃跺Java綾昏繘琛岀敓鎴愬拰杞崲錛屽綋鐒朵篃鍖呮嫭紱葷嚎澶勭悊銆侫SM鐭皬綺炬倣銆佷笖閫熷害寰堝揩錛屼粠鑰岄伩鍏嶅湪榪愯鏃跺姩鎬佺敓鎴愬瓧鑺傜爜鎴栬漿鎹㈡椂瀵圭▼搴忛熷害鐨勫獎鍝嶏紝鍙堝洜涓哄畠浣撶Н灝忓閥錛屽彲浠ュ湪寰堝鍐呭瓨鍙楅檺鐨勭幆澧冧腑浣跨敤銆?br />ASM鐨勪富瑕佷紭鍔垮寘鎷涓嬪嚑涓柟闈細
1. 瀹冨張涓涓緢灝忥紝浣嗚璁¤壇濂藉茍涓旀ā鍧楀寲鐨凙PI錛屼笖鏄撲簬浣跨敤銆?br />2. 瀹冨叿鏈夊緢濂界殑鏂囨。錛屽茍涓旇繕鏈塭clipse鎻掍歡銆?br />3. 瀹冩敮鎸佹渶鏂扮殑Java鐗堟湰銆?br />4. 瀹冪煭灝忕簿鎮嶃佸揩閫熴佸仴澹?br />5. 瀹冨張涓涓緢澶х殑鐢ㄦ埛紺懼尯錛屽彲浠ョ粰鏂扮敤鎴鋒彁渚涙敮鎸併?br />6. 瀹冪殑寮婧愯鍙厑璁鎬綘鍑犱箮浠ヤ換浣曟柟寮忔潵浣跨敤瀹冦?br />
鍏充簬ASM鐨勮緇嗘枃妗e彲浠ュ弬鑰冿細ASM 3.0錛欽ava瀛楄妭鐮佸紩鎿庡簱錛屽啓鐨勫緢璇︾粏鐨勪竴涓枃妗c?br />

ASM Core璁捐涓瑙?/span>

鍦ˋSM鐨勬牳蹇冨疄鐜頒腑錛屽畠涓昏鏈変互涓嬪嚑涓被銆佹帴鍙o紙鍦╫rg.objectweb.asm鍖呬腑錛夛細
ClassReader綾伙細瀛楄妭鐮佺殑璇誨彇涓庡垎鏋愬紩鎿庛傚畠閲囩敤綾諱技SAX鐨勪簨浠惰鍙栨満鍒訛紝姣忓綋鏈変簨浠跺彂鐢熸椂錛岃皟鐢ㄦ敞鍐岀殑ClassVisitor銆丄nnotationVisitor銆丗ieldVisitor銆丮ethodVisitor鍋氱浉搴旂殑澶勭悊銆?br />ClassVisitor鎺ュ彛錛氬畾涔夊湪璇誨彇Class瀛楄妭鐮佹椂浼氳Е鍙戠殑浜嬩歡錛屽綾誨ご瑙f瀽瀹屾垚銆佹敞瑙hВ鏋愩佸瓧孌佃В鏋愩佹柟娉曡В鏋愮瓑銆?br />AnnotationVisitor鎺ュ彛錛氬畾涔夊湪瑙f瀽娉ㄨВ鏃朵細瑙﹀彂鐨勪簨浠訛紝濡傝В鏋愬埌涓涓熀鏈肩被鍨嬬殑娉ㄨВ銆乪num鍊肩被鍨嬬殑娉ㄨВ銆丄rray鍊肩被鍨嬬殑娉ㄨВ銆佹敞瑙e肩被鍨嬬殑娉ㄨВ絳夈?br />FieldVisitor鎺ュ彛錛氬畾涔夊湪瑙f瀽瀛楁鏃惰Е鍙戠殑浜嬩歡錛屽瑙f瀽鍒板瓧孌典笂鐨勬敞瑙c佽В鏋愬埌瀛楁鐩稿叧鐨勫睘鎬х瓑銆?br />MethodVisitor鎺ュ彛錛氬畾涔夊湪瑙f瀽鏂規硶鏃惰Е鍙戠殑浜嬩歡錛屽鏂規硶涓婄殑娉ㄨВ銆佸睘鎬с佷唬鐮佺瓑銆?br />
ClassWriter綾伙細瀹冨疄鐜頒簡ClassVisitor鎺ュ彛錛岀敤浜庢嫾鎺ュ瓧鑺傜爜銆?br />AnnotationWriter綾伙細瀹冨疄鐜頒簡AnnotationVisitor鎺ュ彛錛岀敤浜庢嫾鎺ユ敞瑙g浉鍏沖瓧鑺傜爜銆?br />FieldWriter綾伙細瀹冨疄鐜頒簡FieldVisitor鎺ュ彛錛岀敤浜庢嫾鎺ュ瓧孌電浉鍏沖瓧鑺傜爜銆?br />MethodWriter綾伙細瀹冨疄鐜頒簡MethodVisitor鎺ュ彛錛岀敤浜庢嫾鎺ユ柟娉曠浉鍏沖瓧鑺傜爜銆?br />
SignatureReader綾伙細瀵圭被瀹氫箟銆佸瓧孌靛畾涔夈佹柟娉曞畾涔夈?鏈湴鍙橀噺瀹氫箟鐨勭鍚嶇殑瑙f瀽銆係ignature鍥犺寖鍨嬪紩鍏ワ紝鐢ㄤ簬瀛樺偍鑼冨瀷瀹氫箟鏃剁殑鍏冩暟鎹紙鍥犱負榪欎簺鍏冩暟鎹湪榪愯鏃朵細琚摝闄わ級銆?br />SignatureVisitor鎺ュ彛錛氬畾涔夊湪瑙f瀽Signature鏃朵細瑙﹀彂鐨勪簨浠訛紝濡?姝e父鐨凾ype鍙傛暟銆佺被鎴栨帴鍙g殑杈圭晫絳夈?br />SignatureWriter綾伙細瀹冨疄鐜頒簡SignatureVisitor鎺ュ彛錛岀敤浜庢嫾鎺ヨ寖鍨嬬浉鍏沖瓧鑺傜爜銆?br />
Attribute綾伙細瀛楄妭鐮佷腑灞炴х殑綾繪娊璞°?br />ByteVector綾伙細瀛楄妭鐮佷簩榪涘埗瀛樺偍鐨勫鍣ㄣ?br />Opcodes鎺ュ彛錛?瀛楄妭鐮佹寚浠ょ殑涓浜涘父閲忓畾涔夈?br />Type綾伙細綾誨瀷鐩稿叧鐨勫父閲忓畾涔変互鍙婁竴浜涘熀浜庡叾涓婄殑鎿嶄綔銆?br />
浠栦滑涔嬮棿鐨勭被鍥懼叧緋誨涓嬶細

ClassReader瀹炵幇

ClassReader鏄疉SM涓渶鏍稿績鐨勫疄鐜幫紝瀹冪敤浜庤鍙栧茍瑙f瀽Class瀛楄妭鐮併傜被瀛楄妭鐮佹牸寮忓彲浠ュ叿浣撳弬鑰冿細銆奐ava瀛楄妭鐮佹牸寮忚瑙?銆?/a>銆?a href="http://www.tkk7.com/DLevin/archive/2011/09/05/358034.html">銆奐ava瀛楄妭鐮佹牸寮忚瑙?銆?/a>銆?a href="http://www.tkk7.com/DLevin/archive/2011/09/05/358035.html">銆奐ava瀛楄妭鐮佹牸寮忚瑙?銆?/a>

鍦ㄦ瀯寤篊lassReader瀹炰緥鏃訛紝瀹冮鍏堜繚瀛樺瓧鑺傜爜浜岃繘鍒舵暟緇刡錛岀劧鍚庡垱寤篿tems鏁扮粍錛屾暟緇勭殑闀垮害鍦ㄥ瓧鑺傜爜鏁扮粍鐨勭8銆?涓瓧鑺傛寚瀹氾紙鏈鍓嶉潰4涓瓧鑺傛槸欖旀暟CAFEBABE錛屼箣鍚?涓瓧鑺傛槸嬈$増鏈彿錛屽啀鍚?涓瓧鑺傛槸涓葷増鏈彿錛夛紝姣忎釜item琛ㄧず甯擱噺姹犻」鍦ㄥ瓧鑺傜爜鏁扮粍鐨勫亸縐婚噺鍔?錛堝父閲忔睜涓瘡涓」鐢?涓瓧鑺傜殑type鍜岀揣璺熺殑瀛楄妭鏁扮粍琛ㄧず錛屽父閲忔睜欏規湁12縐嶇被鍨嬶紝鍏朵腑CONSTANT_FieldRef_Info銆丆ONSTANT_MethodRef_Info銆丆ONSTANT_InterfaceMethodRef_Info銆丆ONSTANT_NameAndType_Info鍖呮嫭鍏剁被鍨嬪瓧鑺傚崰鐢?涓瓧鑺傦紝鍙﹀4涓瓧鑺傛瘡2涓瓧鑺備負瀛楁銆佹柟娉曠瓑鎵鍦ㄧ殑綾匯佸叾鍚嶇О銆佹弿榪扮鍦ㄥ綋鍓嶅父閲忔睜涓瑿ONSTANT_Utf8_Info綾誨瀷鐨勫紩鐢紱CONSTANT_Integer_Info銆丆ONSTANT_Float_Info鍖呮嫭鍏剁被鍨嬪瓧鑺傚崰鐢?涓瓧鑺傦紝鍙﹀鍥涗釜瀛楄妭涓哄叾瀵瑰簲鐨勫鹼紱CONSTANT_Class_Info銆丆ONSTANT_String_Info鍖呮嫭鍏剁被鍨嬪瓧鑺傚崰鐢?涓瓧鑺傦紝鍙﹀涓や釜瀛楄妭涓哄湪褰撳墠甯擱噺姹燙ONSTANT_Utf8_Info欏圭殑绱㈠紩錛汣ONSTANT_Utf8_Info綾誨瀷絎?涓瓧鑺傝〃紺虹被鍨嬶紝絎?銆?涓瓧鑺備負璇ラ」鎵琛ㄧず鐨勫瓧絎︿覆鐨勯暱搴︼級錛汣ONSTANT_Double_Info銆丆ONSTANT_Long_Info鍔犵被鍨嬪瓧鑺備負9涓瓧錛沵axStringLength琛ㄧず鏈闀跨殑UTF8綾誨瀷鐨勫父閲忔睜欏圭殑鍊鹼紝鐢ㄤ簬鍐沖畾鍦ㄨВ鏋怌ONSTANT_Utf8_Info綾誨瀷欏規椂鏈澶ч渶瑕佺殑瀛楃鏁扮粍錛沨eader琛ㄧず甯擱噺姹犱箣鍚庣殑瀛楄妭鐮佺殑絎竴涓瓧鑺傘?br />
鍦ㄨ皟鐢–lassReader鐨刟ccept鏂規硶鏃訛紝瀹冭В鏋愬瓧鑺傜爜涓父閲忔睜涔嬪悗鐨勬墍鏈夊厓绱犮傜揣鎺ョ潃甯擱噺姹犵殑2涓瓧鑺傛槸璇ョ被鐨刟ccess鏍囩錛欰CC_PUBLIC銆丄CC_FINAL絳夛紱涔嬪悗2涓瓧鑺備負褰撳墠綾誨悕鍦ㄥ父閲忔睜CONSTANT_Utf8_Info綾誨瀷鐨勭儲寮曪紱涔嬪悗2涓瓧鑺備負鍏剁埗綾誨悕鍦ㄥ父閲忔睜CONSTANT_Utf8_Info綾誨瀷鐨勭儲寮曪紙绱㈠紩鍊?琛ㄧず鐖剁被涓簄ull錛屽嵆鐩存帴緇ф壙鑷狾bject綾伙級錛涘啀涔嬪悗涓哄叾瀹炵幇鐨勬帴鍙f暟闀垮害鍜屽搴斿悇涓帴鍙e悕鍦ㄥ父閲忔睜涓瑿ONSTANT_Utf8_Info綾誨瀷鐨勭儲寮曞鹼紱鏆傛椂鍏堣煩榪嘑ield鍜孧ethod瀹氫箟淇℃伅錛岃В鏋愮被鐨刟ttribute琛紝瀹冪敤涓や釜瀛楄妭琛ㄨ揪attribute鏁扮粍鐨勯暱搴︼紝姣忎釜attribute欏逛腑鏈鍓嶉潰2涓瓧鑺傛槸attribute鍚嶇О錛歋ourceFile錛堣鍙杝ourceFile鍊鹼級銆両nnerClasses錛堟殏鏃剁邯褰曡搗濮嬬儲寮曪級銆丒nclosingMethod錛堢邯褰曞綋鍓嶅尶鍚嶇被銆佹湰鍦扮被鍖呭惈鑰呯被鍚嶄互鍙婂寘鍚呯殑鏂規硶鍚嶅拰鎻忚堪絎︼級銆丼ignature錛堢被鐨勭鍚嶄俊鎭紝鐢ㄤ簬鑼冨瀷錛夈丷untimeVisibleAnnotations錛堟殏鏃剁邯褰曡搗濮嬬儲寮曪級銆丏eprecated錛堣〃璇嗗睘鎬э級銆丼ynthetic錛堟爣璇嗗睘鎬э級銆丼ourceDebugExtension錛堜負璋冭瘯鍣ㄦ彁渚涚殑鑷畾涔夋墿灞曚俊鎭紝璇誨彇鎴愪竴涓瓧絎︿覆錛夈丷untimeInvisibleAnnotations錛堟殏鏃剁邯褰曡搗濮嬬儲寮曪級錛屽鍏朵粬涓嶈瘑鍒殑灞炴э紝綰綍鎴怉ttribute閾撅紝濡傛灉attribute鍚嶇О絎﹀悎鍦╝ccept涓璦ttribute鏁扮粍涓寚瀹氱殑attribute鍚嶏紝鍒欐浛鎹紶鍏ョ殑attribute鏁扮粍瀵瑰簲鐨勯」錛涙牴鎹В鏋愬嚭鏉ョ殑淇℃伅璋冪敤浠ヤ笅visit鏂規硶錛?br />
void visit(int version, int access, String name, String signature, String superName, String[] interfaces);
// sourceFile, sourceDebug
void visitSource(String source, String debug);
// EnclosingMethod attribute: enclosingOwner, enclosingName, enclosingDesc. 
// Note: only when the class has EnclosingMethod attribute, meaning the class is a local class or an anonymous class
void visitOuterClass(String owner, String name, String desc);

渚濇瑙f瀽RuntimeVisibleAnnotations鍜孯untimeInvisibleAnnotations灞炴э紝棣栧厛瑙f瀽瀹氫箟鐨凙nnotation鐨勬弿榪扮浠ュ強榪愯鏃跺彲瑙乫lag錛岃繑鍥炵敤鎴瘋嚜瀹氫箟鐨凙nnotationVisitor錛?br />
AnnotationVisitor visitAnnotation(String desc, boolean visible);
瀵規瘡涓畾涔夌殑Annotation錛岃В鏋愬叾閿煎錛屽茍鏍規嵁涓嶅悓鐨凙nnotation瀛楁鍊艱皟鐢ˋnnotationVisitor涓殑鏂規硶錛屽湪鎵鏈夎В鏋愮粨鏉熷悗錛岃皟鐢ˋnnotationVisitor.visitEnd鏂規硶錛?br />
public interface AnnotationVisitor {
    // 瀵瑰熀鏈被鍨嬬殑鏁扮粍錛屼緷鐒墮噰鐢ㄨ鏂規硶錛寁isitArray鍙槸鍦ㄩ潪鍩烘湰綾誨瀷鏃惰皟鐢ㄣ?/span>
    void visit(String name, Object value);
    void visitEnum(String name, String desc, String value);
    AnnotationVisitor visitAnnotation(String name, String desc);
    AnnotationVisitor visitArray(String name);

    void visitEnd();
}

涔嬪墠瑙f瀽鍑虹殑attribute閾捐〃錛堥潪鏍囧噯鐨凙ttribute瀹氫箟錛夛紝瀵規瘡涓狝ttribute瀹炰緥錛岃皟鐢–lassVisitor涓殑visitAttribute鏂規硶錛?br />
void visitAttribute(Attribute attr);
Attribute綾誨寘鍚玹ype瀛楁鍜屼竴涓瓧鑺傛暟緇勶細
public class Attribute {
    public final String type;
    byte[] value;
    Attribute next;
}

瀵規瘡涓狪nnerClasses灞炴э紝瑙f瀽騫惰皟鐢–lassVisitor鐨剉isitInnerClass鏂規硶錛堣灞炴т簨瀹炰笂淇濆瓨浜嗘墍鏈夊叾鐩存帴鍐呴儴綾諱互鍙婂畠鏈韓鍒版渶欏跺眰綾葷殑璺緞錛夛細
void visitInnerClass(String name, String outerName, String innerName, int access);

瑙f瀽瀛楁錛屽畠绱ц窡鎺ュ彛鏁扮粍瀹氫箟涔嬪悗錛屾渶鍓嶉潰鐨?涓瓧鑺備負瀛楁鏁扮粍鐨勯暱搴︼紝瀵規瘡涓瓧孌碉紝鍓嶉潰2涓瓧鑺備負璁塊棶flag瀹氫箟錛屽啀鍚?涓瓧鑺備負Name绱㈠紩錛屼互鍙?涓瓧鑺傜殑鎻忚堪絎︾儲寮曪紝鐒跺悗瑙f瀽鍏禔ttribute淇℃伅錛欳onstantValue銆丼ignature銆丏eprecated銆丼ynthetic銆丷untimeVisibleAnnotations銆丷untimeInvisibleAnnotations浠ュ強闈炴爣鍑嗗畾涔夌殑Attribute閾撅紝鑰屽悗璋冪敤ClassVisitor鐨剉isitField鏂規硶錛岃繑鍥濬ieldVisitor瀹炰緥錛?br />
// 鍏朵腑value涓洪潤鎬佸瓧孌電殑鍒濆鍖栧鹼紙瀵歸潪闈欐佸瓧孌碉紝瀹冪殑鍒濆鍖栧繀欏葷敱鏋勯犲嚱鏁板疄鐜幫級錛屽鏋滄病鏈夊垵濮嬪寲鍊鹼紝璇ュ間負null銆?/span>
FieldVisitor visitField(int access, String name, String desc, String signature, Object value);
瀵硅繑鍥炵殑FieldVisitor渚濇瀵瑰叾Annotation浠ュ強闈炴爣鍑咥ttribute瑙f瀽錛岃皟鐢ㄥ叾visit鏂規硶錛屽茍鍦ㄥ畬鎴愬悗璋冪敤瀹冪殑visitEnd鏂規硶錛?br />
public interface FieldVisitor {
    AnnotationVisitor visitAnnotation(String desc, boolean visible);
    void visitAttribute(Attribute attr);
    void visitEnd();
}

瑙f瀽鏂規硶瀹氫箟錛屽畠绱ц窡瀛楁瀹氫箟涔嬪悗錛屾渶鍓嶉潰鐨?涓瓧鑺備負鏂規硶鏁扮粍闀垮害錛屽姣忎釜鏂規硶錛屽墠闈?涓瓧鑺備負璁塊棶flag瀹氫箟錛屽啀鍚?涓瓧鑺備負Name绱㈠紩錛屼互鍙?涓瓧鑺傜殑鏂規硶鎻忚堪絎︾儲寮曪紝鐒跺悗瑙f瀽鍏禔ttribute淇℃伅錛欳ode銆丒xceptions銆丼ignature銆丏eprecated銆丷untimeVisibleAnnotations銆丄nnotationDefault銆丼ynthetic銆丷untimeInvisibleAnnotations銆丷untimeVisibleParameterAnnotations銆丷untimeInvisibleParameterAnnotations浠ュ強闈炴爣鍑嗗畾涔夌殑Attribute閾撅紝濡傛灉瀛樺湪Exceptions灞炴э紝瑙f瀽鍏跺紓甯哥被鏁扮粍錛屼箣鍚庤皟鐢–lassVisitor鐨剉isitMethod鏂規硶錛岃繑鍥濵ethodVisitor瀹炰緥錛?br />
MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions);

AnnotationDefault涓哄Annotation瀹氫箟鏃舵寚瀹氶粯璁ゅ肩殑瑙f瀽錛涚劧鍚庝緷嬈¤В鏋怰untimeVisibleAnnotations銆丷untimeInvisibleAnnotations銆丷untimeVisibleParameterAnnotations銆丷untimeInvisibleParameterAnnotations絳夊睘鎬э紝璋冪敤鐩稿叧AnnotationVisitor鐨剉isit鏂規硶錛涘闈炴爣鍑嗗畾涔夌殑Attribute閾撅紝渚濇璋冪敤MethodVisitor鐨剉isitAttribute鏂規硶錛?br />
public interface MethodVisitor {
    AnnotationVisitor visitAnnotationDefault();
    AnnotationVisitor visitAnnotation(String desc, boolean visible);
    AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible);
    void visitAttribute(Attribute attr);
}

瀵笴ode灞炴цВ鏋愶紝璇誨彇2涓瓧鑺傜殑鏈娣辨爤澶у皬銆佹渶澶ocal鍙橀噺鏁般乧ode鍗犵敤瀛楄妭鏁幫紝璋冪敤MethodVisitor鐨剉isitCode()鏂規硶琛ㄧず寮濮嬭В鏋怌ode灞炴э紝瀵規瘡鏉℃寚浠わ紝鍒涘緩涓涓狶abel瀹炰緥騫舵瀯鎴怢abel鏁扮粍錛岃В鏋怌ode灞炴т腑鐨勫紓甯歌〃錛屽姣忎釜寮傚父欏癸紝璋冪敤visitTryCatchBlock鏂規硶錛?br />
void visitTryCatchBlock(Label start, Label end, Label handler, String type);
Label鍖呭惈浠ヤ笅淇℃伅錛?br />
/**
 * A label represents a position in the bytecode of a method. Labels are used
 * for jump, goto, and switch instructions, and for try catch blocks.
 * 
 * 
@author Eric Bruneton
 
*/
public class Label {
    public Object info;
    int status;
    int line;
    int position;
    private int referenceCount;
    private int[] srcAndRefPositions;
    int inputStackTop;
    int outputStackMax;
    Frame frame;
    Label successor;
    Edge successors;
    Label next;
}
瑙f瀽Code灞炴т腑鐨勫唴閮ㄥ睘鎬т俊鎭細LocalVariableTable銆丩ocalVariableTypeTable銆丩ineNumberTable銆丼tackMapTable銆丼tackMap浠ュ強闈炴爣鍑嗗畾涔夌殑Attribute閾撅紝瀵規瘡涓狶abel璋冪敤鍏秜isitLineNumber鏂規硶浠ュ強瀵規瘡涓狥rame璋冪敤visitFrame鏂規硶錛屽茍涓斿鐩稿簲鐨勬寚浠よ皟鐢ㄧ浉搴旂殑鏂規硶錛?br />
void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack);
// Visits a zero operand instruction.

void visitInsn(int opcode);
// Visits an instruction with a single int operand.
void visitIntInsn(int opcode, int operand);
// Visits a local variable instruction. A local variable instruction is an instruction that loads or stores the value of a local variable.
void visitVarInsn(int opcode, int var);
// Visits a type instruction. A type instruction is an instruction that takes the internal name of a class as parameter.
void visitTypeInsn(int opcode, String type);
// Visits a field instruction. A field instruction is an instruction that loads or stores the value of a field of an object.
void visitFieldInsn(int opcode, String owner, String name, String desc);
// Visits a method instruction. A method instruction is an instruction that invokes a method.
void visitMethodInsn(int opcode, String owner, String name, String desc);
// Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.
void visitJumpInsn(int opcode, Label label);
// Visits a label. A label designates the instruction that will be visited just after it.
void visitLabel(Label label);
// Visits a LDC instruction.
void visitLdcInsn(Object cst);
// Visits an IINC instruction.
void visitIincInsn(int var, int increment);
// Visits a TABLESWITCH instruction.
void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels);
// Visits a LOOKUPSWITCH instruction.
void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels);
// Visits a MULTIANEWARRAY instruction.
void visitMultiANewArrayInsn(String desc, int dims);
// Visits a try catch block.
void visitTryCatchBlock(Label start, Label end, Label handler, String type);
void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index);
// Visits a line number declaration.
void visitLineNumber(int line, Label start);
// Visits the maximum stack size and the maximum number of local variables of the method.
void visitMaxs(int maxStack, int maxLocals);


鏈鍚庤皟鐢–lassVisitor鐨剉isitEnd鏂規硶錛?br />
void visitEnd();

ClassWriter瀹炵幇

ClassWriter緇ф壙鑷狢lassVisitor鎺ュ彛錛屽彲浠ヤ嬌鐢ㄥ畠璋冪敤鍏剁浉搴旂殑visit鏂規硶鍔ㄦ佺殑鏋勯犱竴涓瓧鑺傜爜綾匯傚畠鍖呭惈浠ヤ笅瀛楁淇℃伅錛?br />
public class ClassWriter implements ClassVisitor {
    //The class reader from which this class writer was constructed, if any.
    ClassReader cr;
    //Minor and major version numbers of the class to be generated.
    int version;
    //Index of the next item to be added in the constant pool.
    int index;
    //The constant pool of this class.
    final ByteVector pool;
    //The constant pool's hash table data.
    Item[] items;
    //The threshold of the constant pool's hash table.
    int threshold;
    //A reusable key used to look for items in the {@link #items} hash table.
    final Item key;
    //A reusable key used to look for items in the {@link #items} hash table.
    final Item key2;
    //A reusable key used to look for items in the {@link #items} hash table.
    final Item key3;
    //A type table used to temporarily store internal names that will not necessarily be stored in the constant pool. 
    Item[] typeTable;
    //Number of elements in the {@link #typeTable} array.
    private short typeCount;
    //The access flags of this class.
    private int access;
    //The constant pool item that contains the internal name of this class.
    private int name;
    //The internal name of this class.
    String thisName;
    //The constant pool item that contains the signature of this class.
    private int signature;
    //The constant pool item that contains the internal name of the super class of this class.
    private int superName;
    // Number of interfaces implemented or extended by this class or interface.
    private int interfaceCount;
    //The interfaces implemented or extended by this class or interface. 
    private int[] interfaces;
    //The index of the constant pool item that contains the name of the source file from which this class was compiled.
    private int sourceFile;
    //The SourceDebug attribute of this class.
    private ByteVector sourceDebug;
    //The constant pool item that contains the name of the enclosing class of this class.
    private int enclosingMethodOwner;
    //The constant pool item that contains the name and descriptor of the enclosing method of this class.
    private int enclosingMethod;
    //The runtime visible annotations of this class.
    private AnnotationWriter anns;
    //The runtime invisible annotations of this class.
    private AnnotationWriter ianns;
    //The non standard attributes of this class.
    private Attribute attrs;
    //The number of entries in the InnerClasses attribute.
    private int innerClassesCount;
    //The InnerClasses attribute.
    private ByteVector innerClasses;
    //The fields of this class. These fields are stored in a linked list of {@link FieldWriter} objects, linked to each other by their {@link FieldWriter#next} field. This field stores the first element of this list.
    FieldWriter firstField;
    //This field stores the last element of this list.
    FieldWriter lastField;
    //The methods of this class. These methods are stored in a linked list of {@link MethodWriter} objects, linked to each other by their {@link MethodWriter#next} field. This field stores the first element of this list.
    MethodWriter firstMethod;
    //This field stores the last element of this list.
    MethodWriter lastMethod;
    //true if the maximum stack size and number of local variables must be automatically computed.
    private final boolean computeMaxs;
    //true if the stack map frames must be recomputed from scratch.
    private final boolean computeFrames;
   //true if the stack map tables of this class are invalid. 
    boolean invalidFrames;
}



DLevin 2014-06-25 21:14 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲视频小说图片| 亚洲人成人网站色www| 亚洲已满18点击进入在线观看| 日韩电影免费在线观看中文字幕| ZZIJZZIJ亚洲日本少妇JIZJIZ| 一级做a爰片久久免费| 亚洲国产精品13p| 精品国产免费一区二区三区| 亚洲人色婷婷成人网站在线观看| 国产精品免费一区二区三区| 亚洲日韩v无码中文字幕| 少妇性饥渴无码A区免费| 亚洲嫩草影院久久精品| 国产一卡二卡四卡免费| 中文字幕精品三区无码亚洲| 国产人成免费视频| 一级黄色免费毛片| 亚洲av永久无码精品漫画 | 国产一区二区视频免费| 疯狂做受xxxx高潮视频免费| 波多野结衣中文一区二区免费| 一级做a爱片特黄在线观看免费看| 亚洲人成网77777色在线播放| 久久中文字幕免费视频| 亚洲精品国产国语| 亚洲高清免费视频| 日本免费一区二区久久人人澡| 亚洲区视频在线观看| 国产又大又黑又粗免费视频 | 国内精品久久久久久久亚洲| 国偷自产一区二区免费视频| 亚洲国色天香视频| 亚洲国产精品嫩草影院久久| 国产精品99久久免费观看| 亚洲国产精品免费观看| 亚洲视频在线免费| 2021久久精品免费观看| 51午夜精品免费视频| 亚洲av午夜精品无码专区| 亚洲精品国产精品乱码不卞| 18禁男女爽爽爽午夜网站免费|