📄 manual.ps
字号:
/Fd 1 55 df<176017F01601A2EE03E0A2EE07C0A2EE0F80A2EE1F00A2163EA25EA25EA24B5AA24B5AA24B5AA24B5AA24BC7FCA2153EA25DA25DA24A5AA24A5AA24A5AA24A5AA24AC8FCA2143EA25CA25CA2495AA2495AA2495AA2495AA249C9FCA2133EA25BA25BA2485AA2485AA2485AA2485AA248CAFCA2123EA25AA25AA25A12602C5473C000>54D E%EndDVIPSBitmapFont/Fe 179[51 6[61 1[66 61 66[{TeXBase1Encoding ReEncodeFont}490.9091 /Helvetica rf /Ff 103[55 26[55 55 55 55 55 5555 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 5555 55 55 55 55 55 55 1[55 1[55 3[55 55 55 55 55 55 5555 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 1[5555 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 5555 55 55 55 55 55 55 2[55 55 55 33[{TeXBase1Encoding ReEncodeFont}8690.9091 /Courier rf /Fg 107[50 25[50 55 50 83 55 61 3344 39 1[61 55 61 89 33 61 33 33 61 55 39 50 61 44 6150 12[66 61 2[61 83 1[100 61 2[39 83 83 55 61 83 72 1[786[25 1[50 50 50 50 50 50 50 50 2[25 33 5[28 35[61 612[{TeXBase1Encoding ReEncodeFont}54 99.6264 /Palatino-Boldrf /Fh 134[60 60 60 60 60 60 60 60 60 60 60 60 60 6060 60 60 60 60 60 60 60 60 60 60 3[60 1[60 3[60 60 2[6060 1[60 60 60 60 60 2[60 60 1[60 60 1[60 60 60 5[60 8[601[60 60 60 60 60 2[60 60 5[60 34[{TeXBase1Encoding ReEncodeFont}5399.6264 /Courier rf /Fi 135[50 50 50 1[50 50 50 1[5050 50 50 50 50 50 50 50 50 50 50 50 50 50 50 38[50 10[5050 46[{TeXBase1Encoding ReEncodeFont}25 83.022 /Courierrf /Fj 135[43 1[47 50 27 35 33 1[50 45 48 73 24 1[1924 48 46 1[40 51 37 46 42 12[51 18[65 18[21 28 21 44[{TeXBase1Encoding ReEncodeFont}25 83.022 /Palatino-Romanrf /Fk 205[29 29 49[{TeXBase1Encoding ReEncodeFont}258.1154 /Palatino-Roman rf /Fm 134[66 60 100 66 73 4053 47 1[73 66 73 106 40 73 40 40 73 1[47 60 73 53 1[609[120 2[80 1[86 1[73 2[120 2[47 1[100 100 3[86 80 9310[60 60 60 60 60 60 2[30 43[73 2[{TeXBase1Encoding ReEncodeFont}41119.552 /Palatino-Bold rf /Fn 205[33 33 49[{TeXBase1Encoding ReEncodeFont}2 66.4176 /Palatino-Romanrf /Fo 179[55 6[66 1[72 66 66[{TeXBase1Encoding ReEncodeFont}499.6264 /Helvetica rf /Fp 134[50 2[50 55 33 39 39 1[5044 55 1[28 2[28 50 50 1[39 50 41 46 44 97[{TeXBase1Encoding ReEncodeFont}18 99.6264 /Palatino-Italicrf /Fq 107[50 50 24[50 55 51 83 56 60 32 42 39 56 6054 58 88 29 55 23 29 58 55 33 48 61 44 55 50 3[33 1[3366 66 1[100 72 78 61 52 67 1[60 78 83 94 61 72 33 3483 76 55 61 77 71 61 78 6[25 50 50 50 50 50 50 50 5050 50 1[25 33 25 2[33 33 28 1[84 33[61 60 2[{TeXBase1Encoding ReEncodeFont}74 99.6264 /Palatino-Romanrf /Fr 135[72 1[80 88 48 64 56 1[88 80 88 128 48 2[4888 1[56 72 88 64 1[72 10[112 1[96 1[104 1[88 2[143 881[56 56 1[120 1[88 1[104 96 112 12[72 72 72 72 49[{TeXBase1Encoding ReEncodeFont}35 143.462 /Palatino-Boldrf /Fs 134[45 45 66 45 51 30 35 35 1[45 40 51 71 25 4025 25 45 45 25 35 45 37 42 40 8[66 1[66 71 56 51 61 1[5671 71 86 51 1[30 30 2[51 56 71 61 1[66 6[23 45 45 459[30 5[25 35[50 48 2[{TeXBase1Encoding ReEncodeFont}5090.9091 /Palatino-Italic rf /Ft 87[30 17[45 1[45 45 24[4551 47 76 51 55 30 39 36 51 55 50 53 80 26 51 21 26 5351 30 44 56 40 50 45 3[30 1[30 61 61 61 91 66 71 56 4861 1[55 71 76 86 56 66 30 31 76 69 51 56 70 64 56 715[23 23 45 45 45 45 45 45 45 45 45 45 55 23 30 23 2[3030 25 35[55 55 2[{TeXBase1Encoding ReEncodeFont}78 90.9091/Palatino-Roman rf /Fu 139[39 1[47 2[65 9[57 1[53 6618[94 22[60 5[60 60 60 3[30 44[{TeXBase1Encoding ReEncodeFont}12119.552 /Palatino-Roman rf /Fv 138[72 1[72 72 3[72 7272 72 1[72 72 2[72 72 1[72 72 32[72 17[72 46[{TeXBase1Encoding ReEncodeFont}15 119.552 /Courier rf/Fw 138[87 1[61 57 4[127 1[80 2[83 6[72 19[136 8[11168[{TeXBase1Encoding ReEncodeFont}9 143.462 /Palatino-Romanrf /Fx 139[30 40 35 2[51 56 4[30 3[45 1[40 56 45 10[7120[71 15[45 45 1[23 46[{TeXBase1Encoding ReEncodeFont}1590.9091 /Palatino-Bold rf /Fy 134[96 3[104 56 73 68 1[10394 100 152 50 2[50 1[96 1[82 105 76 95 86 20[105 6[105133 122 105 24[57 57 40[{TeXBase1Encoding ReEncodeFont}24172.188 /Palatino-Roman rf end%%EndProlog%%BeginSetup%%Feature: *Resolution 600dpiTeXDict begin%%BeginPaperSize: a4a4%%EndPaperSize%%EndSetup%%Page: 1 11 0 bop 429 814 a Fy(Byte)44 b(Code)g(Engineering)g(Library)g(\(BCEL\))749 1021 y(Description)h(and)f(usage)f(manual)1685 1229y Fx(V)-10 b(ersion)23 b(1.0)1452 1528 y Fw(Markus)35b(Dahm)1159 1826 y Fv(markus.dahm@berlin.de)1507 2066y Fu(October)c(8,)f(2001)1738 2421 y Fx(Abstract)3802581 y Ft(Extensions)k(and)i(impr)n(ovements)f(of)h(the)g(pr)n(ogramming)g(language)g(Java)h(and)f(its)g(r)n(e-)2442693 y(lated)26 b(execution)e(envir)n(onment)i(\(Java)i(V)-5b(irtual)26 b(Machine,)h(JVM\))g(ar)n(e)f(the)f(subject)g(of)h(a)h(lar)n(ge)244 2806 y(number)f(of)h(r)n(esear)n(ch)f(pr)n(ojects)g(and)g(pr)n(oposals.)39 b(Ther)n(e)25 b(ar)n(e)i(pr)n(ojects,)f(for)h(instance,)g(to)f(add)244 2919 y(parameterized)17 b(types)e(to)i(Java,)j(to)d(implement)g(\223Aspect-Oriented)f(Pr)n(ogramming\224,)j(to)d(per)n(-)244 3032 y(form)23 b(sophisticated)e(static)i(analysis,)f(and)h(to)f(impr)n(ove)h(the)f(r)o(un-time)h(performance.)380 3145y(Since)c(Java)i(classes)d(ar)n(e)i(compiled)f(into)f(portable)h(binary)h(class)f(\002les)g(\(called)h Fs(byte)g(code)pFt(\),)h(it)244 3258 y(is)e(the)f(most)g(convenient)g(and)h(platform-independent)e(way)i(to)f(implement)h(these)e(impr)n(ove-)2443371 y(ments)k(not)g(by)h(writing)g(a)g(new)f(compiler)i(or)e(changing)h(the)f(JVM,)h(but)g(by)g(transforming)f(the)244 3484y(byte)j(code.)33 b(These)23 b(transformations)h(can)h(either)f(be)h(performed)e(after)h(compile-time,)i(or)e(at)244 3597y(load-time.)44 b(Many)28 b(pr)n(ogrammers)f(ar)n(e)h(doing)f(this)h(by)g(implementing)g(their)f(own)g(special-)244 3710y(ized)32 b(byte)e(code)h(manipulation)i(tools,)f(which)h(ar)n(e,)g(however)-7 b(,)33 b(r)n(estricted)d(in)i(the)f(range)g(of)2443823 y(their)22 b(r)n(e-usability)-10 b(.)380 3935 y(T)i(o)27b(deal)h(with)g(the)f(necessary)f(class)i(\002le)g(transformations,)g(we)f(intr)n(oduce)g(an)h(API)f(that)244 4048 y(helps)22b(developers)e(to)i(conveniently)g(implement)h(their)f(transformations.)0 4392 y Fr(1)143 b(Introduction)04620 y Fq(The)32 b(Java)g(language)g([GJS96])h(has)f(become)g(very)h(popular)f(and)g(many)g(r)n(esear)n(ch)h(pr)n(ojects)h(deal)04741 y(with)28 b(further)g(impr)n(ovements)h(of)e(the)h(language)f(or)h(its)g(r)o(un-time)g(behavior)-7 b(.)38 b(The)27 b(possibility)i(to)04861 y(extend)e(a)f(language)h(with)g(new)f(concepts)i(is)f(sur)n(ely)g(a)g(desirable)f(featur)n(e,)h(but)h(implementation)04981 y(issues)37 b(should)h(be)e(hidden)h(fr)n(om)g(the)g(user)-7b(.)67 b(Fortunately)-11 b(,)42 b(the)37 b(concepts)h(of)f(the)g(Java)g(V)-5 b(irtual)0 5102 y(Machine)23 b(permit)g(the)g(user)n(-transpar)n(ent)i(implementation)f(of)f(such)h(extensions)g(with)f(r)n(elatively)05222 y(little)j(ef)n(fort.)146 5342 y(Because)20 b(the)h(tar)n(get)h(language)f(of)g(Java)f(is)h(an)f(interpr)n(eted)h(language)g(with)g(a)f(small)h(and)f(easy-)0 5463 y(to-understand)i(set)f(of)g(instr)o(uctions)i(\(the)e Fp(byte)f(code)p Fq(\),)h(developers)g(can)g(implement)f(and)g(test)h(their)1888 5712 y(1)p eop%%Page: 2 22 1 bop 0 407 a Fq(concepts)32 b(in)g(a)f(very)h(elegant)f(way)-11b(.)50 b(One)32 b(can)f(write)h(a)f(plug-in)h(r)n(eplacement)f(for)i(the)e(system's)0 527 y(class)38 b(loader)g(which)g(is)g(r)n(esponsible)h(for)g(dynamically)f(loading)g(class)g(\002les)h(at)f(r)o(un-time)g(and)0 648 y(passing)30 b(the)h(byte)f(code)g(to)h(the)f(V)-5b(irtual)31 b(Machine)e(\(see)h(section)h(4.1\).)46 b(Class)30b(loaders)g(may)g(thus)0 768 y(be)f(used)f(to)i(inter)n(cept)g(the)f(loading)g(pr)n(ocess)h(and)f(transform)i(classes)e(befor)n(e)g(they)h(get)f(actually)0 888 y(executed)c(by)h(the)g(JVM)f([LB98].)31b(While)25 b(the)g(original)h(class)g(\002les)g(always)f(r)n(emain)g(unalter)n(ed,)h(the)0 1009 y(behavior)32 b(of)g(the)f(class)h(loader)f(may)g(be)g(r)n(econ\002gur)n(ed)i(for)f(every)g(execution)g(or)g(instr)o(umented)0 1129 y(dynamically)-11 b(.)146 1249y(The)34 b Fo(BCEL)40 b Fq(API)33 b(\(Byte)i(Code)f(Engineering)h(Library\),)i(formerly)f(known)f(as)f(JavaClass,)j(is)01370 y(a)h(toolkit)i(for)e(the)g(static)h(analysis)g(and)e(dynamic)h(cr)n(eation)h(or)g(transformation)h(of)f(Java)e(class)01490 y(\002les.)70 b(It)37 b(enables)h(developers)g(to)g(implement)g(the)g(desir)n(ed)g(featur)n(es)g(on)g(a)g(high)g(level)g(of)g(ab-)01611 y(straction)30 b(without)g(handling)f(all)f(the)g(internal)h(details)f(of)h(the)g(Java)f(class)h(\002le)g(format)g(and)f(thus)01731 y(r)n(e-inventing)e(the)f(wheel)f(every)h(time.)31b Fo(BCEL)e Fq(is)24 b(written)i(entir)n(ely)g(in)e(Java)h(and)f(fr)n(eely)h(available)0 1851 y(under)g(the)g(terms)h(of)f(the)g(Apache)f(License.)1752 1815 y Fn(1)146 1972 y Fq(This)33 b(paper)f(is)g(str)o(uctur)n(ed)i(as)f(follows:)46 b(W)-9 b(e)31 b(give)i(a)f(brief)g(description)i(of)e(the)h(Java)f(V)-5 b(irtual)0 2092y(Machine)40 b(and)f(the)h(class)g(\002le)g(format)h(in)f(section)h(2.)75 b(Section)41 b(3)e(intr)n(oduces)j(the)d Fo(BCEL)46b Fq(API.)0 2213 y(Section)28 b(4)e(describes)h(some)g(typical)g(application)g(ar)n(eas)g(and)f(example)g(pr)n(ojects.)38b(The)26 b(appendix)0 2333 y(contains)k(code)f(examples)g(that)h(ar)n(e)f(to)h(long)f(to)h(be)f(pr)n(esented)g(in)g(the)g(main)g(part)h(of)f(this)h(paper)-7 b(.)0 2453 y(All)24 b(examples)h(ar)n(e)g(included)g(in)g(the)g(down-loadable)g(distribution.)0 2749 y Fm(1.1)119b(Related)29 b(work)0 2939 y Fq(Ther)n(e)37 b(ar)n(e)g(a)g(number)g(of)g(pr)n(oposals)i(and)d(class)i(libraries)f(that)h(have)f(some)g(similarities)g(with)2 3059 y(B)t(C)t(E)t(L)r(:)28 b(The)e(JOIE)f([CCK98)o(])h(toolkit)h(can)f(be)f(used)g(to)h(instr)o(ument)h(class)f(loaders)g(with)g(dynamic)0 3180 y(behavior)-7 b(.)73b(Similarly)-11 b(,)43 b(\223Binary)c(Component)h(Adaptation\224)e([KH98])i(allows)f(components)h(to)0 3300 y(be)30 b(adapted)g(and)h(evolved)g(on-the-\003y)-11 b(.)48 b(Han)30 b(Lee's)g(\223Byte-code)i(Instr)o(umenting)g(T)-9 b(ool\224)31 b([LZ98])0 3421y(allows)20 b(the)g(user)g(to)g(insert)g(calls)g(to)g(analysis)g(methods)g(anywher)n(e)g(in)g(the)f(byte)h(code.)30 b(The)19b(Jasmin)0 3541 y(language)i([MD97])g(can)f(be)h(used)f(to)i(hand-write)f(or)g(generate)g(pseudo-assembler)g(code.)30b(D-Java)0 3661 y([Sil98])25 b(and)g(JCF)g([Y)-9 b(ou98])25b(ar)n(e)g(class)h(viewing)f(tools.)146 3782 y(In)f(contrast)h(to)g(these)f(pr)n(ojects,)h Fo(BCEL)j Fq(is)c(intended)f(to)i(be)e(a)h(general)g(purpose)g(tool)h(for)g(\223byte)0 3902 y(code)31b(engineering\224.)48 b(It)30 b(gives)h(full)g(contr)n(ol)i(to)e(the)g(developer)f(on)h(a)g(high)g(level)f(of)h(abstraction)04022 y(and)25 b(is)g(not)g(r)n(estricted)i(to)f(any)f(particular)h(application)f(ar)n(ea.)0 4363 y Fr(2)143 b(The)35 b(Java)g(V)-8b(irtual)34 b(Machine)0 4590 y Fq(Readers)f(alr)n(eady)h(familiar)g(with)g(the)g(Java)g(V)-5 b(irtual)34 b(Machine)g(and)f(the)h(Java)g(class)g(\002le)g(format)0 4711 y(may)25 b(want)g(to)h(skip)g(this)f(section)h(and)f(pr)n(oceed)g(with)g(section)h(3.)1464831 y(Pr)n(ograms)34 b(written)g(in)e(the)g(Java)h(language)f(ar)n(e)h(compiled)f(into)h(a)f(portable)h(binary)g(format)0 4951y(called)27 b Fp(byte)g(code)p Fq(.)38 b(Every)27 b(class)h(is)g(r)n(epr)n(esented)g(by)f(a)h(single)f(class)h(\002le)f(containing)i(class)f(r)n(elated)0 5072 y(data)g(and)f(byte)i(code)f(instr)o(uctions.)42b(These)27 b(\002les)h(ar)n(e)g(loaded)f(dynamically)i(into)f(an)g(interpr)n(eter)0 5192 y(\(Java)d(V)-5 b(irtual)25 b(Machine,)g(JVM\))g(and)g(executed.)p 0 5271 1530 4 v 116 5333 a Fk(1)1495363 y Fj(The)c(distribution)g(is)g(available)e(at)hFi(http://jakarta.apache.org/bcel/)p Fj(,)14 b(including)21b(several)f(code)g(ex-)0 5463 y(amples)h(and)f(javadoc)g(manuals.)18885712 y Fq(2)p eop%%Page: 3 33 2 bop 146 407 a Fq(Figur)n(e)21 b(1)f(illustrates)i(the)e(pr)n(ocedur)n(e)h(of)g(compiling)f(and)g(executing)h(a)f(Java)g(class:)29b(The)20 b(sour)n(ce)0 527 y(\002le)f(\()p Fh(HelloWorld.java)pFq(\))d(is)j(compiled)g(into)h(a)e(Java)i(class)f(\002le)g(\()pFh(HelloWorld.class)p Fq(\),)e(loaded)0 648 y(by)32 b(the)f(byte)h(code)g(interpr)n(eter)g(and)f(executed.)51 b(In)30 b(or)n(der)j(to)f(implement)f(additional)g(featur)n(es,)0 768 y(r)n(esear)n(chers)k(may)e(want)h(to)g(transform)h(class)f(\002les)g(\(drawn)f(with)h(bold)g(lines\))f(befor)n(e)h(they)g(get)0 888 y(actually)26b(executed.)31 b(This)25 b(application)g(ar)n(ea)g(is)g(one)g(of)h(the)f(main)f(issues)i(of)f(this)h(article.)0 2794 y @beginspecial0 @llx 0 @lly 439 @urx 199 @ury 4590 @rwi @setspecial%%BeginDocument: eps/jvm.eps%!PS-Adobe-2.0 EPSF-2.0%%Title: jvm.eps%%Creator: fig2dev Version 3.2 Patchlevel 1%%CreationDate: Thu Nov 19 11:55:18 1998%%For: dahm@che (Markus Dahm,,,,,)%%Orientation: Portrait%%BoundingBox: 0 0 439 199%%Pages: 0%%BeginSetup%%EndSetup%%Magnification: 1.0000%%EndComments/$F2psDict 200 dict def$F2psDict begin$F2psDict /mtrx matrix put/col-1 {0 setgray} bind def/col0 {0.000 0.000 0.000 srgb} bind def/col1 {0.000 0.000 1.000 srgb} bind def/col2 {0.000 1.000 0.000 srgb} bind def/col3 {0.000 1.000 1.000 srgb} bind def/col4 {1.000 0.000 0.000 srgb} bind def/col5 {1.000 0.000 1.000 srgb} bind def/col6 {1.000 1.000 0.000 srgb} bind def/col7 {1.000 1.000 1.000 srgb} bind def/col8 {0.000 0.000 0.560 srgb} bind def/col9 {0.000 0.000 0.690 srgb} bind def/col10 {0.000 0.000 0.820 srgb} bind def/col11 {0.530 0.810 1.000 srgb} bind def/col12 {0.000 0.560 0.000 srgb} bind def/col13 {0.000 0.690 0.000 srgb} bind def/col14 {0.000 0.820 0.000 srgb} bind def/col15 {0.000 0.560 0.560 srgb} bind def/col16 {0.000 0.690 0.690 srgb} bind def/col17 {0.000 0.820 0.820 srgb} bind def/col18 {0.560 0.000 0.000 srgb} bind def/col19 {0.690 0.000 0.000 srgb} bind def/col20 {0.820 0.000 0.000 srgb} bind def/col21 {0.560 0.000 0.560 srgb} bind def/col22 {0.690 0.000 0.690 srgb} bind def/col23 {0.820 0.000 0.820 srgb} bind def/col24 {0.500 0.190 0.000 srgb} bind def/col25 {0.630 0.250 0.000 srgb} bind def/col26 {0.750 0.380 0.000 srgb} bind def/col27 {1.000 0.500 0.500 srgb} bind def/col28 {1.000 0.630 0.630 srgb} bind def/col29 {1.000 0.750 0.750 srgb} bind def/col30 {1.000 0.880 0.880 srgb} bind def/col31 {1.000 0.840 0.000 srgb} bind defendsave-17.0 217.0 translate1 -1 scale/cp {closepath} bind def/ef {eofill} bind def/gr {grestore} bind def/gs {gsave} bind def/sa {save} bind def/rs {restore} bind def/l {lineto} bind def/m {moveto} bind def/rm {rmoveto} bind def/n {newpath} bind def
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -