diff options
author | Jason van Zyl <jvanzyl@apache.org> | 2002-01-24 02:31:08 +0000 |
---|---|---|
committer | Jason van Zyl <jvanzyl@apache.org> | 2002-01-24 02:31:08 +0000 |
commit | e55afae9a42d2790c733eecd2cacd3ea58b2b2b3 (patch) | |
tree | ae516baf213091e1d5a63fc998c68e7f4c042638 /docs | |
parent | 14d6312d7281dbaa5c4c1db0c6e07c17827d70d0 (diff) | |
download | platform_external_apache-commons-bcel-e55afae9a42d2790c733eecd2cacd3ea58b2b2b3.tar.gz platform_external_apache-commons-bcel-e55afae9a42d2790c733eecd2cacd3ea58b2b2b3.tar.bz2 platform_external_apache-commons-bcel-e55afae9a42d2790c733eecd2cacd3ea58b2b2b3.zip |
- cleaning out the docs that have been converted to XML. The bibliography
still needs to be converted.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/jakarta/bcel/trunk@152722 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Faculty.java | 28 | ||||
-rw-r--r-- | docs/HelloWorld.java | 16 | ||||
-rw-r--r-- | docs/Peephole.java | 82 | ||||
-rw-r--r-- | docs/appendix.tex | 193 | ||||
-rw-r--r-- | docs/bool.java | 24 | ||||
-rw-r--r-- | docs/diagrams.tex | 19 | ||||
-rw-r--r-- | docs/manual.ps | 4988 | ||||
-rw-r--r-- | docs/manual.tex | 1079 | ||||
-rw-r--r-- | docs/opt | 24 | ||||
-rw-r--r-- | docs/unopt | 24 |
10 files changed, 0 insertions, 6477 deletions
diff --git a/docs/Faculty.java b/docs/Faculty.java deleted file mode 100644 index c8e7d956..00000000 --- a/docs/Faculty.java +++ /dev/null @@ -1,28 +0,0 @@ -import java.io.*; - -public class Faculty { - private static BufferedReader in = new BufferedReader(new - InputStreamReader(System.in)); - - public static final int fac(int n) { - return(n == 0)? 1 : n * fac(n - 1); - } - - public static final int readInt() { - int n = 4711; - - try { - System.out.print("Please enter a number> "); - n = Integer.parseInt(in.readLine()); - } - catch(IOException e1) { System.err.println(e1); } - catch(NumberFormatException e2) { System.err.println(e2); } - - return n; - } - - public static void main(String[] args) { - int n = readInt(); - System.out.println("Faculty of " + n + " is " + fac(n)); - } -} diff --git a/docs/HelloWorld.java b/docs/HelloWorld.java deleted file mode 100644 index 1630e21f..00000000 --- a/docs/HelloWorld.java +++ /dev/null @@ -1,16 +0,0 @@ -import java.io.*; - -public class HelloWorld { - public static void main(String[] argv) { - BufferedReader in = new BufferedReader(new - InputStreamReader(System.in)); - String name = null; - - try { - System.out.print("Please enter your name> "); - name = in.readLine(); - } catch(IOException e) { return; } - - System.out.println("Hello, " + name); - } -} diff --git a/docs/Peephole.java b/docs/Peephole.java deleted file mode 100644 index c8806aed..00000000 --- a/docs/Peephole.java +++ /dev/null @@ -1,82 +0,0 @@ -import java.io.*; - -import java.util.Iterator; -import org.apache.bcel.classfile.*; -import org.apache.bcel.generic.*; -import org.apache.bcel.Repository; -import org.apache.bcel.util.InstructionFinder; - -public class Peephole { - public static void main(String[] argv) { - try { - /* Load the class from CLASSPATH. - */ - JavaClass clazz = Repository.lookupClass(argv[0]); - Method[] methods = clazz.getMethods(); - ConstantPoolGen cp = new ConstantPoolGen(clazz.getConstantPool()); - - for(int i=0; i < methods.length; i++) { - if(!(methods[i].isAbstract() || methods[i].isNative())) { - MethodGen mg = new MethodGen(methods[i], - clazz.getClassName(), cp); - Method stripped = removeNOPs(mg); - - if(stripped != null) // Any NOPs stripped? - methods[i] = stripped; // Overwrite with stripped method - } - } - - /* Dump the class to <class name>_.class - */ - clazz.setConstantPool(cp.getFinalConstantPool()); - clazz.dump(clazz.getClassName() + "_.class"); - } catch(Exception e) { e.printStackTrace(); } - } - - private static final Method removeNOPs(MethodGen mg) { - InstructionList il = mg.getInstructionList(); - InstructionFinder f = new InstructionFinder(il); - String pat = "NOP+"; // Find at least one NOP - InstructionHandle next = null; - int count = 0; - - for(Iterator i = f.search(pat); i.hasNext(); ) { - InstructionHandle[] match = (InstructionHandle[])e.next(); - InstructionHandle first = match[0]; - InstructionHandle last = match[match.length - 1]; - - /* Some nasty Java compilers may add NOP at end of method. - */ - if((next = last.getNext()) == null) - break; - - count += match.length; - - /* Delete NOPs and redirect any references to them to the following - * (non-nop) instruction. - */ - try { - il.delete(first, last); - } catch(TargetLostException e) { - InstructionHandle[] targets = e.getTargets(); - for(int i=0; i < targets.length; i++) { - InstructionTargeter[] targeters = targets[i].getTargeters(); - - for(int j=0; j < targeters.length; j++) - targeters[j].updateTarget(targets[i], next); - } - } - } - - Method m = null; - - if(count > 0) { - System.out.println("Removed " + count + " NOP instructions from method " + - mg.getName()); - m = mg.getMethod(); - } - - il.dispose(); // Reuse instruction handles - return m; - } -} diff --git a/docs/appendix.tex b/docs/appendix.tex deleted file mode 100644 index 073f0cc0..00000000 --- a/docs/appendix.tex +++ /dev/null @@ -1,193 +0,0 @@ -\section{Code examples for the BCEL API}\label{sec:apicg} - -\subsection{HelloWorldBuilder.java} -The following Java program reads a name from the standard input and -prints a friendly ``Hello''. Since the \texttt{readLine()} method may -throw an \texttt{IOException} it is enclosed by a \texttt{try-catch} block. - -{\small \verbatimtabinput{HelloWorld.java}\label{sec:hello}} - -\subsection{HelloWorldBuilder.java} - -We will sketch here how the above Java class can be created from the -scratch using the \jc API. For ease of reading we will -use textual signatures and not create them dynamically. For example, -the signature - -\begin{verbatim} - "(Ljava/lang/String;)Ljava/lang/StringBuffer;" -\end{verbatim} - -would actually be created with - -\begin{verbatim} - Type.getMethodSignature(Type.STRINGBUFFER, new Type[] { Type.STRING }); -\end{verbatim} - -\subsubsection{Initialization:} - -First we create an empty class and an instruction list: - -{\small\begin{verbatim} - ClassGen cg = new ClassGen("HelloWorld", "java.lang.Object", - "<generated>", ACC_PUBLIC | ACC_SUPER, - null); - ConstantPoolGen cp = cg.getConstantPool(); // cg creates constant pool - InstructionList il = new InstructionList(); -\end{verbatim}} - -We then create the main method, supplying the method's name and the -symbolic type signature encoded with \texttt{Type} objects. - -{\small\begin{verbatim} - MethodGen mg = new MethodGen(ACC_STATIC | ACC_PUBLIC,// access flags - Type.VOID, // return type - new Type[] { // argument types - new ArrayType(Type.STRING, 1) }, - new String[] { "argv" }, // arg names - "main", "HelloWorld", // method, class - il, cp); - InstructionFactory factory = new InstructionFactory(cg); -\end{verbatim}} - -We define some often used types: - -{\small\begin{verbatim} - ObjectType i_stream = new ObjectType("java.io.InputStream"); - ObjectType p_stream = new ObjectType("java.io.PrintStream"); -\end{verbatim}} - -\subsubsection{Create variables \texttt{in} and \texttt{name}:} - -We call the constructors, i.e. execute -\texttt{BufferedReader(Input\-Stream\-Reader(System.in))}. The reference -to the \texttt{BufferedReader} object stays on top of the stack and is -stored in the newly allocated \texttt{in} variable. - -{\small\begin{verbatim} - il.append(factory.createNew("java.io.BufferedReader")); - il.append(InstructionConstants.DUP); // Use predefined constant - il.append(factory.createNew("java.io.InputStreamReader")); - il.append(InstructionConstants.DUP); - il.append(factory.createFieldAccess("java.lang.System", "in", i_stream, - Constants.GETSTATIC)); - il.append(factory.createInvoke("java.io.InputStreamReader", "<init>", - Type.VOID, new Type[] { i_stream }, - Constants.INVOKESPECIAL)); - il.append(factory.createInvoke("java.io.BufferedReader", "<init>", Type.VOID, - new Type[] {new ObjectType("java.io.Reader")}, - Constants.INVOKESPECIAL)); - - LocalVariableGen lg = - mg.addLocalVariable("in", - new ObjectType("java.io.BufferedReader"), null, null); - int in = lg.getIndex(); - lg.setStart(il.append(new ASTORE(in))); // `i' valid from here -\end{verbatim}} - -Create local variable \texttt{name} and initialize it to \texttt{null}. - -{\small\begin{verbatim} - lg = mg.addLocalVariable("name", Type.STRING, null, null); - int name = lg.getIndex(); - il.append(InstructionConstants.ACONST_NULL); - lg.setStart(il.append(new ASTORE(name))); // `name' valid from here -\end{verbatim}} - -\subsubsection{Create try-catch block} - -We remember the start of the block, read a line from the standard -input and store it into the variable \texttt{name}. - -{\small\begin{verbatim} - InstructionHandle try_start = - il.append(factory.createFieldAccess("java.lang.System", "out", p_stream, - Constants.GETSTATIC)); - - il.append(new PUSH(cp, "Please enter your name> ")); - il.append(factory.createInvoke("java.io.PrintStream", "print", Type.VOID, - new Type[] { Type.STRING }, - Constants.INVOKEVIRTUAL)); - il.append(new ALOAD(in)); - il.append(factory.createInvoke("java.io.BufferedReader", "readLine", - Type.STRING, Type.NO_ARGS, - Constants.INVOKEVIRTUAL)); - il.append(new ASTORE(name)); -\end{verbatim}} - -Upon normal execution we jump behind exception handler, the target -address is not known yet. - -{\small\begin{verbatim} - GOTO g = new GOTO(null); - InstructionHandle try_end = il.append(g); -\end{verbatim}} - -We add the exception handler which simply returns from the method. - -{\small\begin{verbatim} - InstructionHandle handler = il.append(InstructionConstants.RETURN); - mg.addExceptionHandler(try_start, try_end, handler, "java.io.IOException"); -\end{verbatim}} - -``Normal'' code continues, now we can set the branch target of the GOTO. - -{\small\begin{verbatim} - InstructionHandle ih = - il.append(factory.createFieldAccess("java.lang.System", "out", p_stream, - Constants.GETSTATIC)); - g.setTarget(ih); -\end{verbatim}} - -\subsubsection{Printing "Hello"} - -String concatenation compiles to \texttt{StringBuffer} operations. - -{\small\begin{verbatim} - il.append(factory.createNew(Type.STRINGBUFFER)); - il.append(InstructionConstants.DUP); - il.append(new PUSH(cp, "Hello, ")); - il.append(factory.createInvoke("java.lang.StringBuffer", "<init>", - Type.VOID, new Type[] { Type.STRING }, - Constants.INVOKESPECIAL)); - il.append(new ALOAD(name)); - il.append(factory.createInvoke("java.lang.StringBuffer", "append", - Type.STRINGBUFFER, new Type[] { Type.STRING }, - Constants.INVOKEVIRTUAL)); - il.append(factory.createInvoke("java.lang.StringBuffer", "toString", - Type.STRING, Type.NO_ARGS, - Constants.INVOKEVIRTUAL)); - - il.append(factory.createInvoke("java.io.PrintStream", "println", - Type.VOID, new Type[] { Type.STRING }, - Constants.INVOKEVIRTUAL)); - il.append(InstructionConstants.RETURN); -\end{verbatim}} - -\subsubsection{Finalization} - -Finally, we have to set the stack size, which normally would be -computed on the fly and add a default constructor method to the class, -which is empty in this case. - -{\small\begin{verbatim} - mg.setMaxStack(5); - cg.addMethod(mg.getMethod()); - il.dispose(); // Allow instruction handles to be reused - cg.addEmptyConstructor(ACC_PUBLIC); -\end{verbatim}} - -Last but not least we dump the \texttt{JavaClass} object to a file. - -{\small\begin{verbatim} - try { - cg.getJavaClass().dump("HelloWorld.class"); - } catch(java.io.IOException e) { System.err.println(e); } -\end{verbatim}} - -\subsection{Peephole.java} - -This class implements a simple peephole optimizer that removes any NOP -instructions from the given class. - -{\small\verbatimtabinput{Peephole.java}}\label{sec:nop} diff --git a/docs/bool.java b/docs/bool.java deleted file mode 100644 index cf517ea0..00000000 --- a/docs/bool.java +++ /dev/null @@ -1,24 +0,0 @@ - InstructionList il = new InstructionList(); - ... - CodeConstraint constraint = new CodeConstraint() { - public boolean checkCode(InstructionHandle[] match) { - IfInstruction if1 = (IfInstruction)match[0].getInstruction(); - GOTO g = (GOTO)match[2].getInstruction(); - return (if1.getTarget() == match[3]) && - (g.getTarget() == match[4]); - } - }; - FindPattern f = new FindPattern(il); - String pat = "`IfInstruction'`ICONST_0'`GOTO'`ICONST_1'" + - "`NOP'(`IFEQ'|`IFNE')"; - InstructionHandle[] match; - for(InstructionHandle ih = f.search(pat, constraint); - ih != null; ih = f.search(pat, match[0], constraint)) { - match = f.getMatch(); // Constraint already checked - ... - match[0].setTarget(match[5].getTarget()); // Update target - ... - try { - il.delete(match[1], match[5]); - } catch(TargetLostException e) { ... } - } diff --git a/docs/diagrams.tex b/docs/diagrams.tex deleted file mode 100644 index 454b7242..00000000 --- a/docs/diagrams.tex +++ /dev/null @@ -1,19 +0,0 @@ - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfysize0.93\textheight - \epsfbox{eps/constantpool.eps} - \caption{UML diagram for the ConstantPool API}\label{fig:umlcp} - \end{center} -\end{figure} - -\begin{figure}[ht] - \begin{center} - \leavevmode - \epsfysize0.93\textheight - \epsfbox{eps/instructions.eps} - \caption{UML diagram for the Instruction API}\label{fig:umlinstr} - \end{center} -\end{figure} - diff --git a/docs/manual.ps b/docs/manual.ps deleted file mode 100644 index c6024074..00000000 --- a/docs/manual.ps +++ /dev/null @@ -1,4988 +0,0 @@ -%!PS-Adobe-2.0 -%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software -%%Title: manual.dvi -%%Pages: 31 -%%PageOrder: Ascend -%%BoundingBox: 0 0 596 842 -%%DocumentFonts: Palatino-Roman Palatino-Bold Courier Palatino-Italic -%%+ Helvetica Helvetica-Oblique Courier-Bold -%%DocumentPaperSizes: a4 -%%EndComments -%DVIPSWebPage: (www.radicaleye.com) -%DVIPSCommandLine: /usr/bin/dvips manual.dvi -%DVIPSParameters: dpi=600, compressed -%DVIPSSource: TeX output 2001.10.08:1345 -%%BeginProcSet: texc.pro -%! -/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S -N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 -mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 -0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ -landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize -mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ -matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round -exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ -statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] -N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin -/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array -/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 -array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N -df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A -definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get -}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} -B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr -1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 -1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx -0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx -sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ -rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp -gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B -/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ -/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ -A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy -get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} -ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp -fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 -{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add -chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ -1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} -forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn -/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put -}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ -bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A -mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ -SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ -userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X -1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 -index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N -/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ -/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) -(LaserWriter 16/600)]{A length product length le{A length product exch 0 -exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse -end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask -grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} -imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round -exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto -fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p -delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} -B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ -p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S -rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end - -%%EndProcSet -%%BeginProcSet: 8r.enc -% @@psencodingfile@{ -% author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry", -% version = "0.6", -% date = "22 June 1996", -% filename = "8r.enc", -% email = "kb@@mail.tug.org", -% address = "135 Center Hill Rd. // Plymouth, MA 02360", -% codetable = "ISO/ASCII", -% checksum = "119 662 4424", -% docstring = "Encoding for TrueType or Type 1 fonts to be used with TeX." -% @} -% -% Idea is to have all the characters normally included in Type 1 fonts -% available for typesetting. This is effectively the characters in Adobe -% Standard Encoding + ISO Latin 1 + extra characters from Lucida. -% -% Character code assignments were made as follows: -% -% (1) the Windows ANSI characters are almost all in their Windows ANSI -% positions, because some Windows users cannot easily reencode the -% fonts, and it makes no difference on other systems. The only Windows -% ANSI characters not available are those that make no sense for -% typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen -% (173). quotesingle and grave are moved just because it's such an -% irritation not having them in TeX positions. -% -% (2) Remaining characters are assigned arbitrarily to the lower part -% of the range, avoiding 0, 10 and 13 in case we meet dumb software. -% -% (3) Y&Y Lucida Bright includes some extra text characters; in the -% hopes that other PostScript fonts, perhaps created for public -% consumption, will include them, they are included starting at 0x12. -% -% (4) Remaining positions left undefined are for use in (hopefully) -% upward-compatible revisions, if someday more characters are generally -% available. -% -% (5) hyphen appears twice for compatibility with both ASCII and Windows. -% -/TeXBase1Encoding [ -% 0x00 (encoded characters from Adobe Standard not in Windows 3.1) - /.notdef /dotaccent /fi /fl - /fraction /hungarumlaut /Lslash /lslash - /ogonek /ring /.notdef - /breve /minus /.notdef -% These are the only two remaining unencoded characters, so may as -% well include them. - /Zcaron /zcaron -% 0x10 - /caron /dotlessi -% (unusual TeX characters available in, e.g., Lucida Bright) - /dotlessj /ff /ffi /ffl - /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef - % very contentious; it's so painful not having quoteleft and quoteright - % at 96 and 145 that we move the things normally found there down to here. - /grave /quotesingle -% 0x20 (ASCII begins) - /space /exclam /quotedbl /numbersign - /dollar /percent /ampersand /quoteright - /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash -% 0x30 - /zero /one /two /three /four /five /six /seven - /eight /nine /colon /semicolon /less /equal /greater /question -% 0x40 - /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O -% 0x50 - /P /Q /R /S /T /U /V /W - /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore -% 0x60 - /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o -% 0x70 - /p /q /r /s /t /u /v /w - /x /y /z /braceleft /bar /braceright /asciitilde - /.notdef % rubout; ASCII ends -% 0x80 - /.notdef /.notdef /quotesinglbase /florin - /quotedblbase /ellipsis /dagger /daggerdbl - /circumflex /perthousand /Scaron /guilsinglleft - /OE /.notdef /.notdef /.notdef -% 0x90 - /.notdef /.notdef /.notdef /quotedblleft - /quotedblright /bullet /endash /emdash - /tilde /trademark /scaron /guilsinglright - /oe /.notdef /.notdef /Ydieresis -% 0xA0 - /.notdef % nobreakspace - /exclamdown /cent /sterling - /currency /yen /brokenbar /section - /dieresis /copyright /ordfeminine /guillemotleft - /logicalnot - /hyphen % Y&Y (also at 45); Windows' softhyphen - /registered - /macron -% 0xD0 - /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered - /cedilla /onesuperior /ordmasculine /guillemotright - /onequarter /onehalf /threequarters /questiondown -% 0xC0 - /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla - /Egrave /Eacute /Ecircumflex /Edieresis - /Igrave /Iacute /Icircumflex /Idieresis -% 0xD0 - /Eth /Ntilde /Ograve /Oacute - /Ocircumflex /Otilde /Odieresis /multiply - /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls -% 0xE0 - /agrave /aacute /acircumflex /atilde - /adieresis /aring /ae /ccedilla - /egrave /eacute /ecircumflex /edieresis - /igrave /iacute /icircumflex /idieresis -% 0xF0 - /eth /ntilde /ograve /oacute - /ocircumflex /otilde /odieresis /divide - /oslash /ugrave /uacute /ucircumflex - /udieresis /yacute /thorn /ydieresis -] def - -%%EndProcSet -%%BeginProcSet: texps.pro -%! -TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 -index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll -exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics -exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub -dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def} -ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict -end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{ -dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 -roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def -dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def} -if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def} -def end - -%%EndProcSet -%%BeginProcSet: special.pro -%! -TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N -/vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N -/rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N -/@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{ -/hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho -X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B -/@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{ -/urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known -{userdict/md get type/dicttype eq{userdict begin md length 10 add md -maxlength ge{/md md dup length 20 add dict copy def}if end md begin -/letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S -atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{ -itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll -transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll -curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf -pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack} -if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 --1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 -get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip -yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub -neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{ -noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop -90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get -neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr -1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr -2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 --1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S -TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{ -Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale -}if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState -save N userdict maxlength dict begin/magscale true def normalscale -currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts -/psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x -psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx -psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub -TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{ -psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 -roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath -moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict -begin/SpecialSave save N gsave normalscale currentpoint TR -@SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{ -CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto -closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx -sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR -}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse -CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury -lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N -/@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end} -repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N -/@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX -currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY -moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X -/yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0 -1 startangle endangle arc savematrix setmatrix}N end - -%%EndProcSet -TeXDict begin 39158280 55380996 1000 600 600 (manual.dvi) -@start /Fa 145[60 60 3[60 3[60 3[60 97[{TeXBase1Encoding ReEncodeFont}5 -99.6264 /Courier-Bold rf -%DVIPSBitmapFont: Fb cmr8 8 1 -/Fb 1 44 df<EC0380B3A4B812FCA3C7D80380C7FCB3A42E2F7CA737>43 -D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fc cmr10 10.95 1 -/Fc 1 62 df<007FB912E0BA12F0A26C18E0CDFCAE007FB912E0BA12F0A26C18E03C167B -A147>61 D E -%EndDVIPSBitmapFont -%DVIPSBitmapFont: Fd cmsy10 10.95 1 -/Fd 1 55 df<176017F01601A2EE03E0A2EE07C0A2EE0F80A2EE1F00A2163EA25EA25EA2 -4B5AA24B5AA24B5AA24B5AA24BC7FCA2153EA25DA25DA24A5AA24A5AA24A5AA24A5AA24A -C8FCA2143EA25CA25CA2495AA2495AA2495AA2495AA249C9FCA2133EA25BA25BA2485AA2 -485AA2485AA2485AA248CAFCA2123EA25AA25AA25A12602C5473C000>54 -D E -%EndDVIPSBitmapFont -/Fe 179[51 6[61 1[66 61 66[{TeXBase1Encoding ReEncodeFont}4 -90.9091 /Helvetica rf /Ff 103[55 26[55 55 55 55 55 55 -55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 -55 55 55 55 55 55 55 1[55 1[55 3[55 55 55 55 55 55 55 -55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 1[55 -55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 -55 55 55 55 55 55 55 2[55 55 55 33[{TeXBase1Encoding ReEncodeFont}86 -90.9091 /Courier rf /Fg 107[50 25[50 55 50 83 55 61 33 -44 39 1[61 55 61 89 33 61 33 33 61 55 39 50 61 44 61 -50 12[66 61 2[61 83 1[100 61 2[39 83 83 55 61 83 72 1[78 -6[25 1[50 50 50 50 50 50 50 50 2[25 33 5[28 35[61 61 -2[{TeXBase1Encoding ReEncodeFont}54 99.6264 /Palatino-Bold -rf /Fh 134[60 60 60 60 60 60 60 60 60 60 60 60 60 60 -60 60 60 60 60 60 60 60 60 60 60 3[60 1[60 3[60 60 2[60 -60 1[60 60 60 60 60 2[60 60 1[60 60 1[60 60 60 5[60 8[60 -1[60 60 60 60 60 2[60 60 5[60 34[{TeXBase1Encoding ReEncodeFont}53 -99.6264 /Courier rf /Fi 135[50 50 50 1[50 50 50 1[50 -50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 38[50 10[50 -50 46[{TeXBase1Encoding ReEncodeFont}25 83.022 /Courier -rf /Fj 135[43 1[47 50 27 35 33 1[50 45 48 73 24 1[19 -24 48 46 1[40 51 37 46 42 12[51 18[65 18[21 28 21 44[{ -TeXBase1Encoding ReEncodeFont}25 83.022 /Palatino-Roman -rf /Fk 205[29 29 49[{TeXBase1Encoding ReEncodeFont}2 -58.1154 /Palatino-Roman rf /Fm 134[66 60 100 66 73 40 -53 47 1[73 66 73 106 40 73 40 40 73 1[47 60 73 53 1[60 -9[120 2[80 1[86 1[73 2[120 2[47 1[100 100 3[86 80 93 -10[60 60 60 60 60 60 2[30 43[73 2[{TeXBase1Encoding ReEncodeFont}41 -119.552 /Palatino-Bold rf /Fn 205[33 33 49[{ -TeXBase1Encoding ReEncodeFont}2 66.4176 /Palatino-Roman -rf /Fo 179[55 6[66 1[72 66 66[{TeXBase1Encoding ReEncodeFont}4 -99.6264 /Helvetica rf /Fp 134[50 2[50 55 33 39 39 1[50 -44 55 1[28 2[28 50 50 1[39 50 41 46 44 97[{ -TeXBase1Encoding ReEncodeFont}18 99.6264 /Palatino-Italic -rf /Fq 107[50 50 24[50 55 51 83 56 60 32 42 39 56 60 -54 58 88 29 55 23 29 58 55 33 48 61 44 55 50 3[33 1[33 -66 66 1[100 72 78 61 52 67 1[60 78 83 94 61 72 33 34 -83 76 55 61 77 71 61 78 6[25 50 50 50 50 50 50 50 50 -50 50 1[25 33 25 2[33 33 28 1[84 33[61 60 2[{ -TeXBase1Encoding ReEncodeFont}74 99.6264 /Palatino-Roman -rf /Fr 135[72 1[80 88 48 64 56 1[88 80 88 128 48 2[48 -88 1[56 72 88 64 1[72 10[112 1[96 1[104 1[88 2[143 88 -1[56 56 1[120 1[88 1[104 96 112 12[72 72 72 72 49[{ -TeXBase1Encoding ReEncodeFont}35 143.462 /Palatino-Bold -rf /Fs 134[45 45 66 45 51 30 35 35 1[45 40 51 71 25 40 -25 25 45 45 25 35 45 37 42 40 8[66 1[66 71 56 51 61 1[56 -71 71 86 51 1[30 30 2[51 56 71 61 1[66 6[23 45 45 45 -9[30 5[25 35[50 48 2[{TeXBase1Encoding ReEncodeFont}50 -90.9091 /Palatino-Italic rf /Ft 87[30 17[45 1[45 45 24[45 -51 47 76 51 55 30 39 36 51 55 50 53 80 26 51 21 26 53 -51 30 44 56 40 50 45 3[30 1[30 61 61 61 91 66 71 56 48 -61 1[55 71 76 86 56 66 30 31 76 69 51 56 70 64 56 71 -5[23 23 45 45 45 45 45 45 45 45 45 45 55 23 30 23 2[30 -30 25 35[55 55 2[{TeXBase1Encoding ReEncodeFont}78 90.9091 -/Palatino-Roman rf /Fu 139[39 1[47 2[65 9[57 1[53 66 -18[94 22[60 5[60 60 60 3[30 44[{TeXBase1Encoding ReEncodeFont}12 -119.552 /Palatino-Roman rf /Fv 138[72 1[72 72 3[72 72 -72 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[111 -68[{TeXBase1Encoding ReEncodeFont}9 143.462 /Palatino-Roman -rf /Fx 139[30 40 35 2[51 56 4[30 3[45 1[40 56 45 10[71 -20[71 15[45 45 1[23 46[{TeXBase1Encoding ReEncodeFont}15 -90.9091 /Palatino-Bold rf /Fy 134[96 3[104 56 73 68 1[103 -94 100 152 50 2[50 1[96 1[82 105 76 95 86 20[105 6[105 -133 122 105 24[57 57 40[{TeXBase1Encoding ReEncodeFont}24 -172.188 /Palatino-Roman rf end -%%EndProlog -%%BeginSetup -%%Feature: *Resolution 600dpi -TeXDict begin -%%BeginPaperSize: a4 -a4 -%%EndPaperSize - -%%EndSetup -%%Page: 1 1 -1 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 1229 -y Fx(V)-10 b(ersion)23 b(1.0)1452 1528 y Fw(Markus)35 -b(Dahm)1159 1826 y Fv(markus.dahm@berlin.de)1507 2066 -y Fu(October)c(8,)f(2001)1738 2421 y Fx(Abstract)380 -2581 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-)244 -2693 y(lated)26 b(execution)e(envir)n(onment)i(\(Java)i(V)-5 -b(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 3145 -y(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)p -Ft(\),)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-)244 -3371 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 3484 -y(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 3597 -y(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 3710 -y(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)244 -3823 y(their)22 b(r)n(e-usability)-10 b(.)380 3935 y(T)i(o)27 -b(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)22 -b(developers)e(to)i(conveniently)g(implement)h(their)f -(transformations.)0 4392 y Fr(1)143 b(Introduction)0 -4620 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)0 -4741 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)0 -4861 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)0 -4981 y(issues)37 b(should)h(be)e(hidden)h(fr)n(om)g(the)g(user)-7 -b(.)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)0 -5222 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 2 -2 1 bop 0 407 a Fq(concepts)32 b(in)g(a)f(very)h(elegant)f(way)-11 -b(.)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)-5 -b(irtual)31 b(Machine)e(\(see)h(section)h(4.1\).)46 b(Class)30 -b(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].)31 -b(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 1249 -y(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)0 -1370 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)0 -1490 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-)0 -1611 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)0 -1731 y(r)n(e-inventing)e(the)f(wheel)f(every)h(time.)31 -b 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 2092 -y(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)46 -b 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.)38 -b(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)119 -b(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(.)73 -b(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 3421 -y(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)19 -b(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.)30 -b(D-Java)0 3661 y([Sil98])25 b(and)g(JCF)g([Y)-9 b(ou98])25 -b(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)31 -b(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)0 -4022 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)-8 -b(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.)146 -4831 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 4951 -y(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.)42 -b(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)149 -5363 y Fj(The)c(distribution)g(is)g(available)e(at)h -Fi(http://jakarta.apache.org/bcel/)p Fj(,)14 b(including)21 -b(several)f(code)g(ex-)0 5463 y(amples)h(and)f(javadoc)g(manuals.)1888 -5712 y Fq(2)p eop -%%Page: 3 3 -3 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:)29 -b(The)20 b(sour)n(ce)0 527 y(\002le)f(\()p Fh(HelloWorld.java)p -Fq(\))d(is)j(compiled)g(into)h(a)e(Java)i(class)f(\002le)g(\()p -Fh(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)26 -b(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 @beginspecial -0 @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 def - -end -save --17.0 217.0 translate -1 -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 -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 4612 m -1000 -1000 l 8588 -1000 l 8588 4612 l cp clip - 0.06000 0.06000 sc -/Courier ff 285.00 scf sf -6600 1575 m -gs 1 -1 sc (java) col0 sh gr -/Courier ff 285.00 scf sf -2550 1575 m -gs 1 -1 sc (javac) col0 sh gr -/Courier-Bold ff 150.00 scf sf -4290 1155 m -gs 1 -1 sc (08 1a 42 ...) col0 sh gr -/Courier-Bold ff 150.00 scf sf -4290 990 m -gs 1 -1 sc (ca fe ba be) col0 sh gr -% Polyline -7.500 slw -n 6405 1200 m 6300 1200 6300 1695 105 arcto 4 {pop} repeat - 6300 1800 7395 1800 105 arcto 4 {pop} repeat - 7500 1800 7500 1305 105 arcto 4 {pop} repeat - 7500 1200 6405 1200 105 arcto 4 {pop} repeat - cp gs col0 s gr -% Polyline -n 2505 1200 m 2400 1200 2400 1695 105 arcto 4 {pop} repeat - 2400 1800 3495 1800 105 arcto 4 {pop} repeat - 3600 1800 3600 1305 105 arcto 4 {pop} repeat - 3600 1200 2505 1200 105 arcto 4 {pop} repeat - cp gs col0 s gr -% Polyline -30.000 slw -gs clippath -2280 1470 m 2400 1500 l 2280 1530 l 2445 1530 l 2445 1470 l cp -clip -n 1800 1500 m 2400 1500 l gs col0 s gr gr - -% arrowhead -7.500 slw -n 2280 1470 m 2400 1500 l 2280 1530 l 2280 1500 l 2280 1470 l cp gs 0.00 setgray ef gr col0 s -% Polyline -30.000 slw -gs clippath -4080 1470 m 4200 1500 l 4080 1530 l 4245 1530 l 4245 1470 l cp -clip -n 3600 1500 m 4200 1500 l gs col0 s gr gr - -% arrowhead -7.500 slw -n 4080 1470 m 4200 1500 l 4080 1530 l 4080 1500 l 4080 1470 l cp gs 0.00 setgray ef gr col0 s -% Polyline -30.000 slw -gs clippath -6180 1470 m 6300 1500 l 6180 1530 l 6345 1530 l 6345 1470 l cp -clip -n 5700 1500 m 6300 1500 l gs col0 s gr gr - -% arrowhead -7.500 slw -n 6180 1470 m 6300 1500 l 6180 1530 l 6180 1500 l 6180 1470 l cp gs 0.00 setgray ef gr col0 s -% Polyline -30.000 slw -n 5415 615 m 5415 915 l 5715 915 l gs col0 s gr -% Polyline -n 4215 615 m 4215 2415 l 5715 2415 l 5715 915 l 5415 615 l 4215 615 l cp gs col0 s gr -% Polyline -gs clippath -7006 1136 m 6900 1200 l 6964 1094 l 6847 1211 l 6889 1253 l cp -clip -n 7500 600 m 6900 1200 l gs col0 s gr gr - -% arrowhead -7.500 slw -n 7006 1136 m 6900 1200 l 6964 1094 l 6985 1115 l 7006 1136 l cp gs 0.00 setgray ef gr col0 s -% Polyline -30.000 slw -gs clippath -6630 1080 m 6600 1200 l 6570 1080 l 6570 1245 l 6630 1245 l cp -clip -n 6600 1200 m 6600 600 l gs col0 s gr gr - -% arrowhead -7.500 slw -n 6630 1080 m 6600 1200 l 6570 1080 l 6600 1080 l 6630 1080 l cp gs 0.00 setgray ef gr col0 s -% Polyline -n 300 3000 m 3600 3000 l 3600 3600 l 300 3600 l cp gs 0.90 setgray ef gr gs col0 s gr -% Polyline -n 4200 3000 m 7500 3000 l 7500 3600 l 4200 3600 l cp gs 0.90 setgray ef gr gs col0 s gr -% Polyline -n 1500 600 m 1500 900 l 1800 900 l gs col0 s gr -% Polyline -n 300 600 m 300 2400 l 1800 2400 l 1800 900 l 1500 600 l 300 600 l cp gs col0 s gr -/Helvetica ff 180.00 scf sf -6450 450 m -gs 1 -1 sc (Other classes) col0 sh gr -/Courier ff 150.00 scf sf -375 975 m -gs 1 -1 sc (public class) col0 sh gr -/Courier ff 150.00 scf sf -375 1140 m -gs 1 -1 sc (HelloWorld {) col0 sh gr -/Courier ff 150.00 scf sf -375 1305 m -gs 1 -1 sc ( ...) col0 sh gr -/Courier ff 150.00 scf sf -375 1635 m -gs 1 -1 sc ( void hello\(\) {) col0 sh gr -/Courier ff 150.00 scf sf -375 1800 m -gs 1 -1 sc ( ...) col0 sh gr -/Courier ff 150.00 scf sf -375 1965 m -gs 1 -1 sc ( }) col0 sh gr -/Courier ff 150.00 scf sf -375 2130 m -gs 1 -1 sc (}) col0 sh gr -/Helvetica ff 180.00 scf sf -4275 2625 m -gs 1 -1 sc (HelloWorld.class) col0 sh gr -/Helvetica-Bold ff 300.00 scf sf -900 3375 m -gs 1 -1 sc (Java language) col0 sh gr -/Helvetica-Bold ff 300.00 scf sf -4350 3375 m -gs 1 -1 sc (Java Virtual Machine) col0 sh gr -/Helvetica ff 180.00 scf sf -375 2625 m -gs 1 -1 sc (HelloWorld.java) col-1 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 781 2998 a(Figur)n(e)g(1:)31 b(Compilation)25 -b(and)g(execution)h(of)f(Java)g(classes)146 3370 y(Note)e(that)g(the)f -(use)h(of)g(the)f(general)g(term)h(\223Java\224)f(implies)g(two)h -(meanings:)30 b(on)23 b(the)f(one)g(hand,)0 3491 y(Java)i(as)f(a)g(pr)n -(ogramming)i(language)f(is)g(meant,)f(on)h(the)g(other)g(hand,)f(the)h -(Java)g(V)-5 b(irtual)23 b(Machine,)0 3611 y(which)k(is)g(not)g -(necessarily)h(tar)n(geted)g(by)f(the)g(Java)f(language)h(exclusively) --11 b(,)28 b(but)g(may)e(be)h(used)g(by)0 3731 y(other)j(languages)f -(as)g(well)f(\(e.g.)43 b(Eif)n(fel)29 b([CCZ97],)g(or)h(Ada)e([T)-9 -b(af96]\).)42 b(W)-9 b(e)28 b(assume)h(the)g(r)n(eader)g(to)0 -3852 y(be)g(familiar)h(with)g(the)f(Java)h(language)g(and)f(to)h(have)f -(a)h(general)f(understanding)h(of)g(the)g(V)-5 b(irtual)0 -3972 y(Machine.)0 4320 y Fm(2.1)119 b(Java)29 b(class)h(\002le)g -(format)0 4525 y Fq(Giving)g(a)f(full)g(overview)h(of)g(the)f(design)g -(issues)h(of)f(the)h(Java)f(class)h(\002le)f(format)h(and)f(the)g -(associ-)0 4645 y(ated)h(byte)g(code)g(instr)o(uctions)j(is)d(beyond)g -(the)g(scope)h(of)f(this)h(paper)-7 b(.)45 b(W)-9 b(e)29 -b(will)h(just)h(give)f(a)g(brief)0 4766 y(intr)n(oduction)36 -b(covering)e(the)g(details)f(that)i(ar)n(e)e(necessary)h(for)g -(understanding)g(the)g(r)n(est)g(of)g(this)0 4886 y(paper)-7 -b(.)39 b(The)28 b(format)h(of)f(class)h(\002les)f(and)f(the)h(byte)h -(code)f(instr)o(uction)i(set)f(ar)n(e)f(described)g(in)f(mor)n(e)0 -5007 y(detail)k(in)f(the)h(\223Java)g(V)-5 b(irtual)31 -b(Machine)g(Speci\002cation\224)h([L)-9 b(Y97])2542 4970 -y Fn(2)2579 5007 y Fq(,)32 b(and)f(in)f([MD97].)49 b(Especially)-11 -b(,)0 5127 y(we)23 b(will)g(not)h(deal)e(with)i(the)f(security)h -(constraints)h(that)f(the)f(Java)g(V)-5 b(irtual)24 b(Machine)f(has)g -(to)g(check)0 5247 y(at)i(r)o(un-time,)h(i.e.)k(the)25 -b(byte)h(code)f(veri\002er)-7 b(.)p 0 5371 1530 4 v 116 -5433 a Fk(2)149 5463 y Fj(Also)21 b(available)f(online)i(at)e -Fi(http://www.javasoft.com/docs/books/)o(vmspe)o(c/inde)o(x.htm)o(l) -1888 5712 y Fq(3)p eop -%%Page: 4 4 -4 3 bop 146 407 a Fq(Figur)n(e)40 b(2)e(shows)i(a)e(simpli\002ed)h -(example)f(of)h(the)g(contents)h(of)f(a)g(Java)f(class)i(\002le:)58 -b(It)38 b(starts)0 527 y(with)c(a)f(header)g(containing)h(a)f -(\223magic)h(number)7 b(\224)33 b(\()p Fh(0xCAFEBABE)p -Fq(\))f(and)h(the)g(version)h(number)-7 b(,)0 648 y(followed)33 -b(by)f(the)g Fp(constant)h(pool)p Fq(,)g(which)g(can)e(be)h(r)n(oughly) -i(thought)g(of)e(as)g(the)g(text)h(segment)f(of)0 768 -y(an)j(executable,)j(the)e Fp(access)e(rights)g Fq(of)i(the)g(class)g -(encoded)f(by)h(a)f(bit)h(mask,)i(a)d(list)h(of)g(interfaces)0 -888 y(implemented)19 b(by)h(the)f(class,)i(lists)f(containing)h(the)f -(\002elds)f(and)g(methods)h(of)g(the)g(class,)h(and)e(\002nally)0 -1009 y(the)35 b Fp(class)f(attributes)p Fq(,)j(e.g.)60 -b(the)35 b Fh(SourceFile)d Fq(attribute)37 b(telling)e(the)g(name)f(of) -h(the)g(sour)n(ce)h(\002le.)0 1129 y(Attributes)28 b(ar)n(e)f(a)g(way)g -(of)g(putting)h(additional,)g(e.g.)36 b(user)n(-de\002ned,)28 -b(information)g(into)g(class)f(\002le)0 1249 y(data)e(str)o(uctur)n -(es.)34 b(For)26 b(example,)f(a)g(custom)h(class)g(loader)f(may)h -(evaluate)f(such)g(attribute)i(data)e(in)0 1370 y(or)n(der)h(to)f -(perform)h(its)f(transformations.)33 b(The)25 b(JVM)g(speci\002cation)h -(declar)n(es)f(that)g(unknown,)g(i.e.)0 1490 y(user)n(-de\002ned)g -(attributes)i(must)e(be)g(ignor)n(ed)h(by)f(any)g(V)-5 -b(irtual)25 b(Machine)g(implementation.)0 5123 y @beginspecial -0 @llx 0 @lly 520 @urx 460 @ury 4590 @rwi @setspecial -%%BeginDocument: eps/classfile.eps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: classfile.eps -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Mon Nov 30 16:01:26 1998 -%%For: dahm@che (Markus Dahm,,,,,) -%%Orientation: Portrait -%%BoundingBox: 0 0 520 460 -%%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 def - -end -save --17.0 540.0 translate -1 -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 -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 10000 m -1000 -1000 l 9937 -1000 l 9937 10000 l cp clip - 0.06000 0.06000 sc -% Polyline -7.500 slw -n 2999 6599 m 2400 6599 l 2400 6749 l 2999 6749 l cp gs col0 s gr -% Polyline -n 2400 6749 m 2999 6749 l 2999 6899 l 2400 6899 l cp gs col0 s gr -% Polyline -n 2999 6899 m 2400 6899 l 2400 7049 l 2999 7049 l cp gs col0 s gr -% Polyline -n 2400 7049 m 2999 7049 l 2999 7200 l 2400 7200 l cp gs col0 s gr -% Polyline -n 2400 7200 m 2999 7200 l 2999 7349 l 2400 7349 l cp gs col0 s gr -% Polyline -30.000 slw - [15 45] 45 sd -n 2699 7424 m 2699 7724 l gs col0 s gr [] 0 sd -% Polyline -7.500 slw -n 299 6449 m 3299 6449 l 3299 7949 l 299 7949 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 6824 m -gs 1 -1 sc (Methods) col0 sh gr -% Polyline -n 2999 5099 m 2400 5099 l 2400 5249 l 2999 5249 l cp gs col0 s gr -% Polyline -n 2400 5249 m 2999 5249 l 2999 5399 l 2400 5399 l cp gs col0 s gr -% Polyline -n 2999 5399 m 2400 5399 l 2400 5549 l 2999 5549 l cp gs col0 s gr -% Polyline -n 2400 5549 m 2999 5549 l 2999 5699 l 2400 5699 l cp gs col0 s gr -% Polyline -n 2400 5699 m 2999 5699 l 2999 5849 l 2400 5849 l cp gs col0 s gr -% Polyline -30.000 slw - [15 45] 45 sd -n 2699 5924 m 2699 6224 l gs col0 s gr [] 0 sd -% Polyline -7.500 slw -n 299 4949 m 3299 4949 l 3299 6449 l 299 6449 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 5399 m -gs 1 -1 sc (Fields) col0 sh gr -% Polyline -n 299 4199 m 3299 4199 l 3299 4949 l 299 4949 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 4649 m -gs 1 -1 sc (Implemented interfaces) col0 sh gr -% Polyline -n 299 3449 m 3299 3449 l 3299 4199 l 299 4199 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 3899 m -gs 1 -1 sc (Access rights) col0 sh gr -% Polyline -n 299 1349 m 3299 1349 l 3299 2099 l 299 2099 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 1799 m -gs 1 -1 sc (Header) col0 sh gr -% Polyline -n 2999 2249 m 2400 2249 l 2400 2400 l 2999 2400 l cp gs col0 s gr -% Polyline -n 2400 2400 m 2999 2400 l 2999 2549 l 2400 2549 l cp gs col0 s gr -% Polyline -n 2999 2549 m 2400 2549 l 2400 2699 l 2999 2699 l cp gs col0 s gr -% Polyline -n 2400 2699 m 2999 2699 l 2999 2849 l 2400 2849 l cp gs col0 s gr -% Polyline -n 2400 2849 m 2999 2849 l 2999 2999 l 2400 2999 l cp gs col0 s gr -% Polyline -30.000 slw - [15 45] 45 sd -n 2699 3074 m 2699 3374 l gs col0 s gr [] 0 sd -% Polyline -7.500 slw -n 299 2099 m 3299 2099 l 3299 3449 l 299 3449 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 2549 m -gs 1 -1 sc (Constant pool) col0 sh gr -% Polyline -n 299 7949 m 3299 7949 l 3299 8699 l 299 8699 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -599 8400 m -gs 1 -1 sc (Class attributes) col0 sh gr -% Polyline -n 4800 2999 m 7499 2999 l 7499 4349 l 4800 4349 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -5099 3299 m -gs 1 -1 sc (ConstantFieldref) col0 sh gr -/Helvetica ff 210.00 scf sf -5099 3600 m -gs 1 -1 sc ("aVariable") col0 sh gr -/Helvetica ff 210.00 scf sf -5099 3884 m -gs 1 -1 sc ("[Ljava/lang/Object;") col0 sh gr -/Helvetica ff 210.00 scf sf -5099 4199 m -gs 1 -1 sc ("HelloWorld") col0 sh gr -% Polyline -n 5024 2624 m 7124 2624 l 7124 2924 l 5024 2924 l cp gs col0 s gr -/Helvetica ff 210.00 scf sf -5099 2849 m -gs 1 -1 sc ("java/io/PrintStream") col0 sh gr -% Polyline -n 4800 1649 m 7499 1649 l 7499 2999 l 4800 2999 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -5099 1949 m -gs 1 -1 sc (ConstantMethodRef) col0 sh gr -/Helvetica ff 210.00 scf sf -5099 2249 m -gs 1 -1 sc ("println") col0 sh gr -/Helvetica ff 210.00 scf sf -5099 2534 m -gs 1 -1 sc ("\(Ljava/lang/String;\)V") col0 sh gr -% Polyline -n 4800 4349 m 7499 4349 l 7499 5099 l 4800 5099 l cp gs col0 s gr -/Helvetica-Bold ff 210.00 scf sf -5099 4649 m -gs 1 -1 sc (ConstantClass) col0 sh gr -/Helvetica ff 210.00 scf sf -5099 4949 m -gs 1 -1 sc ("java/io/PrintStream") col0 sh gr -% Polyline -n 4080 6500 m 3975 6500 3975 7770 105 arcto 4 {pop} repeat - 3975 7875 8820 7875 105 arcto 4 {pop} repeat - 8925 7875 8925 6605 105 arcto 4 {pop} repeat - 8925 6500 4080 6500 105 arcto 4 {pop} repeat - cp gs 0.00 setgray ef gr gs col0 s gr -% Polyline -n 3855 6725 m 3750 6725 3750 7995 105 arcto 4 {pop} repeat - 3750 8100 8595 8100 105 arcto 4 {pop} repeat - 8700 8100 8700 6830 105 arcto 4 {pop} repeat - 8700 6725 3855 6725 105 arcto 4 {pop} repeat - cp gs col7 1.00 shd ef gr gs col0 s gr -% Polyline -30.000 slw - [15 45] 45 sd -n 6150 7800 m 6150 7950 l gs col0 s gr [] 0 sd -% Polyline -7.500 slw -n 5550 7200 m 7200 7200 l 7200 7425 l 5550 7425 l cp gs col0 s gr -% Polyline -n 5550 7500 m 8625 7500 l 8625 7725 l 5550 7725 l cp gs col0 s gr -/Courier-Bold ff 180.00 scf sf -4050 7050 m -gs 1 -1 sc (getstatic java.lang.System.out) col0 sh gr -/Courier-Bold ff 180.00 scf sf -4050 7650 m -gs 1 -1 sc (invokevirtual java.io.PrintStream.println) col0 sh gr -/Courier-Bold ff 180.00 scf sf -4050 7350 m -gs 1 -1 sc (ldc "Hello, world") col0 sh gr -% Polyline - [15 45] 45 sd -n 2400 2249 m 4800 1649 l gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 2400 2849 m 4800 5849 l gs col0 s gr [] 0 sd -% Polyline -gs clippath -4693 3661 m 4800 3600 l 4734 3705 l 4832 3611 l 4790 3568 l cp -clip -n 2999 5324 m 4800 3600 l gs col0 s gr gr - -% arrowhead -n 4693 3661 m 4800 3600 l 4734 3705 l 4713 3683 l 4693 3661 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -3669 7107 m 3750 7200 l 3635 7156 l 3745 7233 l 3779 7184 l cp -clip -n 2999 6674 m 3750 7200 l gs col0 s gr gr - -% arrowhead -n 3669 7107 m 3750 7200 l 3635 7156 l 3652 7131 l 3669 7107 l cp gs 0.00 setgray ef gr col0 s -% Polyline -n 5099 1649 m 5099 1349 l 7799 1349 l 7799 5549 l 7499 5549 l 7499 1649 l - 5099 1649 l cp gs 0.00 setgray ef gr gs col0 s gr -% Polyline - [15 45] 45 sd -n 2999 2849 m 4800 4049 l gs col0 s gr [] 0 sd -% Polyline - [15 45] 45 sd -n 2999 2249 m 4800 2024 l gs col0 s gr [] 0 sd -% Polyline -gs clippath -7609 2533 m 7500 2475 l 7624 2475 l 7493 2442 l 7478 2500 l cp -clip -n 7800 2550 m 7500 2475 l gs col7 s gr gr - -% arrowhead -n 7609 2533 m 7500 2475 l 7624 2475 l 7616 2504 l 7609 2533 l cp gs col7 1.00 shd ef gr col7 s -% Polyline -n 4800 5099 m 7499 5099 l 7499 5849 l 4800 5849 l cp gs col0 s gr -% Polyline -n 7800 7500 m 7801 7499 l 7804 7496 l 7809 7491 l 7816 7483 l 7826 7472 l - 7840 7457 l 7856 7440 l 7875 7419 l 7897 7395 l 7921 7368 l - 7946 7340 l 7973 7310 l 7999 7279 l 8026 7247 l 8052 7216 l - 8078 7184 l 8102 7152 l 8125 7121 l 8147 7090 l 8167 7059 l - 8186 7029 l 8203 6998 l 8220 6966 l 8235 6934 l 8250 6900 l - 8261 6873 l 8272 6845 l 8282 6816 l 8292 6786 l 8303 6756 l - 8313 6724 l 8323 6692 l 8333 6659 l 8343 6626 l 8353 6592 l - 8363 6557 l 8373 6522 l 8382 6487 l 8392 6451 l 8402 6415 l - 8412 6379 l 8421 6342 l 8431 6305 l 8440 6268 l 8449 6231 l - 8458 6194 l 8467 6157 l 8476 6120 l 8484 6082 l 8492 6045 l - 8500 6007 l 8508 5969 l 8515 5932 l 8522 5894 l 8528 5856 l - 8535 5817 l 8540 5778 l 8545 5739 l 8550 5700 l 8554 5664 l - 8557 5628 l 8560 5591 l 8563 5554 l 8565 5517 l 8567 5479 l - 8568 5440 l 8570 5401 l 8571 5362 l 8572 5322 l 8572 5281 l - 8573 5241 l 8573 5200 l 8573 5159 l 8573 5117 l 8573 5076 l - 8572 5034 l 8572 4992 l 8571 4950 l 8570 4908 l 8570 4866 l - 8569 4824 l 8568 4783 l 8567 4741 l 8566 4700 l 8565 4659 l - 8564 4619 l 8563 4578 l 8562 4538 l 8561 4499 l 8560 4460 l - 8559 4421 l 8558 4383 l 8557 4346 l 8555 4309 l 8554 4272 l - 8552 4236 l 8550 4200 l 8548 4161 l 8545 4121 l 8542 4083 l - 8540 4044 l 8537 4006 l 8534 3968 l 8531 3930 l 8528 3892 l - 8526 3854 l 8523 3815 l 8520 3777 l 8517 3739 l 8515 3702 l - 8512 3664 l 8509 3626 l 8506 3588 l 8503 3551 l 8500 3514 l - 8497 3477 l 8493 3440 l 8490 3404 l 8486 3368 l 8481 3333 l - 8477 3298 l 8471 3264 l 8466 3231 l 8460 3199 l 8453 3167 l - 8446 3136 l 8438 3107 l 8430 3078 l 8421 3051 l 8411 3025 l - 8400 3000 l 8385 2969 l 8368 2941 l 8349 2913 l 8328 2887 l - 8305 2862 l 8279 2838 l 8251 2814 l 8220 2790 l 8187 2767 l - 8153 2744 l 8117 2721 l 8080 2699 l 8043 2678 l 8006 2657 l - 7970 2638 l 7937 2620 l 7907 2604 l 7879 2590 l 7856 2578 l - 7837 2568 l 7823 2561 l 7812 2556 l 7805 2553 l 7802 2551 l - 7800 2550 l gs col0 s gr -% Polyline -gs clippath -4723 4703 m 4800 4800 l 4687 4750 l 4794 4833 l 4830 4785 l cp -clip -n 5025 2775 m 5024 2776 l 5020 2779 l 5015 2784 l 5006 2792 l 4993 2804 l - 4977 2818 l 4957 2836 l 4934 2857 l 4908 2881 l 4879 2907 l - 4849 2935 l 4818 2964 l 4786 2994 l 4754 3023 l 4723 3053 l - 4693 3082 l 4664 3110 l 4637 3137 l 4612 3163 l 4589 3188 l - 4568 3212 l 4549 3235 l 4531 3257 l 4515 3278 l 4500 3300 l - 4485 3324 l 4471 3347 l 4457 3371 l 4444 3396 l 4432 3420 l - 4419 3445 l 4408 3470 l 4396 3495 l 4385 3520 l 4374 3546 l - 4363 3571 l 4352 3596 l 4342 3622 l 4332 3647 l 4323 3673 l - 4314 3698 l 4306 3724 l 4299 3749 l 4292 3775 l 4286 3800 l - 4281 3825 l 4278 3850 l 4276 3875 l 4275 3900 l 4276 3925 l - 4278 3950 l 4282 3975 l 4287 4001 l 4293 4027 l 4301 4053 l - 4309 4080 l 4319 4106 l 4329 4133 l 4340 4160 l 4351 4187 l - 4363 4214 l 4375 4241 l 4387 4268 l 4399 4294 l 4411 4320 l - 4423 4345 l 4434 4370 l 4446 4394 l 4457 4417 l 4468 4439 l - 4478 4460 l 4489 4481 l 4500 4500 l 4513 4522 l 4528 4543 l - 4543 4563 l 4559 4583 l 4578 4603 l 4597 4623 l 4618 4643 l - 4640 4664 l 4663 4685 l 4686 4705 l 4709 4724 l 4730 4742 l - 4749 4758 l 4765 4772 l 4778 4783 l 4800 4800 l gs col0 s gr gr - -% arrowhead -n 4723 4703 m 4800 4800 l 4687 4750 l 4705 4727 l 4723 4703 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -7591 5782 m 7499 5699 l 7619 5728 l 7500 5665 l 7472 5719 l cp -clip -n 7200 7275 m 7203 7274 l 7208 7271 l 7219 7265 l 7235 7257 l 7256 7246 l - 7282 7233 l 7312 7217 l 7346 7200 l 7381 7182 l 7417 7163 l - 7453 7144 l 7487 7126 l 7520 7109 l 7551 7092 l 7580 7076 l - 7607 7061 l 7631 7048 l 7654 7034 l 7676 7022 l 7696 7010 l - 7714 6998 l 7733 6986 l 7750 6975 l 7770 6961 l 7790 6947 l - 7810 6933 l 7829 6918 l 7847 6903 l 7866 6887 l 7883 6871 l - 7901 6855 l 7917 6837 l 7933 6820 l 7947 6802 l 7961 6784 l - 7973 6766 l 7984 6748 l 7994 6729 l 8003 6711 l 8010 6693 l - 8016 6675 l 8021 6656 l 8025 6638 l 8028 6618 l 8030 6598 l - 8031 6578 l 8031 6556 l 8030 6534 l 8029 6511 l 8026 6487 l - 8023 6462 l 8019 6438 l 8015 6412 l 8009 6387 l 8004 6362 l - 7997 6338 l 7991 6314 l 7984 6291 l 7977 6269 l 7971 6247 l - 7964 6226 l 7957 6207 l 7950 6187 l 7942 6167 l 7934 6146 l - 7926 6126 l 7918 6106 l 7909 6086 l 7900 6066 l 7891 6046 l - 7881 6027 l 7871 6008 l 7861 5990 l 7850 5972 l 7840 5956 l - 7829 5940 l 7818 5925 l 7807 5911 l 7797 5898 l 7785 5886 l - 7774 5874 l 7762 5863 l 7750 5852 l 7737 5841 l 7722 5830 l - 7707 5819 l 7689 5807 l 7670 5795 l 7648 5782 l 7625 5769 l - 7602 5755 l 7578 5742 l 7555 5729 l 7535 5718 l 7499 5699 l gs col0 s gr gr - -% arrowhead -n 7591 5782 m 7499 5699 l 7619 5728 l 7605 5755 l 7591 5782 l cp gs 0.00 setgray ef gr col0 s -/Helvetica ff 210.00 scf sf -975 9000 m -gs 1 -1 sc (HelloWorld.class) col0 sh gr -/Helvetica ff 210.00 scf sf -5099 5699 m -gs 1 -1 sc ("Hello, world") col0 sh gr -/Helvetica-Bold ff 210.00 scf sf -5099 5399 m -gs 1 -1 sc (ConstantString) col0 sh gr -$F2psEnd -rs - -%%EndDocument - @endspecial 1252 5327 a(Figur)n(e)h(2:)31 b(Java)25 -b(class)g(\002le)g(format)1888 5712 y(4)p eop -%%Page: 5 5 -5 4 bop 146 407 a Fq(Because)20 b(all)f(of)h(the)g(information)h -(needed)d(to)i(dynamically)g(r)n(esolve)h(the)f(symbolic)g(r)n(efer)n -(ences)0 527 y(to)32 b(classes,)h(\002elds)e(and)g(methods)h(at)f(r)o -(un-time)h(is)f(coded)h(with)f(string)i(constants,)h(the)d(constant)0 -648 y(pool)40 b(contains)g(in)g(fact)g(the)f(lar)n(gest)i(portion)f(of) -g(an)f(average)h(class)f(\002le,)k(appr)n(oximately)e(60\045)0 -768 y([AP98)o(].)31 b(The)25 b(byte)h(code)f(instr)o(uctions)i -(themselves)f(just)g(make)e(up)h(12\045.)146 893 y(The)43 -b(right)g(upper)g(box)g(shows)h(a)e(\223zoomed\224)h(excerpt)g(of)g -(the)g(constant)h(pool,)j(while)c(the)0 1014 y(r)n(ounded)37 -b(box)g(below)f(depicts)h(some)g(instr)o(uctions)i(that)e(ar)n(e)f -(contained)h(within)g(a)f(method)g(of)0 1134 y(the)e(example)f(class.) -56 b(These)34 b(instr)o(uctions)i(r)n(epr)n(esent)e(the)f -(straightforwar)n(d)k(translation)e(of)f(the)0 1254 y(well-known)26 -b(statement:)179 1522 y Fh(System.out.println\("Hello,)54 -b(world"\);)146 1784 y Fq(The)22 b(\002rst)h(instr)o(uction)h(loads)e -(the)g(contents)h(of)f(the)g(\002eld)g Fh(out)f Fq(of)h(class)h -Fh(java.lang.System)0 1904 y Fq(onto)30 b(the)g(operand)f(stack.)44 -b(This)29 b(is)h(an)e(instance)i(of)f(the)h(class)f Fh -(java.io.PrintStream)p Fq(.)39 b(The)0 2025 y Fh(ldc)25 -b Fq(\(\223Load)g(constant\224\))i(pushes)f(a)f(r)n(efer)n(ence)h(to)g -(the)g(string)h(\224Hello)e(world\224)h(on)g(the)g(stack.)33 -b(The)0 2145 y(next)28 b(instr)o(uction)j(invokes)e(the)f(instance)g -(method)g Fh(println)f Fq(which)h(takes)g(both)h(values)f(as)g(pa-)0 -2265 y(rameters)36 b(\(Instance)g(methods)g(always)h(implicitly)f(take) -g(an)g(instance)g(r)n(efer)n(ence)g(as)f(their)i(\002rst)0 -2386 y(ar)n(gument\).)146 2511 y(Instr)o(uctions,)24 -b(other)d(data)g(str)o(uctur)n(es)i(within)e(the)g(class)g(\002le)f -(and)h(constants)h(themselves)f(may)0 2632 y(r)n(efer)33 -b(to)g(constants)h(in)f(the)f(constant)i(pool.)54 b(Such)33 -b(r)n(efer)n(ences)g(ar)n(e)g(implemented)f(via)g(\002xed)h(in-)0 -2752 y(dexes)h(encoded)g(dir)n(ectly)i(into)f(the)f(instr)o(uctions.)62 -b(This)34 b(is)g(illustrated)i(for)f(some)f(items)h(of)g(the)0 -2872 y(\002gur)n(e)26 b(emphasized)e(with)h(a)g(surr)n(ounding)i(box.) -146 2998 y(For)h(example,)f(the)h Fh(invokevirtual)c -Fq(instr)o(uction)29 b(r)n(efers)f(to)g(a)f Fh(MethodRef)e -Fq(constant)j(that)0 3118 y(contains)34 b(information)h(about)f(the)g -(name)f(of)h(the)f(called)g(method,)j(the)d(signatur)n(e)i(\(i.e.)56 -b(the)33 b(en-)0 3238 y(coded)38 b(ar)n(gument)h(and)f(r)n(eturn)h -(types\),)j(and)c(to)h(which)f(class)h(the)f(method)h(belongs.)71 -b(In)37 b(fact,)0 3359 y(as)c(emphasized)f(by)h(the)g(boxed)g(value,)i -(the)e Fh(MethodRef)d Fq(constant)35 b(itself)e(just)h(r)n(efers)f(to)h -(other)0 3479 y(entries)23 b(holding)f(the)h(r)n(eal)f(data,)g(e.g.)30 -b(it)23 b(r)n(efers)g(to)g(a)f Fh(ConstantClass)d Fq(entry)k -(containing)g(a)f(sym-)0 3599 y(bolic)36 b(r)n(efer)n(ence)h(to)f(the)g -(class)g Fh(java.io.PrintStream)p Fq(.)60 b(T)-9 b(o)36 -b(keep)f(the)h(class)g(\002le)g(compact,)0 3720 y(such)29 -b(constants)i(ar)n(e)e(typically)h(shar)n(ed)f(by)g(dif)n(fer)n(ent)h -(instr)o(uctions.)45 b(Similarly)-11 b(,)30 b(a)f(\002eld)f(is)h(r)n -(epr)n(e-)0 3840 y(sented)23 b(by)g(a)f Fh(Fieldref)f -Fq(constant)k(that)e(includes)g(information)h(about)g(the)f(name,)f -(the)h(type)g(and)0 3961 y(the)i(containing)h(class)g(of)f(the)g -(\002eld.)146 4086 y(The)37 b(constant)i(pool)f(basically)g(holds)f -(the)h(following)g(types)g(of)g(constants:)57 b(Refer)n(ences)37 -b(to)0 4206 y(methods,)25 b(\002elds)g(and)g(classes,)g(strings,)i -(integers,)f(\003oats,)f(longs,)h(and)e(doubles.)0 4540 -y Fm(2.2)119 b(Byte)30 b(code)g(instruction)f(set)0 4741 -y Fq(The)f(JVM)h(is)f(a)g(stack-oriented)i(interpr)n(eter)g(that)f(cr)n -(eates)g(a)f(local)g(stack)i(frame)e(of)h(\002xed)f(size)g(for)0 -4861 y(every)21 b(method)f(invocation.)31 b(The)19 b(size)h(of)h(the)f -(local)h(stack)g(has)f(to)h(be)f(computed)g(by)h(the)f(compiler)-7 -b(.)0 4981 y(V)e(alues)21 b(may)h(also)g(be)f(stor)n(ed)i -(intermediately)f(in)f(a)h(frame)f(ar)n(ea)h(containing)g -Fp(local)f(variables)g Fq(which)0 5102 y(can)28 b(be)g(used)g(like)h(a) -f(set)h(of)f(r)n(egisters.)43 b(These)28 b(local)g(variables)h(ar)n(e)f -(number)n(ed)h(fr)n(om)g(0)f(to)h(65535,)0 5222 y(i.e.)60 -b(you)36 b(have)e(a)h(maximum)g(of)g(65536)f(of)h(local)g(variables.)61 -b(The)34 b(stack)i(frames)f(of)g(caller)g(and)0 5342 -y(callee)25 b(method)i(ar)n(e)f(overlapping,)h(i.e.)34 -b(the)26 b(caller)g(pushes)g(ar)n(guments)h(onto)h(the)e(operand)g -(stack)0 5463 y(and)f(the)g(called)f(method)i(r)n(eceives)f(them)g(in)g -(local)g(variables.)1888 5712 y(5)p eop -%%Page: 6 6 -6 5 bop 146 407 a Fq(The)32 b(byte)g(code)g(instr)o(uction)j(set)d -(curr)n(ently)i(consists)f(of)g(212)e(instr)o(uctions,)36 -b(44)31 b(opcodes)i(ar)n(e)0 527 y(marked)g(as)g(r)n(eserved)g(and)g -(may)g(be)f(used)h(for)h(futur)n(e)g(extensions)g(or)g(intermediate)f -(optimiza-)0 648 y(tions)22 b(within)f(the)g(V)-5 b(irtual)21 -b(Machine.)29 b(The)21 b(instr)o(uction)i(set)e(can)g(be)g(r)n(oughly)h -(gr)n(ouped)g(as)f(follows:)0 893 y Fg(Stack)k(operations:)49 -b Fq(Constants)26 b(can)e(be)h(pushed)f(onto)i(the)f(stack)g(either)g -(by)g(loading)g(them)g(fr)n(om)244 1013 y(the)f(constant)h(pool)f(with) -h(the)e Fh(ldc)g Fq(instr)o(uction)j(or)f(with)f(special)g -(\223short-cut\224)h(instr)o(uctions)244 1134 y(wher)n(e)37 -b(the)g(operand)f(is)h(encoded)g(into)g(the)g(instr)o(uctions,)43 -b(e.g.)66 b Fh(iconst)p 3211 1134 30 4 v 34 w(0)37 b -Fq(or)g Fh(bipush)244 1254 y Fq(\(push)25 b(byte)h(value\).)0 -1469 y Fg(Arithmetic)e(operations:)50 b Fq(The)36 b(instr)o(uction)k -(set)d(of)h(the)f(Java)h(V)-5 b(irtual)37 b(Machine)g(distinguishes)244 -1590 y(its)24 b(operand)e(types)i(using)g(dif)n(fer)n(ent)g(instr)o -(uctions)h(to)f(operate)f(on)h(values)f(of)g(speci\002c)h(type.)244 -1710 y(Arithmetic)32 b(operations)g(starting)i(with)d -Fh(i)p Fq(,)i(for)f(example,)h(denote)e(an)g(integer)h(operation.)244 -1831 y(E.g.,)k Fh(iadd)e Fq(that)h(adds)f(two)h(integers)g(and)f -(pushes)g(the)g(r)n(esult)i(back)e(on)h(the)f(stack.)60 -b(The)244 1951 y(Java)23 b(types)h Fh(boolean)p Fq(,)d -Fh(byte)p Fq(,)i Fh(short)p Fq(,)f(and)g Fh(char)g Fq(ar)n(e)h(handled) -f(as)h(integers)h(by)g(the)f(JVM.)0 2166 y Fg(Control)j(\003ow:)49 -b Fq(Ther)n(e)40 b(ar)n(e)g(branch)h(instr)o(uctions)i(like)d -Fh(goto)g Fq(and)g Fh(if)p 2836 2166 V 35 w(icmpeq)p -Fq(,)j(which)d(com-)244 2287 y(par)n(es)32 b(two)h(integers)g(for)h -(equality)-11 b(.)52 b(Ther)n(e)33 b(is)f(also)h(a)f -Fh(jsr)f Fq(\(jump)i(sub-r)n(outine\))h(and)e Fh(ret)244 -2407 y Fq(pair)26 b(of)i(instr)o(uctions)h(that)e(is)g(used)f(to)h -(implement)g(the)f Fh(finally)f Fq(clause)i(of)g Fh(try-catch)244 -2528 y Fq(blocks.)32 b(Exceptions)26 b(may)f(be)g(thr)n(own)h(with)g -(the)f Fh(athrow)e Fq(instr)o(uction.)244 2696 y(Branch)30 -b(tar)n(gets)i(ar)n(e)f(coded)f(as)h(of)n(fsets)h(fr)n(om)f(the)g(curr) -n(ent)g(byte)g(code)g(position,)i(i.e.)46 b(with)244 -2816 y(an)25 b(integer)g(number)-7 b(.)0 3031 y Fg(Load)25 -b(and)f(store)i(operations)49 b Fq(for)31 b(local)h(variables)f(like)f -Fh(iload)g Fq(and)g Fh(istore)p Fq(.)47 b(Ther)n(e)31 -b(ar)n(e)g(also)244 3152 y(array)26 b(operations)g(like)f -Fh(iastore)e Fq(which)i(stor)n(es)i(an)d(integer)i(value)f(into)g(an)g -(array)-11 b(.)0 3367 y Fg(Field)25 b(access:)50 b Fq(The)24 -b(value)g(of)h(an)f(instance)h(\002eld)f(may)g(be)g(r)n(etrieved)i -(with)e Fh(getfield)f Fq(and)h(writ-)244 3488 y(ten)d(with)g -Fh(putfield)p Fq(.)28 b(For)22 b(static)g(\002elds,)g(ther)n(e)g(ar)n -(e)f Fh(getstatic)e Fq(and)h Fh(putstatic)f Fq(coun-)244 -3608 y(terparts.)0 3824 y Fg(Method)25 b(invocation:)50 -b Fq(Methods)20 b(may)f(either)g(be)g(called)f(via)h(static)h(r)n(efer) -n(ences)g(with)f Fh(invokesta-)244 3944 y(tic)40 b Fq(or)i(be)f(bound)g -(virtually)i(with)e(the)g Fh(invokevirtual)e Fq(instr)o(uction.)81 -b(Super)41 b(class)244 4064 y(methods)25 b(and)g(private)g(methods)h -(ar)n(e)f(invoked)h(with)f Fh(invokespecial)p Fq(.)0 -4280 y Fg(Object)g(allocation:)50 b Fq(Class)28 b(instances)g(ar)n(e)g -(allocated)g(with)h(the)f Fh(new)f Fq(instr)o(uction,)k(arrays)e(of)f -(ba-)244 4400 y(sic)j(type)g(like)f Fh(int[])f Fq(with)i -Fh(newarray)p Fq(,)f(arrays)i(of)f(r)n(efer)n(ences)g(like)f -Fh(String[][])e Fq(with)244 4521 y Fh(anewarray)23 b -Fq(or)i Fh(multianewarray)p Fq(.)0 4736 y Fg(Conversion)h(and)e(type)h -(checking:)49 b Fq(For)23 b(stack)g(operands)g(of)f(basic)g(type)h -(ther)n(e)f(exist)h(casting)g(op-)244 4856 y(erations)35 -b(like)e Fh(f2i)g Fq(which)i(converts)g(a)e(\003oat)h(value)g(into)h -(an)e(integer)-7 b(.)58 b(The)33 b(validity)i(of)f(a)244 -4977 y(type)24 b(cast)h(may)f(be)f(checked)h(with)g Fh(checkcast)e -Fq(and)i(the)g Fh(instanceof)d Fq(operator)k(can)f(be)244 -5097 y(dir)n(ectly)i(mapped)e(to)i(the)f(equally)g(named)f(instr)o -(uction.)146 5342 y(Most)38 b(instr)o(uctions)i(have)c(a)h(\002xed)g -(length,)j(but)d(ther)n(e)g(ar)n(e)g(also)g(some)g(variable-length)h -(in-)0 5463 y(str)o(uctions:)59 b(In)37 b(particular)-7 -b(,)41 b(the)d Fh(lookupswitch)c Fq(and)j Fh(tableswitch)f -Fq(instr)o(uctions,)43 b(which)1888 5712 y(6)p eop -%%Page: 7 7 -7 6 bop 0 407 a Fq(ar)n(e)31 b(used)f(to)h(implement)g -Fh(switch\(\))d Fq(statements.)49 b(Since)31 b(the)g(number)f(of)h -Fh(case)f Fq(clauses)h(may)0 527 y(vary)-11 b(,)26 b(these)f(instr)o -(uctions)i(contain)f(a)f(variable)g(number)g(of)g(statements.)146 -648 y(W)-9 b(e)27 b(will)g(not)h(list)g(all)f(byte)h(code)g(instr)o -(uctions)i(her)n(e,)e(since)f(these)h(ar)n(e)f(explained)g(in)g(detail) -g(in)0 768 y(the)g(JVM)g(speci\002cation.)37 b(The)26 -b(opcode)h(names)f(ar)n(e)h(mostly)h(self-explaining,)f(so)g -(understanding)0 888 y(the)e(following)h(code)g(examples)e(should)i(be) -e(fairly)i(intuitive.)0 1183 y Fm(2.3)119 b(Method)30 -b(code)0 1373 y Fq(Non-abstract)35 b(methods)g(contain)f(an)g -(attribute)h(\()p Fh(Code)p Fq(\))e(that)h(holds)g(the)g(following)h -(data:)48 b(The)0 1493 y(maximum)27 b(size)f(of)h(the)f(method's)h -(stack)g(frame,)g(the)f(number)h(of)g(local)g(variables)f(and)g(an)g -(array)0 1614 y(of)i(byte)h(code)f(instr)o(uctions.)43 -b(Optionally)-11 b(,)29 b(it)g(may)f(also)g(contain)h(information)g -(about)g(the)f(names)0 1734 y(of)d(local)h(variables)f(and)g(sour)n(ce) -h(\002le)f(line)f(numbers)i(that)f(can)g(be)g(used)g(by)g(a)g(debugger) --7 b(.)146 1855 y(Whenever)23 b(an)h(exception)h(is)f(thr)n(own,)h(the) -f(JVM)g(performs)h(exception)f(handling)g(by)g(looking)0 -1975 y(into)31 b(a)f(table)h(of)g(exception)g(handlers.)47 -b(The)31 b(table)f(marks)h(handlers,)h(i.e.)47 b(pieces)30 -b(of)h(code,)h(to)f(be)0 2095 y(r)n(esponsible)23 b(for)h(exceptions)f -(of)h(certain)f(types)g(that)g(ar)n(e)g(raised)g(within)g(a)f(given)h -(ar)n(ea)f(of)i(the)e(byte)0 2216 y(code.)63 b(When)35 -b(ther)n(e)g(is)h(no)g(appr)n(opriate)g(handler)f(the)h(exception)g(is) -g(pr)n(opagated)g(back)g(to)h(the)0 2336 y(caller)29 -b(of)h(the)f(method.)43 b(The)29 b(handler)g(information)h(is)f(itself) -h(stor)n(ed)g(in)f(an)g(attribute)i(contained)0 2456 -y(within)25 b(the)h Fh(Code)e Fq(attribute.)0 2751 y -Fm(2.4)119 b(Byte)30 b(code)g(of)n(fsets)0 2941 y Fq(T)-9 -b(ar)n(gets)32 b(of)g(branch)f(instr)o(uctions)j(like)d -Fh(goto)f Fq(ar)n(e)h(encoded)g(as)g(r)n(elative)h(of)n(fsets)g(in)f -(the)h(array)f(of)0 3062 y(byte)i(codes.)55 b(Exception)33 -b(handlers)g(and)f(local)h(variables)g(r)n(efer)g(to)g(absolute)h(addr) -n(esses)e(within)0 3182 y(the)26 b(byte)g(code.)34 b(The)26 -b(former)h(contains)f(r)n(efer)n(ences)h(to)g(the)f(start)h(and)e(the)h -(end)g(of)g(the)g Fh(try)f Fq(block,)0 3302 y(and)d(to)i(the)e(instr)o -(uction)j(handler)e(code.)30 b(The)22 b(latter)h(marks)h(the)e(range)h -(in)g(which)g(a)f(local)h(variable)0 3423 y(is)g(valid,)f(i.e.)30 -b(its)23 b(scope.)30 b(This)23 b(makes)f(it)h(dif)n(\002cult)h(to)f -(insert)g(or)g(delete)f(code)g(ar)n(eas)h(on)f(this)h(level)f(of)0 -3543 y(abstraction,)29 b(since)f(one)f(has)g(to)h(r)n(ecompute)g(the)f -(of)n(fsets)i(every)f(time)f(and)g(update)f(the)i(r)n(eferring)0 -3663 y(objects.)k(W)-9 b(e)24 b(will)h(see)g(in)g(section)h(3.3)e(how)i -Fo(BCEL)i Fq(r)n(emedies)d(this)h(r)n(estriction.)0 3958 -y Fm(2.5)119 b(T)-11 b(ype)30 b(information)0 4148 y -Fq(Java)k(is)h(a)f(type-safe)h(language)f(and)g(the)g(information)i -(about)f(the)f(types)h(of)g(\002elds,)i(local)d(vari-)0 -4269 y(ables,)27 b(and)g(methods)g(is)g(stor)n(ed)h(in)f -Fp(signatur)n(es)p Fq(.)37 b(These)26 b(ar)n(e)h(strings)i(stor)n(ed)f -(in)f(the)g(constant)h(pool)0 4389 y(and)35 b(encoded)h(in)f(a)g -(special)h(format.)64 b(For)36 b(example)f(the)h(ar)n(gument)h(and)e(r) -n(eturn)h(types)h(of)f(the)0 4509 y Fh(main)24 b Fq(method)120 -4688 y Fh(public)58 b(static)g(void)h(main\(String[])e(argv\))146 -4866 y Fq(ar)n(e)25 b(r)n(epr)n(esented)h(by)f(the)g(signatur)n(e)120 -5044 y Fh(\([java/lang/String;\)V)146 5222 y Fq(Classes)19 -b(and)g(arrays)h(ar)n(e)f(internally)g(r)n(epr)n(esented)h(by)f -(strings)i(like)e Fh("java/lang/String")p Fq(,)0 5342 -y(basic)k(types)g(like)g Fh(float)e Fq(by)i(an)f(integer)h(number)-7 -b(.)30 b(W)-5 b(ithin)22 b(signatur)n(es)i(they)f(ar)n(e)g(r)n(epr)n -(esented)g(by)0 5463 y(single)i(characters,)h(e.g.,)f -Fh("I")p Fq(,)f(for)i(integer)-7 b(.)1888 5712 y(7)p -eop -%%Page: 8 8 -8 7 bop 0 407 a Fm(2.6)119 b(Code)30 b(example)0 608 -y Fq(The)25 b(following)i(example)e(pr)n(ogram)i(pr)n(ompts)g(for)f(a)f -(number)h(and)f(prints)h(the)g(faculty)g(of)g(it.)33 -b(The)0 728 y Fh(readLine\(\))19 b Fq(method)i(r)n(eading)g(fr)n(om)h -(the)f(standar)n(d)h(input)f(may)g(raise)g(an)g Fh(IOException)d -Fq(and)0 849 y(if)h(a)g(misspelled)f(number)h(is)h(passed)e(to)i -Fh(parseInt\(\))d Fq(it)i(thr)n(ows)i(a)e Fh(NumberFormatException)p -Fq(.)0 969 y(Thus,)25 b(the)g(critical)h(ar)n(ea)f(of)h(code)f(must)g -(be)g(encapsulated)g(in)g(a)f Fh(try-catch)f Fq(block.)0 -1230 y Ff(import)52 b(java.io.*;)0 1343 y(public)g(class)g(Faculty)f({) -109 1456 y(private)g(static)h(BufferedReader)c(in)54 -b(=)g(new)f(BufferedReader\(n)o(ew)1745 1569 y(InputStreamReade)o(r\()o -(Sy)o(st)o(em.)o(in)o(\)\))o(;)109 1682 y(public)f(static)g(final)g -(int)h(fac\(int)f(n\))h({)218 1795 y(return)f(\(n)i(==)f(0\)?)g(1)i(:)f -(n)g(*)g(fac\(n)e(-)i(1\);)109 1907 y(})109 2020 y(public)e(static)g -(final)g(int)h(readInt\(\))e({)218 2133 y(int)i(n)h(=)h(4711;)218 -2246 y(try)e({)327 2359 y(System.out.prin)o(t\(")o(Pl)o(ea)o(se)48 -b(enter)k(a)i(number>)e("\);)327 2472 y(n)i(=)g(Integer.parseInt)o(\(i) -o(n.)o(re)o(adL)o(in)o(e\()o(\)\))o(;)218 2585 y(})g(catch\(IOExcepti)o -(on)48 b(e1\))53 b({)h(System.err.print)o(ln)o(\(e)o(1\))o(;)48 -b(})327 2698 y(catch\(NumberFor)o(mat)o(Ex)o(ce)o(pt)o(io)o(n)h(e2\))k -({)h(System.err.pri)o(ntl)o(n\()o(e2)o(\);)48 b(})218 -2811 y(return)k(n;)109 2924 y(})109 3037 y(public)g(static)g(void)g -(main\(String[])d(argv\))j({)218 3149 y(int)h(n)h(=)h(readInt\(\);)218 -3262 y(System.out.prin)o(tl)o(n\(")o(Fa)o(cu)o(lt)o(y)48 -b(of)54 b(")g(+)g(n)g(+)g(")h(is)e(")h(+)g(fac\(n\)\);)109 -3375 y(}})146 3631 y Ft(This)23 b(code)f(example)g(typically)h -(compiles)g(to)f(the)g(following)h(chunks)e(of)i(byte)f(code:)0 -3921 y Fg(2.6.1)99 b(Method)25 b(fac)0 4108 y Ff(0:)108 -b(iload_0)0 4221 y(1:)g(ifne)653 b(#8)0 4334 y(4:)108 -b(iconst_1)0 4447 y(5:)g(goto)653 b(#16)0 4560 y(8:)108 -b(iload_0)0 4672 y(9:)g(iload_0)0 4785 y(10:)53 b(iconst_1)0 -4898 y(11:)g(isub)0 5011 y(12:)g(invokestatic)213 b(Faculty.fac)49 -b(\(I\)I)k(\(12\))0 5124 y(15:)g(imul)0 5237 y(16:)g(ireturn)0 -5463 y(LocalVariable\(s)o(ta)o(rt)o(_p)o(c)c(=)54 b(0,)f(length)f(=)i -(16,)f(index)g(=)h(0:int)e(n\))1888 5712 y Fq(8)p eop -%%Page: 9 9 -9 8 bop 146 407 a Ft(The)21 b(method)f Ff(fac)h Ft(has)g(only)g(one)g -(local)i(variable,)g(the)e(ar)n(gument)g Ff(n)p Ft(,)g(stor)n(ed)f(in)i -(slot)f(0.)28 b(This)21 b(variable's)0 520 y(scope)k(ranges)g(fr)n(om)h -(the)g(start)f(of)h(the)f(byte)g(code)g(sequence)g(to)g(the)g(very)h -(end.)37 b(If)26 b(the)f(value)i(of)f Ff(n)g Ft(\(stor)n(ed)0 -633 y(in)i(local)h(variable)g(0,)g(i.e.)41 b(the)27 b(value)h(fetched)e -(with)i Ff(iload)p 2148 633 28 4 v 30 w(0)p Ft(\))f(is)h(not)e(equal)i -(to)f(0,)h(the)f Ff(ifne)e Ft(instr)o(uction)0 746 y(branches)20 -b(to)f(the)g(byte)g(code)g(at)h(of)n(fset)f(8,)h(otherwise)e(a)j(1)f -(is)g(pushed)e(onto)g(the)h(operand)g(stack)g(and)h(the)f(con-)0 -858 y(tr)n(ol)24 b(\003ow)h(branches)f(to)g(the)f(\002nal)i(r)n(eturn.) -33 b(For)23 b(ease)h(of)g(r)n(eading,)g(the)g(of)n(fsets)f(of)h(the)g -(branch)h(instr)o(uctions,)0 971 y(which)e(ar)n(e)g(actually)h(r)n -(elative,)f(ar)n(e)g(displayed)f(as)g(absolute)h(addr)n(esses)d(in)j -(these)e(examples.)146 1084 y(If)27 b(r)n(ecursion)f(has)g(to)g -(continue,)h(the)f(ar)n(guments)f(for)i(the)e(multiplication)j(\()p -Ff(n)f Ft(and)f Ff(fac\(n)53 b(-)h(1\))p Ft(\))26 b(ar)n(e)0 -1197 y(evaluated)21 b(and)g(the)f(r)n(esults)g(pushed)f(onto)h(the)g -(operand)f(stack.)27 b(After)20 b(the)h(multiplication)h(operation)e -(has)0 1310 y(been)i(performed)f(the)h(function)h(r)n(eturns)e(the)h -(computed)f(value)i(fr)n(om)g(the)f(top)g(of)h(the)e(stack.)0 -1569 y Fg(2.6.2)99 b(Method)25 b(readInt)0 1745 y Ff(0:)108 -b(sipush)434 b(4711)0 1858 y(3:)108 b(istore_0)0 1971 -y(4:)g(getstatic)269 b(java.lang.Syst)o(em.)o(ou)o(t)48 -b(Ljava/io/PrintS)o(tre)o(am)o(;)0 2084 y(7:)108 b(ldc)599 -b("Please)51 b(enter)h(a)j(number>)c(")0 2197 y(9:)108 -b(invokevirtual)49 b(java.io.PrintS)o(tre)o(am)o(.p)o(ri)o(nt)f -(\(Ljava/lang/Str)o(in)o(g;)o(\)V)0 2310 y(12:)53 b(getstatic)269 -b(Faculty.in)50 b(Ljava/io/Buffe)o(red)o(Re)o(ad)o(er)o(;)0 -2423 y(15:)j(invokevirtual)c(java.io.Buffer)o(edR)o(ea)o(de)o(r.)o(re)o -(adL)o(in)o(e)f(\(\)Ljava/lang/St)o(rin)o(g;)0 2536 y(18:)53 -b(invokestatic)104 b(java.lang.Inte)o(ger)o(.p)o(ar)o(se)o(In)o(t)49 -b(\(Ljava/lang/St)o(ri)o(ng)o(;\))o(I)0 2649 y(21:)k(istore_0)0 -2762 y(22:)g(goto)544 b(#44)0 2875 y(25:)53 b(astore_1)0 -2987 y(26:)g(getstatic)269 b(java.lang.Syst)o(em.)o(er)o(r)48 -b(Ljava/io/PrintS)o(tre)o(am)o(;)0 3100 y(29:)53 b(aload_1)0 -3213 y(30:)g(invokevirtual)c(java.io.PrintS)o(tre)o(am)o(.p)o(ri)o(nt)o -(ln)f(\(Ljava/lang/Obj)o(ec)o(t;)o(\)V)0 3326 y(33:)53 -b(goto)544 b(#44)0 3439 y(36:)53 b(astore_1)0 3552 y(37:)g(getstatic) -269 b(java.lang.Syst)o(em.)o(er)o(r)48 b(Ljava/io/PrintS)o(tre)o(am)o -(;)0 3665 y(40:)53 b(aload_1)0 3778 y(41:)g(invokevirtual)c -(java.io.PrintS)o(tre)o(am)o(.p)o(ri)o(nt)o(ln)f(\(Ljava/lang/Obj)o(ec) -o(t;)o(\)V)0 3891 y(44:)53 b(iload_0)0 4004 y(45:)g(ireturn)0 -4229 y(Exception)d(handler\(s\))g(=)0 4342 y(From)216 -b(To)327 b(Handler)51 b(Type)0 4455 y(4)381 b(22)327 -b(25)f(java.io.IOExcep)o(ti)o(on)o(\(6\))0 4568 y(4)381 -b(22)327 b(36)f(NumberFormatExc)o(ep)o(ti)o(on\()o(10)o(\))146 -4785 y Ft(First)34 b(the)g(local)j(variable)f Ff(n)f -Ft(\(in)g(slot)g(0\))g(is)g(initialized)i(to)d(the)g(value)h(4711.)67 -b(The)34 b(next)g(instr)o(uction,)0 4898 y Ff(getstatic)p -Ft(,)f(loads)i(the)f(static)g Ff(System.out)d Ft(\002eld)j(onto)f(the)h -(stack.)64 b(Then)34 b(a)h(string)e(is)i(loaded)f(and)0 -5011 y(printed,)21 b(a)i(number)g(r)n(ead)f(fr)n(om)h(the)f(standar)n -(d)g(input)h(and)f(assigned)f(to)h Ff(n)p Ft(.)146 5124 -y(If)g(one)f(of)h(the)f(called)h(methods)e(\()p Ff(readLine\(\))e -Ft(and)k Ff(parseInt\(\))p Ft(\))17 b(thr)n(ows)k(an)h(exception,)f -(the)f(Java)0 5237 y(V)-5 b(irtual)26 b(Machine)h(calls)h(one)d(of)h -(the)f(declar)n(ed)h(exception)f(handlers,)h(depending)e(on)h(the)g -(type)g(of)h(the)f(ex-)0 5350 y(ception.)36 b(The)24 -b Ff(try)p Ft(-clause)h(itself)h(does)e(not)g(pr)n(oduce)h(any)g(code,) -g(it)h(mer)n(ely)f(de\002nes)f(the)h(range)g(in)h(which)0 -5463 y(the)e(following)h(handlers)f(ar)n(e)h(active.)35 -b(In)24 b(the)g(example)g(the)g(speci\002ed)g(sour)n(ce)g(code)g(ar)n -(ea)h(maps)g(to)f(a)h(byte)1888 5712 y Fq(9)p eop -%%Page: 10 10 -10 9 bop 0 407 a Ft(code)23 b(ar)n(ea)h(ranging)f(fr)n(om)h(of)n(fset)f -(4)h(\(inclusive\))h(to)e(22)h(\(exclusive\).)31 b(If)24 -b(no)f(exception)f(has)h(occurr)n(ed)g(\(\223nor)n(-)0 -520 y(mal\224)i(execution)e(\003ow\))h(the)f Ff(goto)f -Ft(instr)o(uctions)h(branch)i(behind)e(the)g(handler)g(code.)31 -b(Ther)n(e)23 b(the)g(value)h(of)0 633 y Ff(n)e Ft(is)h(loaded)f(and)h -(r)n(eturned.)146 750 y(For)e(example)g(the)f(handler)h(for)g -Ff(java.io.IOExcep)o(ti)o(on)15 b Ft(starts)20 b(at)h(of)n(fset)g(25.) -28 b(It)20 b(simply)i(prints)e(the)0 863 y(err)n(or)i(and)h(branches)f -(back)i(to)e(the)f(normal)j(execution)d(\003ow)-8 b(,)22 -b(i.e.)28 b(as)23 b(if)g(no)f(exception)g(had)g(occurr)n(ed.)0 -1223 y Fr(3)143 b(The)35 b(BCEL)g(API)0 1443 y Ft(The)25 -b Fe(BCEL)j Ft(API)d(abstracts)h(fr)n(om)g(the)f(concr)n(ete)h(cir)n -(cumstances)g(of)g(the)f(Java)j(V)-5 b(irtual)26 b(Machine)h(and)f(how) -0 1556 y(to)c(r)n(ead)h(and)f(write)g(binary)i(Java)g(class)f(\002les.) -k(The)22 b(API)g(mainly)i(consists)d(of)i(thr)n(ee)f(parts:)127 -1795 y(1.)49 b(A)26 b(package)f(that)h(contains)g(classes)g(that)g -(describe)f(\223static\224)i(constraints)e(of)h(class)h(\002les,)f -(i.e.,)g(r)n(e\003ect)244 1908 y(the)g(class)h(\002le)f(format)h(and)g -(is)f(not)g(intended)f(for)h(byte)g(code)g(modi\002cations.)39 -b(The)26 b(classes)g(may)h(be)244 2021 y(used)e(to)h(r)n(ead)g(and)h -(write)f(class)g(\002les)h(fr)n(om)g(or)f(to)g(a)h(\002le.)39 -b(This)26 b(is)h(useful)f(especially)g(for)h(analyzing)244 -2134 y(Java)34 b(classes)f(without)e(having)j(the)e(sour)n(ce)g -(\002les)g(at)h(hand.)59 b(The)32 b(main)i(data)f(str)o(uctur)n(e)e(is) -i(called)244 2247 y Ff(JavaClass)19 b Ft(which)k(contains)f(methods,)f -(\002elds,)g(etc..)127 2453 y(2.)49 b(A)23 b(package)h(to)f -(dynamically)i(generate)d(or)h(modify)h Ff(JavaClass)19 -b Ft(objects.)31 b(It)23 b(may)h(be)g(used)e(e.g.)30 -b(to)244 2565 y(insert)20 b(analysis)i(code,)e(to)h(strip)g -(unnecessary)e(information)j(fr)n(om)g(class)f(\002les,)g(or)g(to)g -(implement)g(the)244 2678 y(code)h(generator)f(back-end)h(of)h(a)g -(Java)h(compiler)-7 b(.)127 2884 y(3.)49 b(V)-8 b(arious)21 -b(code)g(examples)h(and)g(utilities)g(like)g(a)h(class)f(\002le)g -(viewer)-7 b(,)22 b(a)h(tool)e(to)h(convert)f(class)i(\002les)e(into) -244 2997 y(HTML,)g(and)i(a)g(converter)f(fr)n(om)h(class)g(\002les)f -(to)g(the)g(Jasmin)i(assembly)e(language)g([MD97)r(].)0 -3313 y Fm(3.1)119 b(JavaClass)0 3499 y Ft(The)16 b(\223static\224)j -(component)d(of)h(the)f Fe(BCEL)i Ft(API)e(r)n(esides)g(in)i(the)e -(package)h Ff(de.fub.bytecode)o(.c)o(la)o(ss)o(fi)o(le)0 -3612 y Ft(and)22 b(r)n(epr)n(esents)e(class)i(\002les.)27 -b(All)c(of)f(the)f(binary)i(components)d(and)i(data)g(str)o(uctur)n(es) -f(declar)n(ed)g(in)i(the)e(JVM)0 3725 y(speci\002cation)27 -b([L)-8 b(Y97])26 b(and)h(described)e(in)i(section)e(2)i(ar)n(e)g -(mapped)f(to)g(classes.)38 b(Figur)n(e)26 b(3)h(shows)e(an)i(UML)0 -3837 y(diagram)34 b(of)f(the)g(hierar)n(chy)g(of)h(classes)f(of)g(the)f -Fe(BCEL)k Ft(API.)c(Figur)n(e)h(8)h(in)f(the)g(appendix)f(also)i(shows) -e(a)0 3950 y(detailed)22 b(diagram)h(of)g(the)f Ff(ConstantPool)17 -b Ft(components.)146 4068 y(The)23 b(top-level)g(data)g(str)o(uctur)n -(e)g(is)g Ff(JavaClass)p Ft(,)c(which)24 b(in)g(most)f(cases)g(is)g(cr) -n(eated)g(by)g(a)h Ff(ClassPar-)0 4181 y(ser)d Ft(object)g(that)h(is)g -(capable)h(of)f(parsing)f(binary)i(class)f(\002les.)27 -b(A)22 b Ff(JavaClass)c Ft(object)k(basically)h(consists)e(of)0 -4294 y(\002elds,)h(methods,)e(symbolic)j(r)n(efer)n(ences)f(to)g(the)g -(super)f(class)i(and)g(to)f(the)f(implemented)h(interfaces.)146 -4411 y(The)c(constant)f(pool)g(serves)g(as)h(some)f(kind)g(of)h -(central)h(r)n(epository)c(and)j(is)g(thus)f(of)h(outstanding)e(impor)n -(-)0 4524 y(tance)29 b(for)g(all)h(components.)45 b Ff(ConstantPool)24 -b Ft(objects)k(contain)i(an)f(array)h(of)f(\002xed)f(size)h(of)g -Ff(Constant)0 4637 y Ft(entries,)34 b(which)g(may)f(be)g(r)n(etrieved)f -(via)i(the)f Ff(getConstant\(\))27 b Ft(method)32 b(taking)g(an)i -(integer)d(index)i(as)0 4750 y(ar)n(gument.)58 b(Indexes)31 -b(to)h(the)h(constant)f(pool)g(may)h(be)g(contained)g(in)g(instr)o -(uctions)f(as)i(well)f(as)g(in)g(other)0 4863 y(components)21 -b(of)h(a)i(class)f(\002le)f(and)h(in)g(constant)f(pool)g(entries)f -(themselves.)146 4980 y(Methods)j(and)i(\002elds)f(contain)h(a)g -(signatur)n(e,)g(symbolically)h(de\002ning)e(their)g(types.)35 -b(Access)25 b(\003ags)h(like)0 5093 y Ff(public)52 b(static)g(final)26 -b Ft(occur)i(in)h(several)f(places)h(and)f(ar)n(e)h(encoded)d(by)j(an)f -(integer)f(bit)i(mask,)g(e.g.)0 5206 y Ff(public)52 b(static)g(final)20 -b Ft(matches)j(to)f(the)f(Java)k(expr)n(ession)109 5463 -y Ff(int)53 b(access_flags)c(=)54 b(ACC_PUBLIC)c(|)55 -b(ACC_STATIC)50 b(|)k(ACC_FINAL;)1863 5712 y Fq(10)p -eop -%%Page: 11 11 -11 10 bop 570 5113 a @beginspecial 13 @llx 12 @lly 471 -@urx 830 @ury 3221 @rwi @setspecial -%%BeginDocument: eps/javaclass.eps -%!PS-Adobe-3.0 EPSF-3.0 -%%Title: Rose Diagram(s) -%%Creator: AdobePS5.dll Version 5.0 -%%CreationDate: 7/7/1999 17:45:7 -%%Pages: 1 -%%Orientation: Portrait -%%PageOrder: Ascend -%%DocumentNeededResources: (atend) -%%DocumentSuppliedResources: (atend) -%%DocumentData: Clean7Bit -%%TargetDevice: (HP LaserJet 5Si) (2014.108) 1 -%%LanguageLevel: 2 -%%BoundingBox: 13 12 471 830 -%%EndComments -%%BeginProcSet: epsffit 1 0 -gsave -1233.763 -187.599 translate -90 rotate -1.782 1.782 scale -%%EndProcSet - - -%%BeginDefaults -%%PageBoundingBox: 13 12 582 830 -%%EndDefaults - -%%BeginProlog -%%BeginResource: file Pscript_WinNT_ErrorHandler 5.0 0 -/currentpacking where{pop/oldpack currentpacking def/setpacking where{pop false -setpacking}if}if/$brkpage 64 dict def $brkpage begin/prnt{dup type/stringtype -ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch -def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0 -rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def -/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def/=={/cp 0 def -typeprint nl}def/typeprint{dup type exec}readonly def/lmargin 72 def/rmargin 72 -def/tprint{dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp -exch def prnt}readonly def/cvsprint{=string cvs tprint( )tprint}readonly def -/integertype{cvsprint}readonly def/realtype{cvsprint}readonly def/booleantype -{cvsprint}readonly def/operatortype{(--)tprint =string cvs tprint(-- )tprint} -readonly def/marktype{pop(-mark- )tprint}readonly def/dicttype{pop -(-dictionary- )tprint}readonly def/nulltype{pop(-null- )tprint}readonly def -/filetype{pop(-filestream- )tprint}readonly def/savetype{pop(-savelevel- ) -tprint}readonly def/fonttype{pop(-fontid- )tprint}readonly def/nametype{dup -xcheck not{(/)tprint}if cvsprint}readonly def/stringtype{dup rcheck{(\()tprint -tprint(\))tprint}{pop(-string- )tprint}ifelse}readonly def/arraytype{dup rcheck -{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}forall(]) -tprint}ifelse}{pop(-array- )tprint}ifelse}readonly def/packedarraytype{dup -rcheck{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint} -forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse}readonly def/courier -/Courier findfont 10 scalefont def end errordict/handleerror{systemdict begin -$error begin $brkpage begin newerror{/newerror false store vmstatus pop pop 0 -ne{grestoreall}if showpage initgraphics courier setfont lmargin 720 moveto -(ERROR: )prnt errorname prnt nl(OFFENDING COMMAND: )prnt/command load prnt -$error/ostack known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==} -repeat}if systemdict/showpage get exec(%%[ Error: )print errorname =print -(; OffendingCommand: )print/command load =print( ]%%)= flush}if end end end}dup -0 systemdict put dup 4 $brkpage put bind readonly put/currentpacking where{pop -/setpacking where{pop oldpack setpacking}if}if -%%EndResource -userdict /Pscript_WinNT_Incr 230 dict dup begin put -%%BeginResource: file Pscript_FatalError 5.0 0 -/FatalErrorIf{{initgraphics findfont exch scalefont setfont counttomark 3 div -cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def -%%EndResource -/VM?{vmstatus exch sub exch pop gt{[ -(This job requires more memory than is available in this printer.)100 500 -(Try one or more of the following, and then print again:)100 485 -(For the output format, choose Optimize For Portability.)115 470 -(In the Device Settings page, make sure the Available PostScript Memory is accurate.) -115 455(Reduce the number of fonts in the document.)115 440 -(Print the document in parts.)115 425 12/Times-Roman showpage -(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def -%%BeginResource: file Pscript_Win_Basic 5.0 0 -/d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^ -/index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/- -/rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true , -d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C -/closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M -/rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , d -/Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/show , d/LH/showpage -, d/K/stroke , d/W/widthshow , d/R/rotate , d/P/eoclip , d/L2? false -/languagelevel where{pop languagelevel 2 ge{pop true}if}if d L2?{/xS/xshow , d -/yS/yshow , d/zS/xyshow , d}if/b{bind d}bind d/bd{bind d}bind d/xd{~ d}bd/ld{, -d}bd/lw/Lw ld/lc/Lc ld/lj/Lj ld/sg/setgray ld/ADO_mxRot null d/self & d/OrgMx -matrix currentmatrix d/reinitialize{: OrgMx setmatrix[/TextInit/GraphInit -/UtilsInit counttomark{@ where{self eq}{F}?{cvx exec}{!}?}repeat cleartomark ;} -b/initialize{`{/ADO_mxRot ~ d/TextInitialised? F d reinitialize E}{U -/Pscript_Win_Data 230 dict @ ` put/ADO_mxRot ~ d/TextInitialised? F d -reinitialize}?}b/terminate{!{& self eq{exit}{E}?}loop E}b/suspend/terminate , d -/resume{` Pscript_Win_Data `}b/snap{transform 0.25 sub round 0.25 add ~ 0.25 -sub round 0.25 add ~ itransform}b/dsnap{dtransform round ~ round ~ idtransform} -b<04>cvn{}d/rr{1 ^ 0 - 0 ~ - neg 0 - C}b/rp{4 2 $ M 1 ^ 0 - 0 ~ - neg 0 -}b -/solid{[]0 sd}b/g{@ not{U/DefIf_save save put}if U/DefIf_bool 2 ^ put}b -/DefIf_El{if U/DefIf_bool get not @{U/DefIf_save get restore}if}b/e{DefIf_El !} -b/UDF{L2?{undefinefont}{!}?}b/UDR{L2?{undefineresource}{! !}?}b -%%EndResource -%%BeginResource: file Pscript_Win_Utils_L2 5.0 0 -/rf/rectfill , d/fx{1 1 dtransform @ 0 ge{1 sub 0.5}{1 add -0.5}? 3 -1 $ @ 0 ge -{1 sub 0.5}{1 add -0.5}? 3 1 $ 4 1 $ idtransform 4 -2 $ idtransform}b/BZ{4 -2 $ -snap + +S fx rf}b/rs/rectstroke , d/rc/rectclip , d/UtilsInit{currentglobal{F -setglobal}if}b/scol{! setcolor}b/colspA/DeviceGray d/colspABC/DeviceRGB d -/colspRefresh{colspABC setcolorspace}b/SetColSpace{colspABC setcolorspace}b -%%EndResource -end -%%EndProlog - -%%BeginSetup -[ 1 0 0 1 0 0 ] false Pscript_WinNT_Incr dup /initialize get exec -1 setlinecap 1 setlinejoin -/mysetup [ 0.24 0 0 -0.24 13.43905 829.74047 ] def -%%EndSetup - -%%Page: 1 1 -%%PageBoundingBox: 13 12 582 830 -%%EndPageComments -%%BeginPageSetup -/DeviceRGB dup setcolorspace /colspABC exch def mysetup concat colspRefresh -%%EndPageSetup - -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Win_GdiObject 5.0 0 -/SavedCTM null d/CTMsave{/SavedCTM SavedCTM currentmatrix d}b/CTMrestore -{SavedCTM setmatrix}b/mp null d/ADO_mxRot null d/GDIHMatrix null d -/GDIHPatternDict 22 dict d GDIHPatternDict `/PatternType 1 d/PaintType 2 d/Reps -L2?{1}{5}? d/XStep 8 Reps mul d/YStep XStep d/BBox[0 0 XStep YStep]d/TilingType -1 d/PaintProc{` 1 Lw[]0 sd PaintData , exec E}b/FGnd null d/BGnd null d -/HS_Horizontal{horiz}b/HS_Vertical{vert}b/HS_FDiagonal{fdiag}b/HS_BDiagonal -{biag}b/HS_Cross{horiz vert}b/HS_DiagCross{fdiag biag}b/MaxXYStep XStep YStep -gt{XStep}{YStep}? d/horiz{Reps{0 4 M XStep 0 - 0 8 +}repeat 0 -8 Reps mul + K}b -/vert{Reps{4 0 M 0 YStep - 8 0 +}repeat 0 -8 Reps mul + K}b/biag{Reps{0 0 M -MaxXYStep @ - 0 YStep neg M MaxXYStep @ - 0 8 +}repeat 0 -8 Reps mul + 0 YStep -M 8 8 - K}b/fdiag{Reps{0 0 M MaxXYStep @ neg - 0 YStep M MaxXYStep @ neg - 0 8 -+}repeat 0 -8 Reps mul + MaxXYStep @ M 8 -8 - K}b E/makehatch{4 -2 $/yOrg ~ d -/xOrg ~ d GDIHPatternDict/PaintData 3 -1 $ put CTMsave GDIHMatrix setmatrix -GDIHPatternDict matrix xOrg yOrg + mp CTMrestore ~ U ~ 2 ^ put}b/h0{/h0 -/HS_Horizontal makehatch}b/h1{/h1/HS_Vertical makehatch}b/h2{/h2/HS_FDiagonal -makehatch}b/h3{/h3/HS_BDiagonal makehatch}b/h4{/h4/HS_Cross makehatch}b/h5{/h5 -/HS_DiagCross makehatch}b/GDIBWPatternDict 25 dict @ `/PatternType 1 d -/PaintType L2?{1}{2}? d/RepsV L2?{1}{6}? d/RepsH L2?{1}{5}? d/BBox[0 0 RepsH 1] -d/TilingType 1 d/XStep 1 d/YStep 1 d/Height 8 RepsV mul d/Width 8 d/mx[Width 0 -0 Height neg 0 Height]d/FGnd null d/BGnd null d/SetBGndFGnd L2?{{FGnd null ne -{FGnd aload ! scol BBox aload ! 2 ^ sub ~ 3 ^ sub ~ rf}if BGnd null ne{BGnd -aload ! scol}if}}{{}}? b/PaintProc{` SetBGndFGnd RepsH{Width Height F mx -PaintData imagemask Width 0 +}repeat E}b E d/GDIBWPatternMx null d/pfprep{save -8 1 $/PatternOfTheDay 8 1 $ GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/yExt ~ d/Width ~ d/FGnd ~ d/BGnd ~ d/Height yExt RepsV mul d/mx[Width 0 0 -Height 0 0]d E : GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx -matrix currentmatrix d ; CTMsave GDIBWPatternMx setmatrix GDIBWPatternDict @ ` -xOrg yOrg E matrix + mp CTMrestore ~ !}b/pfbf{/fEOFill ~ d pfprep hbf fEOFill -{O}{L}? restore}b/GraphInit{GDIHMatrix null eq{/SavedCTM matrix d : ADO_mxRot -concat 0 0 snap + : 0.48 @ GDIHPatternDict ` YStep mul ~ XStep mul ~ dsnap -YStep V ~ XStep V ~ E +S/GDIHMatrix matrix currentmatrix readonly d ; : 0.24 --0.24 +S GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx matrix -currentmatrix readonly d ; ;}if}b -%%EndResource -%%BeginResource: file Pscript_Win_GdiObject_L2 5.0 0 -/mp/makepattern , d/hbf{setpattern}b/hf{:/fEOFill ~ d ~ ! setpattern fEOFill{O} -{L}? ;}b/pbf{: !/fEOFill ~ d GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/OutputBPP ~ d/Height ~ d/Width ~ d/PaintType 1 d/PatternType 1 d/TilingType 1 -d/BBox[0 0 Width Height]d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d -20 dict @ `/ImageType 1 d/Width Width d/Height Height d/ImageMatrix mx d -/BitsPerComponent 8 d OutputBPP 24 eq{/Decode[0 1 0 1 0 1]d}{OutputBPP 8 eq{ -/Decode[0 1]d}{/Decode[0 1 0 1 0 1 0 1]d}?}?/DataSource{PaintData}d E/ImageDict -~ d/PaintProc{` ImageDict image E}b & mx makepattern setpattern E fEOFill{O}{L} -? ;}b -%%EndResource -end reinitialize -: N 712 1406 246 93 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol 1 Lw N 958 1405 M 711 1405 I 711 1499 I 958 1499 I C -K -0 0 0 1 scol Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Text 5.0 0 -/TextInit{TextInitialised? not{/Pscript_Windows_Font & d/TextInitialised? T d -/fM[1 0 0 1 0 0]d/mFM matrix d/iMat[1 0 0.212557 1 0 0]d}if}b/copyfont{1 ^ -length add dict `{1 ^/FID ne{d}{! !}?}forall & E}b/EncodeDict 11 dict d/bullets -{{/bullet}repeat}b/rF{3 copyfont @ ` ~ EncodeDict ~ get/Encoding ~ 3 ^/0 eq{& -/CharStrings known{CharStrings/Eth known not{! EncodeDict/ANSIEncodingOld get} -if}if}if d E}b/mF{@ 7 1 $ findfont ~{@/Encoding get @ StandardEncoding eq{! T}{ -{ISOLatin1Encoding}stopped{! F}{eq}?{T}{@ ` T 32 1 127{Encoding 1 ^ get -StandardEncoding 3 -1 $ get eq and}for E}?}?}{F}?{1 ^ ~ rF}{0 copyfont}? 6 -2 $ -{T pd_AddEm87 ~ !}{! ~ !/pd_charset @ where{~ get 128 eq{@ FDV 2 copy get @ -length array copy put pd_CoverFCRange}if}{!}?}? 2 ^ ~ definefont fM 5 4 -1 $ -put fM 4 0 put fM makefont Pscript_Windows_Font 3 1 $ put}b/sLT{: Lw -M -currentpoint snap M 0 - 0 Lc K ;}b/xUP null d/yUP null d/uW null d/xSP null d -/ySP null d/sW null d/sSU{N/uW ~ d/yUP ~ d/xUP ~ d}b/sU{xUP yUP uW sLT}b/sST{N -/sW ~ d/ySP ~ d/xSP ~ d}b/sT{xSP ySP sW sLT}b/sR{: + R 0 0 M}b/sRxy{: matrix -astore concat 0 0 M}b/eR/; , d/AddOrigFP{{&/FontInfo known{&/FontInfo get -length 6 add}{6}? dict `/WinPitchAndFamily ~ d/WinCharSet ~ d/OrigFontType ~ d -/OrigFontStyle ~ d/OrigFontName ~ d & E/FontInfo ~ d}{! ! ! ! !}?}b/mFS -{makefont Pscript_Windows_Font 3 1 $ put}b/mF42D{0 copyfont `/FontName ~ d 2 -copy ~ sub 1 add dict `/.notdef 0 d 2 copy 1 ~{@ 3 ^ sub Encoding ~ get ~ d}for -& E/CharStrings ~ d ! ! & @ E/FontName get ~ definefont}bind d/mF42{15 dict ` @ -4 1 $/FontName ~ d/FontType 0 d/FMapType 2 d/FontMatrix[1 0 0 1 0 0]d 1 ^ 254 -add 255 idiv @ array/Encoding ~ d 0 1 3 -1 $ 1 sub{@ Encoding 3 1 $ put}for -/FDepVector Encoding length array d/CharStrings 2 dict `/.notdef 0 d & E d 0 1 -Encoding length 1 sub{@ @ 10 lt{! FontName length 1 add string}{100 lt{FontName -length 2 add string}{FontName length 3 add string}?}? @ 0 FontName @ length -string cvs putinterval @ 3 -1 $ @ 4 1 $ 3 string cvs FontName length ~ -putinterval cvn 1 ^ 256 mul @ 255 add 3 -1 $ 4 ^ findfont mF42D FDepVector 3 1 -$ put}for & @ E/FontName get ~ definefont ! ! ! mF}b/UmF{L2? -{Pscript_Windows_Font ~ undef}{!}?}b/UmF42{@ findfont/FDepVector get{/FontName -get undefinefont}forall undefinefont}b -%%EndResource -end reinitialize -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Encoding256 5.0 0 -/CharCol256Encoding[/.notdef/breve/caron/dotaccent/dotlessi/fi/fl/fraction -/hungarumlaut/Lslash/lslash/minus/ogonek/ring/Zcaron/zcaron/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/exclam/quotedbl/numbersign -/dollar/percent/ampersand/quotesingle/parenleft/parenright/asterisk/plus/comma -/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S -/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/grave -/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright -/asciitilde/.notdef/.notdef/.notdef/quotesinglbase/florin/quotedblbase/ellipsis -/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef -/.notdef/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet -/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef -/Ydieresis/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section -/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/.notdef/registered -/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph -/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter -/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis -/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute -/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls -/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute -/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve -/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex -/udieresis/yacute/thorn/ydieresis]def EncodeDict/256 CharCol256Encoding put -%%EndResource -end reinitialize - -%%IncludeResource: font Helvetica -F /F0 0 /256 T /Helvetica mF -/F0S1C F0 [28.75 0 0 -28.75 0 0 ] mFS -F0S1C Ji -735 1441 M (ExceptionTable)[19 13 15 16 16 8 7 16 16 19 16 16 7 0]xS -0.602 0 0.199 1 scol N 958 1456 M 711 1456 I 711 1499 I 958 1499 I C -K -N 958 1473 M 711 1473 I 711 1499 I 958 1499 I C -K -: N 1484 1418 275 93 rp C -1 1 0.801 1 scol L ; N 1759 1417 M 1483 1417 I 1483 1511 I 1759 1511 I C -K -0 0 0 1 scol 1505 1453 M (LineNumberTable)[16 7 16 16 21 16 25 16 16 10 19 16 16 7 0]xS -0.602 0 0.199 1 scol N 1759 1469 M 1483 1469 I 1483 1511 I 1759 1511 I C -K -N 1759 1485 M 1483 1485 I 1483 1511 I 1759 1511 I C -K -: N 1039 1411 318 253 rp C -1 1 0.801 1 scol L ; N 1357 1410 M 1038 1410 I 1038 1664 I 1357 1664 I C -K -0 0 0 1 scol 1163 1446 M (Code)[21 16 16 0]xS -0.602 0 0.199 1 scol N 1357 1462 M 1038 1462 I 1038 1664 I 1357 1664 I C -K -N 1357 1578 M 1038 1578 I 1038 1664 I 1357 1664 I C -K -0 0 0 1 scol 1083 1493 M (max_stack : int)[25 16 13 16 15 8 16 15 14 8 8 8 7 16 0]xS -1083 1527 M (max_locals : int)[25 16 13 16 7 16 15 16 7 15 8 8 8 7 16 0]xS -1083 1560 M (exception_handlers)[16 13 15 16 16 8 7 16 16 16 16 16 16 16 7 16 10 0]xS -1083 1626 M (getCode\(\))[16 16 8 21 16 16 16 10 0]xS -0.602 0 0.199 1 scol N 1420 1499 M 1358 1508 I K -N 1358 1508 M 1380 1516 I 1398 1502 I 1377 1494 I 1358 1508 I C -: 1 1 1 1 scol O ; K -N 1420 1499 M 1482 1487 I K -N 1462 1432 16 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1462 1459 M (1)S -N 1462 1432 16 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1462 1459 M (1)S -: N 1742 1576 291 93 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 2033 1575 M 1741 1575 I 1741 1669 I 2033 1669 I C -K -0 0 0 1 scol 1762 1611 M (LocalVariableTable)[16 16 15 16 7 19 16 10 7 16 16 7 16 19 16 16 7 0]xS -0.602 0 0.199 1 scol N 2033 1626 M 1741 1626 I 1741 1669 I 2033 1669 I C -K -N 2033 1643 M 1741 1643 I 1741 1669 I 2033 1669 I C -K -N 1549 1580 M 1358 1556 I K -N 1358 1556 M 1380 1547 I 1398 1562 I 1377 1570 I 1358 1556 I C -: 1 1 1 1 scol O ; K -N 1549 1580 M 1740 1603 I K -: N 1709 1625 15 34 rp C -1 1 1 1 scol L ; N 1709 1625 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1709 1652 M (1)S -: N 1709 1625 15 34 rp C -1 1 1 1 scol L ; N 1709 1625 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1709 1652 M (1)S -: N 1573 1128 218 93 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1791 1127 M 1572 1127 I 1572 1221 I 1791 1221 I C -K -0 0 0 1 scol 1597 1163 M (InnerClasses)[7 16 16 16 10 21 7 16 15 15 16 0]xS -0.602 0 0.199 1 scol N 1791 1178 M 1572 1178 I 1572 1221 I 1791 1221 I C -K -N 1791 1195 M 1572 1195 I 1572 1221 I 1791 1221 I C -K -: N 1855 1128 186 93 rp C -1 1 0.801 1 scol L ; N 2041 1127 M 1854 1127 I 1854 1221 I 2041 1221 I C -K -0 0 0 1 scol 1878 1163 M (SourceFile)[19 16 16 10 15 16 18 7 7 0]xS -0.602 0 0.199 1 scol N 2041 1178 M 1854 1178 I 1854 1221 I 2041 1221 I C -K -N 2041 1195 M 1854 1195 I 1854 1221 I 2041 1221 I C -K -: N 450 1406 190 93 rp C -1 1 0.801 1 scol L ; N 640 1405 M 449 1405 I 449 1499 I 640 1499 I C -K -0 0 0 1 scol 470 1441 M (Deprecated)[21 16 16 10 16 15 16 8 16 0]xS -0.602 0 0.199 1 scol N 640 1456 M 449 1456 I 449 1499 I 640 1499 I C -K -N 640 1473 M 449 1473 I 449 1499 I 640 1499 I C -K -: N 2049 1418 161 93 rp C -1 1 0.801 1 scol L ; N 2210 1417 M 2048 1417 I 2048 1511 I 2210 1511 I C -K -0 0 0 1 scol 2069 1453 M (Unknown)[21 16 14 16 16 21 0]xS -0.602 0 0.199 1 scol N 2210 1469 M 2048 1469 I 2048 1511 I 2210 1511 I C -K -N 2210 1485 M 2048 1485 I 2048 1511 I 2210 1511 I C -K -: N 2105 1128 171 93 rp C -1 1 0.801 1 scol L ; N 2276 1127 M 2104 1127 I 2104 1221 I 2276 1221 I C -K -0 0 0 1 scol 2131 1163 M (Synthetic)[19 13 16 8 16 16 8 7 0]xS -0.602 0 0.199 1 scol N 2276 1178 M 2104 1178 I 2104 1221 I 2276 1221 I C -K -N 2276 1195 M 2104 1195 I 2104 1221 I 2276 1221 I C -K -: N 521 1128 240 93 rp C -1 1 0.801 1 scol L ; N 761 1127 M 520 1127 I 520 1221 I 761 1221 I C -K -0 0 0 1 scol 546 1163 M (ConstantValue)[21 16 16 15 8 16 16 8 19 16 7 16 0]xS -0.602 0 0.199 1 scol N 761 1177 M 520 1177 I 520 1221 I 761 1221 I C -K -N 761 1193 M 520 1193 I 520 1221 I 761 1221 I C -K -: N 491 628 204 125 rp C -1 1 0.801 1 scol L ; N 695 627 M 490 627 I 490 753 I 695 753 I C -K -0.496 0.496 0.496 1 scol 1 Lj 1 Lc 12 Lw solid N 495 748 M 691 748 I 691 632 I : 0.754 0.754 +S K -; 0 0 0 1 scol 513 663 M (ClassParser)[21 7 16 15 15 19 16 10 15 16 0]xS -0.602 0 0.199 1 scol 1 Lw solid N 695 676 M 490 676 I 490 753 I 695 753 I C -K -N 695 693 M 490 693 I 490 753 I 695 753 I C -K -0 0 0 1 scol 535 741 M (parse\(\))[16 16 10 15 16 10 0]xS -: N 1168 1116 157 93 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1325 1115 M 1167 1115 I 1167 1209 I 1325 1209 I C -K -0 0 0 1 scol 1192 1151 M (Attribute)[19 8 8 10 7 16 16 8 0]xS -0.602 0 0.199 1 scol N 1325 1164 M 1167 1164 I 1167 1209 I 1325 1209 I C -K -N 1325 1181 M 1167 1181 I 1167 1209 I 1325 1209 I C -K -N 1225 1279 M 1225 1210 I K -N 528 1279 M 2187 1279 I K -N 1225 1210 M 1242 1255 I 1209 1255 I C -: 1 1 1 1 scol O ; K -N 1190 1410 M 1190 1279 I K -N 1091 1329 276 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1091 1356 M (<<Method attribute>>)[17 17 23 16 8 16 16 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 1602 1417 M 1602 1279 I K -N 1479 1381 251 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1479 1408 M (<<Code attribute>>)[17 17 21 16 16 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 1941 1222 M 1941 1279 I K -N 1823 1234 255 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1823 1261 M (<<Class attribute>>)[17 17 21 7 16 15 15 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 840 1405 M 840 1279 I K -N 728 1326 276 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 728 1353 M (<<Method attribute>>)[17 17 23 16 8 16 16 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 2132 1417 M 2132 1279 I K -N 528 1405 M 528 1279 I K -N 416 1326 276 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 416 1353 M (<<Method attribute>>)[17 17 23 16 8 16 16 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 1870 1575 M 1870 1279 I K -N 1748 1523 250 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1748 1550 M (<<Code attribute>>)[17 17 21 16 16 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 1673 1222 M 1673 1279 I K -N 1541 1234 255 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1541 1261 M (<<Class attribute>>)[17 17 21 7 16 15 15 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 2187 1222 M 2187 1279 I K -N 2068 1234 255 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 2068 1261 M (<<Class attribute>>)[17 17 21 7 16 15 15 8 16 8 8 10 7 16 16 8 16 17 0]xS -0.602 0 0.199 1 scol N 638 1222 M 638 1279 I K -N 536 1233 245 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 536 1260 M (<<Field attribute>>)[17 17 18 7 16 7 16 8 16 8 8 10 7 16 16 8 16 17 0]xS -: N 1130 845 233 126 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1363 844 M 1129 844 I 1129 971 I 1363 971 I C -K -0 0 0 1 scol -%%IncludeResource: font Helvetica-Oblique -F /F1 0 /256 T /Helvetica-Oblique mF -/F1S1C F1 [28.75 0 0 -28.75 0 0 ] mFS -F1S1C Ji -1150 880 M (FieldOrMethod)[18 7 16 7 16 23 10 24 16 8 16 16 0]xS -0.602 0 0.199 1 scol N 1363 894 M 1129 894 I 1129 971 I 1363 971 I C -K -N 1363 911 M 1129 911 I 1129 971 I 1363 971 I C -K -0 0 0 1 scol 1174 960 M (getName\(\))[16 16 8 21 16 24 16 10 0]xS -: N 571 845 214 126 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 785 844 M 570 844 I 570 971 I 785 971 I C -K -0 0 0 1 scol 594 880 M (AccessFlags)[19 15 15 16 15 15 18 7 16 16 0]xS -0.602 0 0.199 1 scol N 785 894 M 570 894 I 570 971 I 785 971 I C -K -N 785 911 M 570 911 I 570 971 I 785 971 I C -K -0 0 0 1 scol 614 960 M (isPublic\(\))[7 15 19 16 16 7 7 15 10 0]xS -0.602 0 0.199 1 scol N 1128 908 M 786 908 I K -N 786 908 M 831 925 I 831 891 I C -: 1 1 1 1 scol O ; K -N 1237 1043 M 1237 972 I K -N 992 1043 M 1497 1043 I K -N 1237 972 M 1253 1017 I 1220 1017 I C -: 1 1 1 1 scol O ; K -: N 1494 1023 134 84 rp C -1 1 0.801 1 scol L ; N 1628 1022 M 1493 1022 I 1493 1107 I 1628 1107 I C -K -0 0 0 1 scol F0S1C Ji -1513 1058 M (Method)[23 16 8 16 16 0]xS -0.602 0 0.199 1 scol N 1628 1074 M 1493 1074 I 1493 1107 I 1628 1107 I C -K -N 1628 1090 M 1493 1090 I 1493 1107 I 1628 1107 I C -K -N 1409 1111 M 1492 1085 I K -N 1488 1110 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1488 1137 M (1)S -0.602 0 0.199 1 scol N 1492 1085 M 1476 1102 I 1454 1097 I 1470 1080 I 1492 1085 I C -: 1 1 1 1 scol O ; K -N 1409 1111 M 1326 1136 I K -N 1341 1157 11 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1341 1184 M (*)S -N 1488 1110 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1488 1137 M (1)S -N 1341 1157 11 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1341 1184 M (*)S -0.602 0 0.199 1 scol N 1497 1028 M 1497 1043 I K -: N 1734 802 235 139 rp C -1 1 0.801 1 scol L ; N 1969 801 M 1733 801 I 1733 941 I 1969 941 I C -K -0 0 0 1 scol 1764 837 M (ConstantPool)[21 16 16 15 8 16 16 8 19 16 16 0]xS -0.602 0 0.199 1 scol N 1969 853 M 1733 853 I 1733 941 I 1969 941 I C -K -N 1969 869 M 1733 869 I 1733 941 I 1969 941 I C -K -0 0 0 1 scol 1777 918 M (getConstant\(\))[16 16 8 21 16 16 15 8 16 16 8 10 0]xS -: N 1088 610 317 160 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1405 609 M 1087 609 I 1087 770 I 1405 770 I C -K -0 0 0 1 scol 1179 645 M (JavaClass)[15 16 13 16 21 7 16 15 0]xS -0.602 0 0.199 1 scol N 1405 659 M 1087 659 I 1087 770 I 1405 770 I C -K -N 1405 676 M 1087 676 I 1087 770 I 1405 770 I C -K -0 0 0 1 scol 1131 724 M (getInterfaceNames\(\))[16 16 8 7 16 8 16 10 8 16 15 16 21 16 25 16 15 10 0]xS -1131 757 M (getSuperclassName\(\))[16 16 8 19 16 16 16 10 15 7 16 15 15 21 16 25 16 10 0]xS -0.602 0 0.199 1 scol N 1419 896 M 1314 771 I K -N 1287 794 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1287 821 M (1)S -0.602 0 0.199 1 scol N 1314 771 M 1336 779 I 1340 802 I 1318 794 I 1314 771 I C -: 1 1 1 1 scol O ; K -N 1419 896 M 1524 1021 I K -N 1539 966 11 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1539 993 M (*)S -N 1287 794 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1287 821 M (1)S -N 1539 966 11 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1539 993 M (*)S -1 1 1 1 scol [ 72 24 ] 0 sd N 696 690 M 1086 690 I K -0 0 0 1 scol [ 72 24 ] 0 sd N 696 690 M 1086 690 I K -3 Lw solid N 1086 690 M 1059 701 I : 0.754 0.754 +S K -; N 1086 690 M 1059 679 I : 0.754 0.754 +S K -; N 847 641 164 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 847 668 M (<<creates>>)[17 17 15 10 16 16 8 16 15 17 0]xS -0.602 0 0.199 1 scol 1 Lw solid N 1569 786 M 1406 737 I K -N 1569 786 M 1732 835 I K -N 1086 751 M 786 866 I K -N 786 866 M 834 866 I 822 834 I C -: 1 1 1 1 scol O ; K -: N 865 1023 134 84 rp C -1 1 0.801 1 scol L ; N 999 1022 M 864 1022 I 864 1107 I 999 1107 I C -K -0 0 0 1 scol 899 1058 M (Field)[18 7 16 7 0]xS -0.602 0 0.199 1 scol N 999 1072 M 864 1072 I 864 1107 I 999 1107 I C -K -N 999 1089 M 864 1089 I 864 1107 I 999 1107 I C -K -N 1083 1111 M 1000 1086 I K -N 990 1111 16 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 990 1138 M (1)S -0.602 0 0.199 1 scol N 1000 1086 M 1023 1081 I 1039 1098 I 1017 1102 I 1000 1086 I C -: 1 1 1 1 scol O ; K -N 1083 1111 M 1166 1136 I K -N 1165 1079 11 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1165 1106 M (*)S -N 990 1111 16 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 990 1138 M (1)S -N 1165 1079 11 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1165 1106 M (*)S -0.602 0 0.199 1 scol N 992 1067 M 992 1043 I K -N 1072 896 M 1177 771 I K -N 1190 794 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1190 821 M (1)S -0.602 0 0.199 1 scol N 1177 771 M 1173 794 I 1150 802 I 1155 779 I 1177 771 I C -: 1 1 1 1 scol O ; K -N 1072 896 M 967 1021 I K -N 1004 1018 11 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1004 1045 M (*)S -N 1190 794 16 33 rp C -1 1 1 1 scol L 0 0 0 1 scol 1190 821 M (1)S -N 1004 1018 11 34 rp C -1 1 1 1 scol L 0 0 0 1 scol 1004 1045 M (*)S -LH -%%PageTrailer - -%%Trailer -%%DocumentNeededResources: -%%+ font Helvetica-Oblique -%%+ font Helvetica -%%DocumentSuppliedResources: -Pscript_WinNT_Incr dup /terminate get exec -%%EOF -grestore - -%%EndDocument - @endspecial 990 5316 a Fq(Figur)n(e)26 b(3:)31 b(UML)24 -b(diagram)i(for)f(the)h Fo(BCEL)i Fq(API)1863 5712 y(11)p -eop -%%Page: 12 12 -12 11 bop 146 407 a Ft(As)17 b(mentioned)f(in)h(section)g(2.1)g(alr)n -(eady)-10 b(,)19 b(several)e(components)e(may)j(contain)f -Fs(attribute)i Ft(objects:)25 b(classes,)0 520 y(\002elds,)43 -b(methods,)f(and)e Ff(Code)e Ft(objects)h(\(intr)n(oduced)g(in)h -(section)f(2.3\).)81 b(The)39 b(latter)g(is)h(an)g(attribute)g(it-)0 -633 y(self)f(that)h(contains)f(the)g(actual)h(byte)f(code)f(array)-10 -b(,)44 b(the)39 b(maximum)i(stack)e(size,)k(the)c(number)g(of)h(local)0 -746 y(variables,)c(a)d(table)f(of)h(handled)e(exceptions,)i(and)f(some) -g(optional)g(debugging)e(information)j(coded)e(as)0 858 -y Ff(LineNumberTable)23 b Ft(and)29 b Ff(LocalVariableTa)o(bl)o(e)24 -b Ft(attributes.)47 b(Attributes)27 b(ar)n(e)j(in)g(general)f -(speci\002c)0 971 y(to)c(some)g(data)g(str)o(uctur)n(e,)g(i.e.)37 -b(no)25 b(two)g(components)f(shar)n(e)h(the)g(same)g(kind)h(of)f -(attribute,)h(though)e(this)h(is)0 1084 y(not)h(explicitly)h -(forbidden.)40 b(In)26 b(the)g(\002gur)n(e)g(the)g Ff(Attribute)d -Ft(classes)j(ar)n(e)i(marked)e(with)g(the)g(component)0 -1197 y(they)21 b(belong)h(to.)0 1482 y Fm(3.2)119 b(Class)30 -b(repository)0 1659 y Ft(Using)35 b(the)g(pr)n(ovided)g -Ff(Repository)c Ft(class,)39 b(r)n(eading)d(class)g(\002les)g(into)f(a) -h Ff(JavaClass)c Ft(object)k(is)g(quite)0 1772 y(simple:)109 -1970 y Ff(JavaClass)51 b(clazz)h(=)i(Repository.look)o(up)o(Cl)o(as)o -(s\()o("ja)o(va)o(.l)o(an)o(g.)o(Str)o(in)o(g")o(\);)146 -2168 y Ft(The)19 b(r)n(epository)e(also)i(contains)g(methods)f(pr)n -(oviding)h(the)f(dynamic)i(equivalent)f(of)g(the)g Ff(instanceof)0 -2281 y Ft(operator)-7 b(,)21 b(and)i(other)e(useful)h(r)n(outines:)109 -2479 y Ff(if\(Repository.i)o(ns)o(ta)o(nce)o(Of)o(\(c)o(la)o(zz)o(,)49 -b(super_class\))g({)218 2592 y(...)109 2705 y(})0 2961 -y Fg(3.2.1)99 b(Accessing)25 b(class)h(\002le)f(data)0 -3138 y Ft(Information)39 b(within)g(the)f(class)i(\002le)f(components)e -(may)j(be)e(accessed)g(like)i(Java)g(Beans)e(via)j(intuitive)0 -3251 y(set/get)19 b(methods.)26 b(All)c(of)g(them)f(also)h(de\002ne)e -(a)i Ff(toString\(\))17 b Ft(method)j(so)h(that)h(implementing)f(a)h -(simple)0 3364 y(class)h(viewer)f(is)h(very)f(easy)-10 -b(.)27 b(In)22 b(fact)i(all)g(of)f(the)e(examples)i(used)e(her)n(e)h -(have)h(been)f(pr)n(oduced)f(this)h(way:)109 3562 y Ff(System.out.prin) -o(tl)o(n\()o(cla)o(zz)o(\);)109 3675 y(printCode\(clazz)o(.g)o(et)o -(Met)o(ho)o(ds)o(\(\))o(\);)109 3788 y(...)109 3901 y(public)52 -b(static)g(void)g(printCode\(Method)o([])c(methods\))j({)218 -4014 y(for\(int)h(i=0;)g(i)i(<)g(methods.length;)48 b(i++\))53 -b({)327 4127 y(System.out.prin)o(tln)o(\(m)o(et)o(ho)o(ds)o([i])o(\);) -327 4352 y(Code)g(code)g(=)h(methods[i].get)o(Cod)o(e\()o(\);)327 -4465 y(if\(code)e(!=)h(null\))g(//)g(Non-abstract)c(method)436 -4578 y(System.out.print)o(ln)o(\(c)o(od)o(e\))o(;)218 -4691 y(})109 4804 y(})0 5060 y Fg(3.2.2)99 b(Analyzing)25 -b(class)g(data)0 5237 y Ft(Last)g(but)h(not)f(least,)h -Fe(BCEL)i Ft(supports)23 b(the)i Fs(V)-7 b(isitor)28 -b Ft(design)d(pattern)g([GHJV95)q(],)h(so)g(one)f(can)i(write)e -(visitor)0 5350 y(objects)e(to)h(traverse)f(and)h(analyze)h(the)e -(contents)f(of)i(a)h(class)f(\002le.)32 b(Included)23 -b(in)h(the)g(distribution)f(is)h(a)h(class)0 5463 y Ff(JasminVisitor)17 -b Ft(that)22 b(converts)g(class)h(\002les)f(into)h(the)e(Jasmin)j -(assembler)e(language)h([MD97)q(].)1863 5712 y Fq(12)p -eop -%%Page: 13 13 -13 12 bop 0 407 a Fm(3.3)119 b(ClassGen)0 587 y Ft(This)26 -b(part)g(of)g(the)g(API)g(\(package)g Ff(de.fub.bytecod)o(e.)o(gen)o -(er)o(ic)o Ft(\))21 b(supplies)k(an)i(abstraction)f(level)h(for)0 -700 y(cr)n(eating)c(or)f(transforming)g(class)h(\002les)f(dynamically) --10 b(.)29 b(It)22 b(makes)g(the)g(static)g(constraints)g(of)g(Java)j -(class)d(\002les)0 813 y(like)35 b(the)e(har)n(d-coded)h(byte)f(code)h -(addr)n(esses)e(generic.)63 b(The)34 b(generic)f(constant)h(pool,)j -(for)d(example,)j(is)0 926 y(implemented)23 b(by)h(the)f(class)h -Ff(ConstantPoolGen)18 b Ft(which)24 b(of)n(fers)g(methods)e(for)i -(adding)f(dif)n(fer)n(ent)h(types)0 1039 y(of)h(constants.)34 -b(Accor)n(dingly)-10 b(,)25 b Ff(ClassGen)d Ft(of)n(fers)i(an)i -(interface)f(to)f(add)h(methods,)f(\002elds,)g(and)h(attributes.)0 -1152 y(Figur)n(e)d(4)h(gives)f(an)h(overview)g(of)f(this)h(part)f(of)h -(the)e(API.)0 1422 y Fg(3.3.1)99 b(T)-9 b(ypes)0 1603 -y Ft(W)h(e)28 b(abstract)i(fr)n(om)f(the)g(concr)n(ete)f(details)h(of)g -(the)g(type)e(signatur)n(e)i(syntax)f(\(see)g(2.5\))i(by)f(intr)n -(oducing)g(the)0 1716 y Ff(Type)23 b Ft(class,)k(which)e(is)h(used,)e -(for)h(example,)g(by)g(methods)f(to)g(de\002ne)g(their)h(r)n(eturn)f -(and)i(ar)n(gument)e(types.)0 1829 y(Concr)n(ete)j(sub-classes)f(ar)n -(e)i Ff(BasicType)p Ft(,)c Ff(ObjectType)p Ft(,)f(and)k -Ff(ArrayType)d Ft(which)j(consists)f(of)h(the)g(el-)0 -1942 y(ement)33 b(type)f(and)i(the)f(number)g(of)h(dimensions.)60 -b(For)33 b(commonly)h(used)f(types)e(the)i(class)i(of)n(fers)e(some)0 -2055 y(pr)n(ede\002ned)23 b(constants.)36 b(For)25 b(example)h(the)f -(method)f(signatur)n(e)h(of)h(the)f Ff(main)f Ft(method)h(as)g(shown)g -(in)h(sec-)0 2168 y(tion)c(2.5)i(is)e(r)n(epr)n(esented)e(by:)109 -2403 y Ff(Type)162 b(return_type)49 b(=)55 b(Type.VOID;)109 -2516 y(Type[])d(arg_types)159 b(=)55 b(new)e(Type[])f({)i(new)f -(ArrayType\(Type)o(.ST)o(RI)o(NG)o(,)48 b(1\))54 b(};)146 -2750 y(Type)18 b Ft(also)i(contains)g(methods)e(to)h(convert)h(types)d -(into)j(textual)f(signatur)n(es)g(and)h(vice)g(versa.)27 -b(The)19 b(sub-)0 2863 y(classes)24 b(contain)g(implementations)g(of)g -(the)f(r)n(outines)g(and)h(constraints)f(speci\002ed)g(by)h(the)f(Java) -j(Language)0 2976 y(Speci\002cation)d([GJS96)q(].)0 3247 -y Fg(3.3.2)99 b(Generic)24 b(\002elds)h(and)g(methods)0 -3427 y Ft(Fields)f(ar)n(e)i(r)n(epr)n(esented)c(by)j -Ff(FieldGen)c Ft(objects,)k(which)g(may)h(be)e(fr)n(eely)h(modi\002ed)f -(by)h(the)f(user)-7 b(.)34 b(If)25 b(they)0 3540 y(have)e(the)g(access) -g(rights)f Ff(static)52 b(final)p Ft(,)20 b(i.e.)29 b(ar)n(e)24 -b(constants)d(and)i(of)g(basic)i(type,)c(they)h(may)h(optionally)0 -3653 y(have)g(an)g(initializing)i(value.)146 3768 y(Generic)d(methods)e -(contain)i(methods)e(to)h(add)h(exceptions)e(the)h(method)f(may)i(thr)n -(ow)-8 b(,)21 b(local)i(variables,)0 3881 y(and)g(exception)e -(handlers.)27 b(The)22 b(latter)g(two)g(ar)n(e)h(r)n(epr)n(esented)c -(by)k(user)n(-con\002gurable)f(objects)g(as)g(well.)29 -b(Be-)0 3994 y(cause)20 b(exception)e(handlers)i(and)f(local)j -(variables)f(contain)f(r)n(efer)n(ences)f(to)g(byte)g(code)h(addr)n -(esses,)d(they)i(also)0 4107 y(take)j(the)g(r)n(ole)h(of)g(an)g -Fs(instruction)h(tar)n(geter)i Ft(in)d(our)f(terminology)-10 -b(.)27 b(Instr)o(uction)22 b(tar)n(geters)f(contain)i(a)g(method)0 -4220 y Ff(updateTarget\(\))i Ft(to)31 b(r)n(edir)n(ect)g(a)h(r)n(efer)n -(ence.)54 b(Generic)32 b(\(non-abstract\))g(methods)d(r)n(efer)i(to)g -Fs(instruction)0 4332 y(lists)g Ft(that)e(consist)f(of)h(instr)o -(uction)g(objects.)47 b(Refer)n(ences)28 b(to)g(byte)g(code)h(addr)n -(esses)e(ar)n(e)i(implemented)f(by)0 4445 y(handles)22 -b(to)g(instr)o(uction)g(objects.)28 b(This)22 b(is)h(explained)f(in)h -(mor)n(e)f(detail)h(in)g(the)f(following)h(sections.)146 -4560 y(The)32 b(maximum)h(stack)f(size)g(needed)e(by)i(the)f(method)g -(and)h(the)f(maximum)j(number)e(of)g(local)i(vari-)0 -4673 y(ables)25 b(used)e(may)i(be)f(set)f(manually)j(or)e(computed)f -(via)j(the)d Ff(setMaxStack\(\))c Ft(and)24 b Ff(setMaxLocals\(\))0 -4786 y Ft(methods)d(automatically)-10 b(.)0 5056 y Fg(3.3.3)99 -b(Instructions)0 5237 y Ft(Modeling)25 b(instr)o(uctions)g(as)h -(objects)f(may)h(look)f(somewhat)g(odd)f(at)i(\002rst)f(sight,)g(but)h -(in)g(fact)h(enables)e(pr)n(o-)0 5350 y(grammers)g(to)f(obtain)i(a)g -(high-level)g(view)f(upon)f(contr)n(ol)i(\003ow)f(without)f(handling)h -(details)g(like)h(concr)n(ete)0 5463 y(byte)c(code)h(of)n(fsets.)29 -b(Instr)o(uctions)22 b(consist)g(of)h(a)h(tag,)f(i.e.)30 -b(an)24 b(opcode,)d(their)i(length)g(in)h(bytes)e(and)h(an)h(of)n(fset) -1863 5712 y Fq(13)p eop -%%Page: 14 14 -14 13 bop 383 5113 a @beginspecial 13 @llx 12 @lly 535 -@urx 830 @ury 3671 @rwi @setspecial -%%BeginDocument: eps/classgen.eps -%!PS-Adobe-3.0 EPSF-3.0 -%%Title: Rose Diagram(s) -%%Creator: AdobePS5.dll Version 5.0 -%%CreationDate: 7/7/1999 17:42:13 -%%Pages: 1 -%%Orientation: Portrait -%%PageOrder: Ascend -%%DocumentNeededResources: (atend) -%%DocumentSuppliedResources: (atend) -%%DocumentData: Clean7Bit -%%TargetDevice: (HP LaserJet 5Si) (2014.108) 1 -%%LanguageLevel: 2 -%%BoundingBox: 13 12 535 830 -%%EndComments -%%BeginProcSet: epsffit 1 0 -gsave -1249.738 -7.476 translate -90 rotate -1.623 1.623 scale -%%EndProcSet - - -%%BeginDefaults -%%PageBoundingBox: 13 12 582 830 -%%EndDefaults - -%%BeginProlog -%%BeginResource: file Pscript_WinNT_ErrorHandler 5.0 0 -/currentpacking where{pop/oldpack currentpacking def/setpacking where{pop false -setpacking}if}if/$brkpage 64 dict def $brkpage begin/prnt{dup type/stringtype -ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch -def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0 -rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def -/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def/=={/cp 0 def -typeprint nl}def/typeprint{dup type exec}readonly def/lmargin 72 def/rmargin 72 -def/tprint{dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp -exch def prnt}readonly def/cvsprint{=string cvs tprint( )tprint}readonly def -/integertype{cvsprint}readonly def/realtype{cvsprint}readonly def/booleantype -{cvsprint}readonly def/operatortype{(--)tprint =string cvs tprint(-- )tprint} -readonly def/marktype{pop(-mark- )tprint}readonly def/dicttype{pop -(-dictionary- )tprint}readonly def/nulltype{pop(-null- )tprint}readonly def -/filetype{pop(-filestream- )tprint}readonly def/savetype{pop(-savelevel- ) -tprint}readonly def/fonttype{pop(-fontid- )tprint}readonly def/nametype{dup -xcheck not{(/)tprint}if cvsprint}readonly def/stringtype{dup rcheck{(\()tprint -tprint(\))tprint}{pop(-string- )tprint}ifelse}readonly def/arraytype{dup rcheck -{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}forall(]) -tprint}ifelse}{pop(-array- )tprint}ifelse}readonly def/packedarraytype{dup -rcheck{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint} -forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse}readonly def/courier -/Courier findfont 10 scalefont def end errordict/handleerror{systemdict begin -$error begin $brkpage begin newerror{/newerror false store vmstatus pop pop 0 -ne{grestoreall}if showpage initgraphics courier setfont lmargin 720 moveto -(ERROR: )prnt errorname prnt nl(OFFENDING COMMAND: )prnt/command load prnt -$error/ostack known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==} -repeat}if systemdict/showpage get exec(%%[ Error: )print errorname =print -(; OffendingCommand: )print/command load =print( ]%%)= flush}if end end end}dup -0 systemdict put dup 4 $brkpage put bind readonly put/currentpacking where{pop -/setpacking where{pop oldpack setpacking}if}if -%%EndResource -userdict /Pscript_WinNT_Incr 230 dict dup begin put -%%BeginResource: file Pscript_FatalError 5.0 0 -/FatalErrorIf{{initgraphics findfont exch scalefont setfont counttomark 3 div -cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def -%%EndResource -/VM?{vmstatus exch sub exch pop gt{[ -(This job requires more memory than is available in this printer.)100 500 -(Try one or more of the following, and then print again:)100 485 -(For the output format, choose Optimize For Portability.)115 470 -(In the Device Settings page, make sure the Available PostScript Memory is accurate.) -115 455(Reduce the number of fonts in the document.)115 440 -(Print the document in parts.)115 425 12/Times-Roman showpage -(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def -%%BeginResource: file Pscript_Win_Basic 5.0 0 -/d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^ -/index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/- -/rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true , -d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C -/closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M -/rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , d -/Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/show , d/LH/showpage -, d/K/stroke , d/W/widthshow , d/R/rotate , d/P/eoclip , d/L2? false -/languagelevel where{pop languagelevel 2 ge{pop true}if}if d L2?{/xS/xshow , d -/yS/yshow , d/zS/xyshow , d}if/b{bind d}bind d/bd{bind d}bind d/xd{~ d}bd/ld{, -d}bd/lw/Lw ld/lc/Lc ld/lj/Lj ld/sg/setgray ld/ADO_mxRot null d/self & d/OrgMx -matrix currentmatrix d/reinitialize{: OrgMx setmatrix[/TextInit/GraphInit -/UtilsInit counttomark{@ where{self eq}{F}?{cvx exec}{!}?}repeat cleartomark ;} -b/initialize{`{/ADO_mxRot ~ d/TextInitialised? F d reinitialize E}{U -/Pscript_Win_Data 230 dict @ ` put/ADO_mxRot ~ d/TextInitialised? F d -reinitialize}?}b/terminate{!{& self eq{exit}{E}?}loop E}b/suspend/terminate , d -/resume{` Pscript_Win_Data `}b/snap{transform 0.25 sub round 0.25 add ~ 0.25 -sub round 0.25 add ~ itransform}b/dsnap{dtransform round ~ round ~ idtransform} -b<04>cvn{}d/rr{1 ^ 0 - 0 ~ - neg 0 - C}b/rp{4 2 $ M 1 ^ 0 - 0 ~ - neg 0 -}b -/solid{[]0 sd}b/g{@ not{U/DefIf_save save put}if U/DefIf_bool 2 ^ put}b -/DefIf_El{if U/DefIf_bool get not @{U/DefIf_save get restore}if}b/e{DefIf_El !} -b/UDF{L2?{undefinefont}{!}?}b/UDR{L2?{undefineresource}{! !}?}b -%%EndResource -%%BeginResource: file Pscript_Win_Utils_L2 5.0 0 -/rf/rectfill , d/fx{1 1 dtransform @ 0 ge{1 sub 0.5}{1 add -0.5}? 3 -1 $ @ 0 ge -{1 sub 0.5}{1 add -0.5}? 3 1 $ 4 1 $ idtransform 4 -2 $ idtransform}b/BZ{4 -2 $ -snap + +S fx rf}b/rs/rectstroke , d/rc/rectclip , d/UtilsInit{currentglobal{F -setglobal}if}b/scol{! setcolor}b/colspA/DeviceGray d/colspABC/DeviceRGB d -/colspRefresh{colspABC setcolorspace}b/SetColSpace{colspABC setcolorspace}b -%%EndResource -end -%%EndProlog - -%%BeginSetup -[ 1 0 0 1 0 0 ] false Pscript_WinNT_Incr dup /initialize get exec -1 setlinecap 1 setlinejoin -/mysetup [ 0.24 0 0 -0.24 13.43905 829.74047 ] def -%%EndSetup - -%%Page: 1 1 -%%PageBoundingBox: 13 12 582 830 -%%EndPageComments -%%BeginPageSetup -/DeviceRGB dup setcolorspace /colspABC exch def mysetup concat colspRefresh -%%EndPageSetup - -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Win_GdiObject 5.0 0 -/SavedCTM null d/CTMsave{/SavedCTM SavedCTM currentmatrix d}b/CTMrestore -{SavedCTM setmatrix}b/mp null d/ADO_mxRot null d/GDIHMatrix null d -/GDIHPatternDict 22 dict d GDIHPatternDict `/PatternType 1 d/PaintType 2 d/Reps -L2?{1}{5}? d/XStep 8 Reps mul d/YStep XStep d/BBox[0 0 XStep YStep]d/TilingType -1 d/PaintProc{` 1 Lw[]0 sd PaintData , exec E}b/FGnd null d/BGnd null d -/HS_Horizontal{horiz}b/HS_Vertical{vert}b/HS_FDiagonal{fdiag}b/HS_BDiagonal -{biag}b/HS_Cross{horiz vert}b/HS_DiagCross{fdiag biag}b/MaxXYStep XStep YStep -gt{XStep}{YStep}? d/horiz{Reps{0 4 M XStep 0 - 0 8 +}repeat 0 -8 Reps mul + K}b -/vert{Reps{4 0 M 0 YStep - 8 0 +}repeat 0 -8 Reps mul + K}b/biag{Reps{0 0 M -MaxXYStep @ - 0 YStep neg M MaxXYStep @ - 0 8 +}repeat 0 -8 Reps mul + 0 YStep -M 8 8 - K}b/fdiag{Reps{0 0 M MaxXYStep @ neg - 0 YStep M MaxXYStep @ neg - 0 8 -+}repeat 0 -8 Reps mul + MaxXYStep @ M 8 -8 - K}b E/makehatch{4 -2 $/yOrg ~ d -/xOrg ~ d GDIHPatternDict/PaintData 3 -1 $ put CTMsave GDIHMatrix setmatrix -GDIHPatternDict matrix xOrg yOrg + mp CTMrestore ~ U ~ 2 ^ put}b/h0{/h0 -/HS_Horizontal makehatch}b/h1{/h1/HS_Vertical makehatch}b/h2{/h2/HS_FDiagonal -makehatch}b/h3{/h3/HS_BDiagonal makehatch}b/h4{/h4/HS_Cross makehatch}b/h5{/h5 -/HS_DiagCross makehatch}b/GDIBWPatternDict 25 dict @ `/PatternType 1 d -/PaintType L2?{1}{2}? d/RepsV L2?{1}{6}? d/RepsH L2?{1}{5}? d/BBox[0 0 RepsH 1] -d/TilingType 1 d/XStep 1 d/YStep 1 d/Height 8 RepsV mul d/Width 8 d/mx[Width 0 -0 Height neg 0 Height]d/FGnd null d/BGnd null d/SetBGndFGnd L2?{{FGnd null ne -{FGnd aload ! scol BBox aload ! 2 ^ sub ~ 3 ^ sub ~ rf}if BGnd null ne{BGnd -aload ! scol}if}}{{}}? b/PaintProc{` SetBGndFGnd RepsH{Width Height F mx -PaintData imagemask Width 0 +}repeat E}b E d/GDIBWPatternMx null d/pfprep{save -8 1 $/PatternOfTheDay 8 1 $ GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/yExt ~ d/Width ~ d/FGnd ~ d/BGnd ~ d/Height yExt RepsV mul d/mx[Width 0 0 -Height 0 0]d E : GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx -matrix currentmatrix d ; CTMsave GDIBWPatternMx setmatrix GDIBWPatternDict @ ` -xOrg yOrg E matrix + mp CTMrestore ~ !}b/pfbf{/fEOFill ~ d pfprep hbf fEOFill -{O}{L}? restore}b/GraphInit{GDIHMatrix null eq{/SavedCTM matrix d : ADO_mxRot -concat 0 0 snap + : 0.48 @ GDIHPatternDict ` YStep mul ~ XStep mul ~ dsnap -YStep V ~ XStep V ~ E +S/GDIHMatrix matrix currentmatrix readonly d ; : 0.24 --0.24 +S GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx matrix -currentmatrix readonly d ; ;}if}b -%%EndResource -%%BeginResource: file Pscript_Win_GdiObject_L2 5.0 0 -/mp/makepattern , d/hbf{setpattern}b/hf{:/fEOFill ~ d ~ ! setpattern fEOFill{O} -{L}? ;}b/pbf{: !/fEOFill ~ d GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/OutputBPP ~ d/Height ~ d/Width ~ d/PaintType 1 d/PatternType 1 d/TilingType 1 -d/BBox[0 0 Width Height]d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d -20 dict @ `/ImageType 1 d/Width Width d/Height Height d/ImageMatrix mx d -/BitsPerComponent 8 d OutputBPP 24 eq{/Decode[0 1 0 1 0 1]d}{OutputBPP 8 eq{ -/Decode[0 1]d}{/Decode[0 1 0 1 0 1 0 1]d}?}?/DataSource{PaintData}d E/ImageDict -~ d/PaintProc{` ImageDict image E}b & mx makepattern setpattern E fEOFill{O}{L} -? ;}b -%%EndResource -end reinitialize -: N 234 594 236 124 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol 1 Lw N 470 593 M 233 593 I 233 718 I 470 718 I C -K -0 0 0 1 scol Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Text 5.0 0 -/TextInit{TextInitialised? not{/Pscript_Windows_Font & d/TextInitialised? T d -/fM[1 0 0 1 0 0]d/mFM matrix d/iMat[1 0 0.212557 1 0 0]d}if}b/copyfont{1 ^ -length add dict `{1 ^/FID ne{d}{! !}?}forall & E}b/EncodeDict 11 dict d/bullets -{{/bullet}repeat}b/rF{3 copyfont @ ` ~ EncodeDict ~ get/Encoding ~ 3 ^/0 eq{& -/CharStrings known{CharStrings/Eth known not{! EncodeDict/ANSIEncodingOld get} -if}if}if d E}b/mF{@ 7 1 $ findfont ~{@/Encoding get @ StandardEncoding eq{! T}{ -{ISOLatin1Encoding}stopped{! F}{eq}?{T}{@ ` T 32 1 127{Encoding 1 ^ get -StandardEncoding 3 -1 $ get eq and}for E}?}?}{F}?{1 ^ ~ rF}{0 copyfont}? 6 -2 $ -{T pd_AddEm87 ~ !}{! ~ !/pd_charset @ where{~ get 128 eq{@ FDV 2 copy get @ -length array copy put pd_CoverFCRange}if}{!}?}? 2 ^ ~ definefont fM 5 4 -1 $ -put fM 4 0 put fM makefont Pscript_Windows_Font 3 1 $ put}b/sLT{: Lw -M -currentpoint snap M 0 - 0 Lc K ;}b/xUP null d/yUP null d/uW null d/xSP null d -/ySP null d/sW null d/sSU{N/uW ~ d/yUP ~ d/xUP ~ d}b/sU{xUP yUP uW sLT}b/sST{N -/sW ~ d/ySP ~ d/xSP ~ d}b/sT{xSP ySP sW sLT}b/sR{: + R 0 0 M}b/sRxy{: matrix -astore concat 0 0 M}b/eR/; , d/AddOrigFP{{&/FontInfo known{&/FontInfo get -length 6 add}{6}? dict `/WinPitchAndFamily ~ d/WinCharSet ~ d/OrigFontType ~ d -/OrigFontStyle ~ d/OrigFontName ~ d & E/FontInfo ~ d}{! ! ! ! !}?}b/mFS -{makefont Pscript_Windows_Font 3 1 $ put}b/mF42D{0 copyfont `/FontName ~ d 2 -copy ~ sub 1 add dict `/.notdef 0 d 2 copy 1 ~{@ 3 ^ sub Encoding ~ get ~ d}for -& E/CharStrings ~ d ! ! & @ E/FontName get ~ definefont}bind d/mF42{15 dict ` @ -4 1 $/FontName ~ d/FontType 0 d/FMapType 2 d/FontMatrix[1 0 0 1 0 0]d 1 ^ 254 -add 255 idiv @ array/Encoding ~ d 0 1 3 -1 $ 1 sub{@ Encoding 3 1 $ put}for -/FDepVector Encoding length array d/CharStrings 2 dict `/.notdef 0 d & E d 0 1 -Encoding length 1 sub{@ @ 10 lt{! FontName length 1 add string}{100 lt{FontName -length 2 add string}{FontName length 3 add string}?}? @ 0 FontName @ length -string cvs putinterval @ 3 -1 $ @ 4 1 $ 3 string cvs FontName length ~ -putinterval cvn 1 ^ 256 mul @ 255 add 3 -1 $ 4 ^ findfont mF42D FDepVector 3 1 -$ put}for & @ E/FontName get ~ definefont ! ! ! mF}b/UmF{L2? -{Pscript_Windows_Font ~ undef}{!}?}b/UmF42{@ findfont/FDepVector get{/FontName -get undefinefont}forall undefinefont}b -%%EndResource -end reinitialize -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Encoding256 5.0 0 -/CharCol256Encoding[/.notdef/breve/caron/dotaccent/dotlessi/fi/fl/fraction -/hungarumlaut/Lslash/lslash/minus/ogonek/ring/Zcaron/zcaron/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/exclam/quotedbl/numbersign -/dollar/percent/ampersand/quotesingle/parenleft/parenright/asterisk/plus/comma -/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S -/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/grave -/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright -/asciitilde/.notdef/.notdef/.notdef/quotesinglbase/florin/quotedblbase/ellipsis -/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef -/.notdef/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet -/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef -/Ydieresis/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section -/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/.notdef/registered -/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph -/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter -/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis -/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute -/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls -/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute -/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve -/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex -/udieresis/yacute/thorn/ydieresis]def EncodeDict/256 CharCol256Encoding put -%%EndResource -end reinitialize - -%%IncludeResource: font Helvetica -F /F0 0 /256 T /Helvetica mF -/F0S29 F0 [41 0 0 -41 0 0 ] mFS -F0S29 Ji -257 643 M (BasicType)[27 23 20 8 21 26 19 23 0]xS -0.602 0 0.199 1 scol N 470 659 M 233 659 I 233 718 I 470 718 I C -K -N 470 682 M 233 682 I 233 718 I 470 718 I C -K -: N 252 292 360 184 rp C -1 1 0.801 1 scol L ; N 612 291 M 251 291 I 251 476 I 612 476 I C -K -0 0 0 1 scol 326 341 M (ObjectType)[32 23 10 23 21 11 26 19 23 0]xS -0.602 0 0.199 1 scol N 612 357 M 251 357 I 251 476 I 612 476 I C -K -N 612 380 M 251 380 I 251 476 I 612 476 I C -K -0 0 0 1 scol 310 448 M (getClassName\(\))[23 23 11 30 10 23 20 20 30 23 36 23 14 0]xS -: N 699 292 362 184 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1061 291 M 698 291 I 698 476 I 1061 476 I C -K -0 0 0 1 scol 786 341 M (ArrayType)[27 14 14 23 19 26 19 23 0]xS -0.602 0 0.199 1 scol N 1061 357 M 698 357 I 698 476 I 1061 476 I C -K -N 1061 380 M 698 380 I 698 476 I 1061 476 I C -K -0 0 0 1 scol 757 448 M (getDimensions\(\))[23 23 11 30 8 36 23 23 20 8 23 23 20 14 0]xS -: N 532 594 312 124 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 844 593 M 531 593 I 531 718 I 844 718 I C -K -0 0 0 1 scol 546 643 M (ReferenceType)[30 23 12 23 14 23 23 21 23 26 19 23 0]xS -0.602 0 0.199 1 scol N 844 659 M 531 659 I 531 718 I 844 718 I C -K -N 844 682 M 531 682 I 531 718 I 844 718 I C -K -: N 1202 295 284 178 rp C -1 1 0.801 1 scol L ; N 1486 294 M 1201 294 I 1201 473 I 1486 473 I C -K -0 0 0 1 scol -%%IncludeResource: font Helvetica-Oblique -F /F1 0 /256 T /Helvetica-Oblique mF -/F1S29 F1 [41 0 0 -41 0 0 ] mFS -F1S29 Ji -1226 343 M (AccessFlags)[27 21 21 23 21 21 25 9 23 23 0]xS -0.602 0 0.199 1 scol N 1486 360 M 1201 360 I 1201 473 I 1486 473 I C -K -N 1486 383 M 1201 383 I 1201 473 I 1486 473 I C -K -0 0 0 1 scol 1260 450 M (isPublic\(\))[9 21 27 23 23 9 9 21 14 0]xS -0.602 0 0.199 1 scol N 1344 602 M 1344 474 I K -N 1059 602 M 1634 602 I K -N 1344 474 M 1366 534 I 1322 534 I C -: 1 1 1 1 scol O ; K -N 678 500 M 678 593 I K -N 369 500 M 881 500 I K -N 678 593 M 700 533 I 656 533 I C -: 1 1 1 1 scol O ; K -N 369 477 M 369 500 I K -N 881 477 M 881 500 I K -: N 919 683 306 234 rp C -1 1 0.801 1 scol L ; N 1225 682 M 918 682 I 918 917 I 1225 917 I C -K -0 0 0 1 scol F0S29 Ji -988 732 M (FieldGen)[25 8 23 10 23 32 23 0]xS -0.602 0 0.199 1 scol N 1225 748 M 918 748 I 918 917 I 1225 917 I C -K -N 1225 771 M 918 771 I 918 917 I 1225 917 I C -K -0 0 0 1 scol 977 839 M (getField\(\))[23 23 11 25 8 23 10 23 14 0]xS -977 886 M (setInitValue\(\))[20 23 11 10 23 8 11 27 23 10 23 23 14 0]xS -0.602 0 0.199 1 scol N 1059 682 M 1059 602 I K -: N 543 1283 386 122 rp C -1 1 0.801 1 scol L ; N 929 1282 M 542 1282 I 542 1405 I 929 1405 I C -K -0 0 0 1 scol 571 1332 M (LocalVariableGen)[23 23 21 23 10 27 23 14 8 23 23 10 23 32 23 0]xS -0.602 0 0.199 1 scol N 929 1348 M 542 1348 I 542 1405 I 929 1405 I C -K -N 929 1371 M 542 1371 I 542 1405 I 929 1405 I C -K -: N 538 1106 396 124 rp C -1 1 0.801 1 scol L ; N 934 1105 M 537 1105 I 537 1230 I 934 1230 I C -K -0 0 0 1 scol 559 1155 M (CodeExceptionGen)[30 23 23 23 27 18 21 23 23 11 8 23 23 32 23 0]xS -0.602 0 0.199 1 scol N 934 1171 M 537 1171 I 537 1230 I 934 1230 I C -K -N 934 1194 M 537 1194 I 537 1230 I 934 1230 I C -K -: N 351 836 322 184 rp C -1 1 0.801 1 scol L ; N 673 835 M 350 835 I 350 1020 I 673 1020 I C -K -0 0 0 1 scol 466 885 M (Type)[26 19 23 0]xS -0.602 0 0.199 1 scol N 673 901 M 350 901 I 350 1020 I 673 1020 I C -K -N 673 924 M 350 924 I 350 1020 I 673 1020 I C -K -0 0 0 1 scol 409 992 M (getSignature\(\))[23 23 11 27 8 23 23 23 11 23 14 23 14 0]xS -0.602 0 0.199 1 scol N 512 745 M 512 835 I K -N 347 745 M 669 745 I K -N 512 835 M 534 775 I 490 775 I C -: 1 1 1 1 scol O ; K -N 795 862 M 674 889 I K -N 795 862 M 917 833 I K -N 347 719 M 347 745 I K -N 669 719 M 669 745 I K -: N 538 1457 364 126 rp C -1 1 0.801 1 scol L ; N 902 1456 M 537 1456 I 537 1583 I 902 1583 I C -K -0 0 0 1 scol 561 1506 M (BranchInstruction)[27 14 23 23 21 23 10 23 20 11 14 23 21 11 8 23 0]xS -0.602 0 0.199 1 scol N 902 1522 M 537 1522 I 537 1583 I 902 1583 I C -K -N 902 1545 M 537 1545 I 537 1583 I 902 1583 I C -K -: N 1157 1012 342 184 rp C -1 1 0.801 1 scol L ; N 1499 1011 M 1156 1011 I 1156 1196 I 1499 1196 I C -K -0 0 0 1 scol 1221 1061 M (MethodGen)[33 23 11 23 23 23 32 23 0]xS -0.602 0 0.199 1 scol N 1499 1077 M 1156 1077 I 1156 1196 I 1499 1196 I C -K -N 1499 1100 M 1156 1100 I 1156 1196 I 1499 1196 I C -K -0 0 0 1 scol 1215 1168 M (addException\(\))[23 23 23 27 18 21 23 23 11 8 23 23 14 0]xS -0.602 0 0.199 1 scol N 1022 1227 M 1155 1172 I K -N 1155 1172 M 1136 1196 I 1105 1193 I 1124 1168 I 1155 1172 I C -: 1 1 1 1 scol O ; K -N 1022 1227 M 886 1281 I K -N 913 1302 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 913 1340 M (*)S -N 913 1302 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 913 1340 M (*)S -0.602 0 0.199 1 scol N 1045 1134 M 1155 1121 I K -N 1155 1121 M 1130 1139 I 1101 1127 I 1126 1109 I 1155 1121 I C -: 1 1 1 1 scol O ; K -N 1045 1134 M 935 1145 I K -N 934 1068 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 934 1106 M (*)S -N 934 1068 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 934 1106 M (*)S -0.602 0 0.199 1 scol N 914 1014 M 674 962 I K -N 914 1014 M 1155 1066 I K -N 1344 1011 M 1344 602 I K -: N 1751 1012 306 184 rp C -1 1 0.801 1 scol L ; N 2057 1011 M 1750 1011 I 1750 1196 I 2057 1196 I C -K -0 0 0 1 scol 1779 1061 M (InstructionList)[10 23 20 11 14 23 21 11 8 23 23 23 8 20 0]xS -0.602 0 0.199 1 scol N 2057 1077 M 1750 1077 I 1750 1196 I 2057 1196 I C -K -N 2057 1100 M 1750 1100 I 1750 1196 I 2057 1196 I C -K -0 0 0 1 scol 1809 1168 M (append\(\))[23 23 23 23 23 23 14 0]xS -0.602 0 0.199 1 scol N 1624 1104 M 1749 1104 I K -N 1624 1104 M 1500 1104 I K -: N 1201 1313 222 190 rp C -1 1 0.801 1 scol L ; N 1423 1312 M 1200 1312 I 1200 1503 I 1423 1503 I C -K -0 0 0 1 scol 1219 1362 M (Instruction)[10 23 20 11 14 23 21 11 8 23 0]xS -0.602 0 0.199 1 scol N 1423 1378 M 1200 1378 I 1200 1503 I 1423 1503 I C -K -N 1423 1495 M 1200 1495 I 1200 1503 I 1423 1503 I C -K -0 0 0 1 scol 1259 1422 M (tag)[11 23 0]xS -1259 1469 M (length)[10 23 23 23 11 0]xS -0.602 0 0.199 1 scol N 903 1485 M 1199 1429 I K -N 1199 1429 M 1144 1462 I 1136 1418 I C -: 1 1 1 1 scol O ; K -: N 1722 1345 364 126 rp C -1 1 0.801 1 scol L ; N 2086 1344 M 1721 1344 I 1721 1471 I 2086 1471 I C -K -0 0 0 1 scol 1744 1394 M (InstructionHandle)[10 23 20 11 14 23 21 11 8 23 23 30 23 23 23 10 0]xS -0.602 0 0.199 1 scol N 2086 1410 M 1721 1410 I 1721 1471 I 2086 1471 I C -K -N 2086 1433 M 1721 1433 I 1721 1471 I 2086 1471 I C -K -N 1904 1270 M 1904 1197 I K -N 1947 1181 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1947 1219 M (1)S -0.602 0 0.199 1 scol N 1904 1197 M 1919 1224 I 1904 1251 I 1889 1224 I 1904 1197 I C -: 1 1 1 1 scol O ; K -N 1904 1270 M 1904 1343 I K -N 1950 1313 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1950 1351 M (*)S -N 1947 1181 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1947 1219 M (1)S -N 1950 1313 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1950 1351 M (*)S -0.602 0 0.199 1 scol N 1572 1408 M 1424 1408 I K -N 1429 1439 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1429 1477 M (1)S -0.602 0 0.199 1 scol N 1572 1408 M 1720 1408 I K -N 1693 1439 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1693 1477 M (1)S -N 1429 1439 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1429 1477 M (1)S -N 1693 1439 23 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1693 1477 M (1)S -: N 0 1224 384 240 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol : 0 1223 385 242 rc N 384 1223 M -1 1223 I -1 1464 I 384 1464 I C -K -; 0 0 0 1 scol 20 1323 M (InstructionTargeter)[10 23 20 11 14 23 21 11 8 23 23 26 23 14 23 23 11 23 0]xS -0.602 0 0.199 1 scol : 0 1339 385 126 rc N 384 1339 M -1 1339 I -1 1464 I 384 1464 I C -K -; : 0 1362 385 103 rc N 384 1362 M -1 1362 I -1 1464 I 384 1464 I C -K -; 0 0 0 1 scol 58 1430 M (updateTarget\(\))[23 23 23 23 11 23 26 23 14 23 23 11 14 0]xS -64 1273 M (<<Interface>>)[24 24 10 23 11 23 14 12 23 21 23 24 0]xS -1 1 1 1 scol [ 72 24 ] 0 sd N 540 1231 M 385 1280 I K -0 0 0 1 scol [ 72 24 ] 0 sd N 540 1231 M 385 1280 I K -0.602 0 0.199 1 scol solid N 385 1280 M 449 1283 I 435 1241 I C -: 1 1 1 1 scol O ; K -1 1 1 1 scol [ 72 24 ] 0 sd N 541 1344 M 385 1344 I K -0 0 0 1 scol [ 72 24 ] 0 sd N 541 1344 M 385 1344 I K -0.602 0 0.199 1 scol solid N 385 1344 M 445 1366 I 445 1322 I C -: 1 1 1 1 scol O ; K -N 1043 1616 M 1903 1616 I K -N 1903 1616 M 1903 1472 I K -N 1949 1550 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1949 1588 M (*)S -0.602 0 0.199 1 scol N 1043 1616 M 191 1616 I K -N 191 1616 M 191 1465 I K -N 237 1542 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 237 1580 M (*)S -N 1949 1550 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1949 1588 M (*)S -N 237 1542 16 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 237 1580 M (*)S -N 1186 1556 221 47 rp C -1 1 1 1 scol L 0 0 0 1 scol 1186 1594 M (<<targets>>)[24 24 11 23 14 23 23 11 20 24 0]xS -: N 1707 306 362 284 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 2069 305 M 1706 305 I 1706 590 I 2069 590 I C -K -0 0 0 1 scol 1725 355 M (ConstantPoolGen)[30 23 23 20 11 23 23 11 27 23 23 10 32 23 0]xS -0.602 0 0.199 1 scol N 2069 371 M 1706 371 I 1706 590 I 2069 590 I C -K -N 2069 394 M 1706 394 I 1706 590 I 2069 590 I C -K -0 0 0 1 scol 1765 462 M (addClass\(\))[23 23 23 30 10 23 20 20 14 0]xS -1765 509 M (addMethodRef\(\))[23 23 23 33 23 11 23 23 23 30 23 12 14 0]xS -1765 556 M (addInteger\(\))[23 23 23 10 23 11 23 23 23 14 14 0]xS -: N 1475 683 314 234 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1789 682 M 1474 682 I 1474 917 I 1789 917 I C -K -0 0 0 1 scol 1541 732 M (ClassGen)[30 10 23 20 20 32 23 0]xS -0.602 0 0.199 1 scol N 1789 748 M 1474 748 I 1474 917 I 1789 917 I C -K -N 1789 771 M 1474 771 I 1474 917 I 1789 917 I C -K -0 0 0 1 scol 1533 839 M (addInterface\(\))[23 23 23 10 23 11 23 14 12 23 21 23 14 0]xS -1533 886 M (addMethod\(\))[23 23 23 33 23 11 23 23 23 14 0]xS -0.602 0 0.199 1 scol N 1634 682 M 1634 602 I K -N 1751 636 M 1782 591 I K -N 1751 636 M 1717 681 I K -1 1 1 1 scol [ 72 24 ] 0 sd N 536 1458 M 385 1408 I K -0 0 0 1 scol [ 72 24 ] 0 sd N 536 1458 M 385 1408 I K -0.602 0 0.199 1 scol solid N 385 1408 M 449 1406 I 435 1448 I C -: 1 1 1 1 scol O ; K -LH -%%PageTrailer - -%%Trailer -%%DocumentNeededResources: -%%+ font Helvetica-Oblique -%%+ font Helvetica -%%DocumentSuppliedResources: -Pscript_WinNT_Incr dup /terminate get exec -%%EOF -grestore - -%%EndDocument - @endspecial 934 5316 a Fq(Figur)n(e)26 b(4:)k(UML)25 -b(diagram)g(of)g(the)h(ClassGen)e(API)1863 5712 y(14)p -eop -%%Page: 15 15 -15 14 bop 0 407 a Ft(\(or)17 b(index\))g(within)g(the)g(byte)f(code.)25 -b(Since)18 b(many)f(instr)o(uctions)f(ar)n(e)i(immutable,)h(the)e -Ff(InstructionCon)o(st)o(an)o(ts)0 520 y Ft(interface)23 -b(of)n(fers)f(shar)n(eable)h(pr)n(ede\002ned)e(\223\003y-weight\224)h -(constants)g(to)g(use.)146 633 y(Instr)o(uctions)28 b(ar)n(e)h(gr)n -(ouped)e(via)k(sub-classing,)f(the)f(type)e(hierar)n(chy)j(of)f(instr)o -(uction)f(classes)h(is)g(illus-)0 746 y(trated)d(by)h(\(incomplete\))g -(\002gur)n(e)f(9)h(in)h(the)e(appendix.)39 b(The)27 b(most)f(important) -g(family)j(of)e(instr)o(uctions)f(ar)n(e)0 858 y(the)h -Fs(branch)h(instructions)p Ft(,)i(e.g.)42 b Ff(goto)p -Ft(,)27 b(that)h(branch)g(to)f(tar)n(gets)g(somewher)n(e)e(within)j -(the)f(byte)g(code.)42 b(Ob-)0 971 y(viously)-10 b(,)24 -b(this)f(makes)g(them)g(candidates)h(for)f(playing)h(an)g -Ff(InstructionTarge)o(te)o(r)18 b Ft(r)n(ole,)23 b(too.)31 -b(Instr)o(uc-)0 1084 y(tions)16 b(ar)n(e)i(further)e(gr)n(ouped)g(by)h -(the)f(interfaces)h(they)f(implement,)i(ther)n(e)e(ar)n(e,)i(e.g.,)f -Ff(TypedInstructi)o(on)p Ft(s)0 1197 y(that)24 b(ar)n(e)h(associated)f -(with)h(a)g(speci\002c)g(type)e(like)i Ff(ldc)p Ft(,)f(or)g -Ff(ExceptionThrowe)o(r)18 b Ft(instr)o(uctions)24 b(that)h(may)0 -1310 y(raise)e(exceptions)e(when)g(executed.)146 1423 -y(All)i(instr)o(uctions)f(can)h(be)f(traversed)f(via)i -Ff(accept\(Visitor)48 b(v\))22 b Ft(methods,)e(i.e.,)h(the)h(V)-5 -b(isitor)21 b(design)0 1536 y(pattern.)53 b(Ther)n(e)31 -b(is)g(however)f(some)h(special)h(trick)f(in)h(these)e(methods)f(that)i -(allows)h(to)f(mer)n(ge)g(the)f(han-)0 1649 y(dling)21 -b(of)g(certain)g(instr)o(uction)g(gr)n(oups.)26 b(The)20 -b Ff(accept\(\))d Ft(do)j(not)h(only)f(call)j(the)d(corr)n(esponding)f -Ff(visit\(\))0 1762 y Ft(method,)34 b(but)g(call)h Ff(visit\(\))30 -b Ft(methods)i(of)h(their)g(r)n(espective)f(super)g(classes)h(and)h -(implemented)e(inter)n(-)0 1875 y(faces)27 b(\002rst,)g(i.e.)40 -b(the)26 b(most)g(speci\002c)h Ff(visit\(\))d Ft(call)29 -b(is)e(last.)40 b(Thus)26 b(one)g(can)i(gr)n(oup)e(the)g(handling)h -(of,)h(say)-10 b(,)0 1988 y(all)24 b Ff(BranchInstructi)o(on)o -Ft(s)17 b(into)22 b(one)g(single)g(method.)146 2100 y(For)30 -b(debugging)f(purposes)f(it)j(may)g(even)g(make)f(sense)f(to)h -(\223invent\224)i(your)e(own)g(instr)o(uctions.)51 b(In)31 -b(a)0 2213 y(sophisticated)23 b(code)h(generator)f(like)i(the)e(one)h -(used)g(as)g(a)i(backend)e(of)h(the)f(Barat)g(framework)g([BS98)q(])h -(one)0 2326 y(often)h(has)g(to)h(insert)e(temporary)h -Ff(nop)f Ft(\(No)h(operation\))g(instr)o(uctions.)39 -b(When)27 b(examining)g(the)f(pr)n(oduced)0 2439 y(code)34 -b(it)g(may)h(be)f(very)g(dif)n(\002cult)i(to)d(track)i(back)g(wher)n(e) -f(the)f Ff(nop)g Ft(was)i(actually)g(inserted.)62 b(One)34 -b(could)0 2552 y(think)24 b(of)h(a)h(derived)e Ff(nop2)f -Ft(instr)o(uction)h(that)h(contains)g(additional)g(debugging)e -(information.)36 b(When)24 b(the)0 2665 y(instr)o(uction)e(list)h(is)g -(dumped)e(to)h(byte)g(code,)f(the)h(extra)g(data)h(is)g(simply)f(dr)n -(opped.)146 2778 y(One)j(could)g(also)g(think)g(of)g(new)f(byte)g(code) -g(instr)o(uctions)g(operating)g(on)h(complex)g(numbers)f(that)h(ar)n(e) -0 2891 y(r)n(eplaced)e(by)f(normal)h(byte)f(code)g(upon)g(load-time)h -(or)f(ar)n(e)h(r)n(ecognized)f(by)h(a)g(new)f(JVM.)0 -3147 y Fg(3.3.4)99 b(Instruction)25 b(lists)0 3324 y -Ft(An)18 b Fs(instruction)i(list)g Ft(is)e(implemented)g(by)g(a)h(list) -g(of)g Fs(instruction)g(handles)h Ft(encapsulating)f(instr)o(uction)f -(objects.)0 3437 y(Refer)n(ences)k(to)g(instr)o(uctions)h(in)h(the)e -(list)i(ar)n(e)g(thus)e(not)h(implemented)f(by)h(dir)n(ect)g(pointers)f -(to)h(instr)o(uctions)0 3549 y(but)31 b(by)f(pointers)f(to)h(instr)o -(uction)h Fs(handles)p Ft(.)53 b(This)31 b(makes)f(appending,)h -(inserting)f(and)h(deleting)e(ar)n(eas)i(of)0 3662 y(code)25 -b(very)h(simple.)38 b(Since)27 b(we)e(use)h(symbolic)g(r)n(efer)n -(ences,)g(computation)g(of)g(concr)n(ete)g(byte)f(code)g(of)n(fsets)0 -3775 y(does)19 b(not)h(need)f(to)h(occur)h(until)f(\002nalization,)j -(i.e.)k(until)21 b(the)f(user)f(has)i(\002nished)e(the)h(pr)n(ocess)f -(of)i(generating)0 3888 y(or)29 b(transforming)f(code.)46 -b(W)-8 b(e)28 b(will)i(use)e(the)g(term)h(instr)o(uction)f(handle)h -(and)g(instr)o(uction)g(synonymously)0 4001 y(thr)n(oughout)23 -b(the)h(r)n(est)g(of)h(the)f(paper)-7 b(.)35 b(Instr)o(uction)23 -b(handles)i(may)g(contain)h(additional)f(user)n(-de\002ned)e(data)0 -4114 y(using)f(the)g Ff(addAttribute\(\))16 b Ft(method.)0 -4362 y Fg(Appending.)90 b Ft(One)29 b(can)g(append)e(instr)o(uctions)h -(or)g(other)g(instr)o(uction)g(lists)g(anywher)n(e)g(to)g(an)h -(existing)0 4475 y(list.)63 b(The)34 b(instr)o(uctions)g(ar)n(e)h -(appended)d(after)i(the)g(given)g(instr)o(uction)g(handle.)63 -b(All)36 b(append)d(methods)0 4588 y(r)n(eturn)27 b(a)h(new)g(instr)o -(uction)f(handle)h(which)g(may)h(then)d(be)i(used)f(as)h(the)f(tar)n -(get)g(of)h(a)g(branch)h(instr)o(uction,)0 4701 y(e.g..)109 -4898 y Ff(InstructionList)48 b(il)53 b(=)i(new)e(InstructionLis)o(t\()o -(\);)109 5011 y(...)109 5124 y(GOTO)g(g)h(=)g(new)f(GOTO\(null\);)109 -5237 y(il.append\(g\);)109 5350 y(...)109 5463 y(InstructionHand)o(le) -48 b(ih)54 b(=)g(il.append\(Inst)o(ru)o(ct)o(ion)o(Co)o(ns)o(ta)o(nt)o -(s.A)o(CO)o(NS)o(T_)o(NU)o(LL\))o(;)1863 5712 y Fq(15)p -eop -%%Page: 16 16 -16 15 bop 109 407 a Ff(g.setTarget\(ih\))o(;)0 662 y -Fg(Inserting.)91 b Ft(Instr)o(uctions)24 b(may)j(be)f(inserted)e -(anywher)n(e)i(into)g(an)g(existing)f(list.)39 b(They)25 -b(ar)n(e)i(inserted)d(be-)0 775 y(for)n(e)19 b(the)f(given)g(instr)o -(uction)h(handle.)26 b(All)20 b(insert)e(methods)f(r)n(eturn)h(a)h(new) -f(instr)o(uction)h(handle)f(which)i(may)0 888 y(then)i(be)g(used)f(as)i -(the)f(start)g(addr)n(ess)f(of)i(an)g(exception)e(handler)-7 -b(,)23 b(for)f(example.)109 1114 y Ff(InstructionHand)o(le)48 -b(start)k(=)i(il.insert\(inser)o(tio)o(n_)o(po)o(in)o(t,)2073 -1227 y(InstructionCon)o(st)o(ant)o(s.)o(NO)o(P\))o(;)109 -1339 y(...)109 1452 y(mg.addException)o(Ha)o(nd)o(ler)o(\(s)o(ta)o(rt)o -(,)48 b(end,)53 b(handler,)e("java.io.IOExce)o(pt)o(io)o(n"\))o(;)0 -1708 y Fg(Deleting.)91 b Ft(Deletion)34 b(of)f(instr)o(uctions)g(is)h -(also)g(very)f(straightforwar)n(d;)38 b(all)e(instr)o(uction)d(handles) -g(and)0 1820 y(the)28 b(contained)g(instr)o(uctions)f(within)i(a)g -(given)g(range)f(ar)n(e)g(r)n(emoved)g(fr)n(om)h(the)f(instr)o(uction)g -(list)h(and)f(dis-)0 1933 y(posed.)e(The)c Ff(delete\(\))d -Ft(method)i(may)i(however)e(thr)n(ow)h(a)h Ff(TargetLostExcep)o(tio)o -(n)16 b Ft(when)22 b(ther)n(e)g(ar)n(e)0 2046 y(instr)o(uction)e(tar)n -(geters)e(still)j(r)n(efer)n(encing)f(one)f(of)h(the)f(deleted)f(instr) -o(uctions.)26 b(The)20 b(user)f(is)h(for)n(ced)g(to)f(handle)0 -2159 y(such)30 b(exceptions)f(in)i(a)g Ff(try-catch)c -Ft(block)k(and)f(r)n(edir)n(ect)g(these)f(r)n(efer)n(ences)h(elsewher)n -(e.)49 b(The)30 b Fs(peep)j(hole)0 2272 y Ft(optimizer)23 -b(described)e(in)i(section)f(A.3)h(gives)f(a)h(detailed)f(example)h -(for)f(this.)109 2498 y Ff(try)53 b({)218 2611 y(il.delete\(first)o(,) -48 b(last\);)109 2724 y(})54 b(catch\(TargetLos)o(tE)o(xce)o(pt)o(io)o -(n)48 b(e\))54 b({)218 2837 y(InstructionHand)o(le)o([])48 -b(targets)j(=)k(e.getTargets\(\))o(;)218 2949 y(for\(int)d(i=0;)g(i)i -(<)g(targets.length;)48 b(i++\))53 b({)327 3062 y(InstructionTarg)o -(ete)o(r[)o(])48 b(targeters)j(=)j(targets[i].get)o(Tar)o(ge)o(te)o(rs) -o(\(\))o(;)327 3175 y(for\(int)e(j=0;)g(j)i(<)h(targeters.leng)o(th)o -(;)48 b(j++\))491 3288 y(targeters[j].up)o(da)o(te)o(Ta)o(rg)o(et\()o -(ta)o(rg)o(et)o(s[)o(i],)g(new_target\);)218 3401 y(})109 -3514 y(})0 3769 y Fg(Finalizing.)92 b Ft(When)27 b(the)g(instr)o -(uction)h(list)g(is)g(r)n(eady)g(to)f(be)h(dumped)f(to)g(pur)n(e)h -(byte)f(code,)h(all)h(symbolic)0 3882 y(r)n(efer)n(ences)35 -b(must)g(be)h(mapped)g(to)f(r)n(eal)i(byte)e(code)h(of)n(fsets.)67 -b(This)36 b(is)g(done)f(by)h(the)f Ff(getByteCode\(\))0 -3995 y Ft(method)23 b(which)i(is)f(called)h(by)f(default)g(by)g -Ff(MethodGen.getMe)o(th)o(od)o(\(\))o Ft(.)j(Afterwar)n(ds)c(you)g -(should)g(call)0 4108 y Ff(dispose\(\))c Ft(so)j(that)h(the)f(instr)o -(uction)h(handles)f(can)i(be)f(r)n(eused)e(internally)-10 -b(.)29 b(This)23 b(helps)f(to)g(r)n(educe)h(mem-)0 4221 -y(ory)f(usage.)109 4447 y Ff(InstructionList)48 b(il)53 -b(=)i(new)e(InstructionLis)o(t\()o(\);)109 4672 y(ClassGen)106 -b(cg)53 b(=)h(new)f(ClassGen\("HelloW)o(or)o(ld)o(",)48 -b("java.lang.Obje)o(ct)o(",)1636 4785 y("<generated>",)h(ACC_PUBLIC)h -(|)k(ACC_SUPER,)1636 4898 y(null\);)109 5011 y(MethodGen)d(mg)i(=)h -(new)f(MethodGen\(ACC_ST)o(AT)o(IC)48 b(|)54 b(ACC_PUBLIC,)1691 -5124 y(Type.VOID,)c(new)j(Type[])f({)1800 5237 y(new)h -(ArrayType\(Type.)o(ST)o(RIN)o(G,)48 b(1\))1691 5350 -y(},)54 b(new)f(String[])e({)j("argv")e(},)1691 5463 -y("main",)f("HelloWorld",)e(il,)k(cp\);)1863 5712 y Fq(16)p -eop -%%Page: 17 17 -17 16 bop 109 407 a Ff(...)109 520 y(cg.addMethod\(mg)o(.g)o(et)o(Met)o -(ho)o(d\()o(\)\))o(;)109 633 y(il.dispose\(\);)49 b(//)k(Reuse)g -(instruction)c(handles)j(of)h(list)0 887 y Fg(3.3.5)99 -b(Code)25 b(example)f(revisited)0 1063 y Ft(Using)h(instr)o(uction)g -(lists)h(gives)f(us)g(a)i(generic)e(view)h(upon)e(the)h(code:)34 -b(In)25 b(Figur)n(e)g(5)h(we)f(again)i(pr)n(esent)d(the)0 -1176 y(code)e(chunk)h(of)g(the)f Ff(readInt\(\))d Ft(method)i(of)i(the) -f(faculty)i(example)e(in)i(section)e(2.6:)29 b(The)22 -b(local)j(variables)0 1289 y Ff(n)k Ft(and)g Ff(e1)g -Ft(both)g(hold)g(two)g(r)n(efer)n(ences)f(to)h(instr)o(uctions,)h -(de\002ning)e(their)h(scope.)47 b(Ther)n(e)29 b(ar)n(e)h(two)e -Ff(goto)p Ft(s)0 1402 y(branching)g(to)e(the)g Ff(iload)f -Ft(at)j(the)e(end)g(of)h(the)f(method.)40 b(One)27 b(of)g(the)f -(exception)g(handlers)g(is)i(displayed,)0 1515 y(too:)f(it)c(r)n(efer)n -(ences)e(the)h(start)g(and)h(the)e(end)h(of)h(the)f Ff(try)f -Ft(block)i(and)g(also)f(the)g(exception)g(handler)g(code.)0 -4170 y @beginspecial 0 @llx 0 @lly 583 @urx 386 @ury -4590 @rwi @setspecial -%%BeginDocument: eps/il.eps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: il.eps -%%Creator: fig2dev Version 3.2 Patchlevel 1 -%%CreationDate: Wed Dec 2 15:26:46 1998 -%%For: dahm@che (Markus Dahm,,,,,) -%%Orientation: Portrait -%%BoundingBox: 0 0 583 386 -%%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 def - -end -save --84.0 526.0 translate -1 -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 -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 9337 m -1000 -1000 l 11587 -1000 l 11587 9337 l cp clip - 0.06299 0.06299 sc -% Polyline -7.500 slw - [60] 0 sd -gs clippath -5205 7530 m 5175 7650 l 5145 7530 l 5145 7665 l 5205 7665 l cp -clip -n 5175 6975 m 5175 7650 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 5205 7530 m 5175 7650 l 5145 7530 l col0 s -% Polyline - [60] 0 sd -gs clippath -5595 7095 m 5625 6975 l 5655 7095 l 5655 6960 l 5595 6960 l cp -clip -n 5625 7650 m 5625 6975 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 5595 7095 m 5625 6975 l 5655 7095 l col0 s -% Polyline - [60] 0 sd -gs clippath -5205 3930 m 5175 4050 l 5145 3930 l 5145 4065 l 5205 4065 l cp -clip -n 5175 3375 m 5175 4050 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 5205 3930 m 5175 4050 l 5145 3930 l col0 s -% Polyline - [60] 0 sd -gs clippath -5595 3495 m 5625 3375 l 5655 3495 l 5655 3360 l 5595 3360 l cp -clip -n 5625 4050 m 5625 3375 l gs col0 s gr gr - [] 0 sd -% arrowhead -n 5595 3495 m 5625 3375 l 5655 3495 l col0 s -% Polyline -n 4380 6750 m 4275 6750 4275 6870 105 arcto 4 {pop} repeat - 4275 6975 6420 6975 105 arcto 4 {pop} repeat - 6525 6975 6525 6855 105 arcto 4 {pop} repeat - 6525 6750 4380 6750 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 6930 m -gs 1 -1 sc (goto) col0 sh gr -% Polyline -n 4380 6300 m 4275 6300 4275 6420 105 arcto 4 {pop} repeat - 4275 6525 6420 6525 105 arcto 4 {pop} repeat - 6525 6525 6525 6405 105 arcto 4 {pop} repeat - 6525 6300 4380 6300 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4455 6480 m -gs 1 -1 sc (invokevirtual) col0 sh gr -% Polyline -n 4380 5850 m 4275 5850 4275 5970 105 arcto 4 {pop} repeat - 4275 6075 6420 6075 105 arcto 4 {pop} repeat - 6525 6075 6525 5955 105 arcto 4 {pop} repeat - 6525 5850 4380 5850 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 6030 m -gs 1 -1 sc (aload) col0 sh gr -% Polyline -n 4380 5400 m 4275 5400 4275 5520 105 arcto 4 {pop} repeat - 4275 5625 6420 5625 105 arcto 4 {pop} repeat - 6525 5625 6525 5505 105 arcto 4 {pop} repeat - 6525 5400 4380 5400 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 5580 m -gs 1 -1 sc (getstatic) col0 sh gr -% Polyline -n 4380 4950 m 4275 4950 4275 5070 105 arcto 4 {pop} repeat - 4275 5175 6420 5175 105 arcto 4 {pop} repeat - 6525 5175 6525 5055 105 arcto 4 {pop} repeat - 6525 4950 4380 4950 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 5130 m -gs 1 -1 sc (astore) col0 sh gr -% Polyline -n 4380 4500 m 4275 4500 4275 4620 105 arcto 4 {pop} repeat - 4275 4725 6420 4725 105 arcto 4 {pop} repeat - 6525 4725 6525 4605 105 arcto 4 {pop} repeat - 6525 4500 4380 4500 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 4680 m -gs 1 -1 sc (goto) col0 sh gr -% Polyline -n 4380 4050 m 4275 4050 4275 4170 105 arcto 4 {pop} repeat - 4275 4275 6420 4275 105 arcto 4 {pop} repeat - 6525 4275 6525 4155 105 arcto 4 {pop} repeat - 6525 4050 4380 4050 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4455 4230 m -gs 1 -1 sc (istore) col0 sh gr -% Polyline -gs clippath -5595 4395 m 5625 4275 l 5655 4395 l 5655 4260 l 5595 4260 l cp -clip -n 5625 4500 m 5625 4275 l gs col0 s gr gr - -% arrowhead -n 5595 4395 m 5625 4275 l 5655 4395 l col0 s -% Polyline -gs clippath -5205 4380 m 5175 4500 l 5145 4380 l 5145 4515 l 5205 4515 l cp -clip -n 5175 4275 m 5175 4500 l gs col0 s gr gr - -% arrowhead -n 5205 4380 m 5175 4500 l 5145 4380 l col0 s -% Polyline -gs clippath -5595 4845 m 5625 4725 l 5655 4845 l 5655 4710 l 5595 4710 l cp -clip -n 5625 4950 m 5625 4725 l gs col0 s gr gr - -% arrowhead -n 5595 4845 m 5625 4725 l 5655 4845 l col0 s -% Polyline -gs clippath -5205 4830 m 5175 4950 l 5145 4830 l 5145 4965 l 5205 4965 l cp -clip -n 5175 4725 m 5175 4950 l gs col0 s gr gr - -% arrowhead -n 5205 4830 m 5175 4950 l 5145 4830 l col0 s -% Polyline -gs clippath -5595 5295 m 5625 5175 l 5655 5295 l 5655 5160 l 5595 5160 l cp -clip -n 5625 5400 m 5625 5175 l gs col0 s gr gr - -% arrowhead -n 5595 5295 m 5625 5175 l 5655 5295 l col0 s -% Polyline -gs clippath -5205 5280 m 5175 5400 l 5145 5280 l 5145 5415 l 5205 5415 l cp -clip -n 5175 5175 m 5175 5400 l gs col0 s gr gr - -% arrowhead -n 5205 5280 m 5175 5400 l 5145 5280 l col0 s -% Polyline -gs clippath -5595 5745 m 5625 5625 l 5655 5745 l 5655 5610 l 5595 5610 l cp -clip -n 5625 5850 m 5625 5625 l gs col0 s gr gr - -% arrowhead -n 5595 5745 m 5625 5625 l 5655 5745 l col0 s -% Polyline -gs clippath -5205 5730 m 5175 5850 l 5145 5730 l 5145 5865 l 5205 5865 l cp -clip -n 5175 5625 m 5175 5850 l gs col0 s gr gr - -% arrowhead -n 5205 5730 m 5175 5850 l 5145 5730 l col0 s -% Polyline -gs clippath -5595 6195 m 5625 6075 l 5655 6195 l 5655 6060 l 5595 6060 l cp -clip -n 5625 6300 m 5625 6075 l gs col0 s gr gr - -% arrowhead -n 5595 6195 m 5625 6075 l 5655 6195 l col0 s -% Polyline -gs clippath -5205 6180 m 5175 6300 l 5145 6180 l 5145 6315 l 5205 6315 l cp -clip -n 5175 6075 m 5175 6300 l gs col0 s gr gr - -% arrowhead -n 5205 6180 m 5175 6300 l 5145 6180 l col0 s -% Polyline -gs clippath -5595 6645 m 5625 6525 l 5655 6645 l 5655 6510 l 5595 6510 l cp -clip -n 5625 6750 m 5625 6525 l gs col0 s gr gr - -% arrowhead -n 5595 6645 m 5625 6525 l 5655 6645 l col0 s -% Polyline -gs clippath -5205 6630 m 5175 6750 l 5145 6630 l 5145 6765 l 5205 6765 l cp -clip -n 5175 6525 m 5175 6750 l gs col0 s gr gr - -% arrowhead -n 5205 6630 m 5175 6750 l 5145 6630 l col0 s -% Polyline -n 4380 7650 m 4275 7650 4275 7770 105 arcto 4 {pop} repeat - 4275 7875 6420 7875 105 arcto 4 {pop} repeat - 6525 7875 6525 7755 105 arcto 4 {pop} repeat - 6525 7650 4380 7650 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4455 7830 m -gs 1 -1 sc (iload) col0 sh gr -% Polyline -n 4380 8100 m 4275 8100 4275 8220 105 arcto 4 {pop} repeat - 4275 8325 6420 8325 105 arcto 4 {pop} repeat - 6525 8325 6525 8205 105 arcto 4 {pop} repeat - 6525 8100 4380 8100 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4455 8280 m -gs 1 -1 sc (ireturn) col0 sh gr -% Polyline -gs clippath -5595 7995 m 5625 7875 l 5655 7995 l 5655 7860 l 5595 7860 l cp -clip -n 5625 8100 m 5625 7875 l gs col0 s gr gr - -% arrowhead -n 5595 7995 m 5625 7875 l 5655 7995 l col0 s -% Polyline -gs clippath -5205 7980 m 5175 8100 l 5145 7980 l 5145 8115 l 5205 8115 l cp -clip -n 5175 7875 m 5175 8100 l gs col0 s gr gr - -% arrowhead -n 5205 7980 m 5175 8100 l 5145 7980 l col0 s -% Polyline -gs clippath -5595 2595 m 5625 2475 l 5655 2595 l 5655 2460 l 5595 2460 l cp -clip -n 5625 2700 m 5625 2475 l gs col0 s gr gr - -% arrowhead -n 5595 2595 m 5625 2475 l 5655 2595 l col0 s -% Polyline -gs clippath -5205 2580 m 5175 2700 l 5145 2580 l 5145 2715 l 5205 2715 l cp -clip -n 5175 2475 m 5175 2700 l gs col0 s gr gr - -% arrowhead -n 5205 2580 m 5175 2700 l 5145 2580 l col0 s -% Polyline -n 4380 3150 m 4275 3150 4275 3270 105 arcto 4 {pop} repeat - 4275 3375 6420 3375 105 arcto 4 {pop} repeat - 6525 3375 6525 3255 105 arcto 4 {pop} repeat - 6525 3150 4380 3150 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 3330 m -gs 1 -1 sc (getstatic) col0 sh gr -% Polyline -n 4380 2700 m 4275 2700 4275 2820 105 arcto 4 {pop} repeat - 4275 2925 6420 2925 105 arcto 4 {pop} repeat - 6525 2925 6525 2805 105 arcto 4 {pop} repeat - 6525 2700 4380 2700 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4455 2880 m -gs 1 -1 sc (istore) col0 sh gr -% Polyline -n 4380 2250 m 4275 2250 4275 2370 105 arcto 4 {pop} repeat - 4275 2475 6420 2475 105 arcto 4 {pop} repeat - 6525 2475 6525 2355 105 arcto 4 {pop} repeat - 6525 2250 4380 2250 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -4500 2430 m -gs 1 -1 sc (sipush) col0 sh gr -% Polyline -gs clippath -5595 3045 m 5625 2925 l 5655 3045 l 5655 2910 l 5595 2910 l cp -clip -n 5625 3150 m 5625 2925 l gs col0 s gr gr - -% arrowhead -n 5595 3045 m 5625 2925 l 5655 3045 l col0 s -% Polyline -gs clippath -5205 3030 m 5175 3150 l 5145 3030 l 5145 3165 l 5205 3165 l cp -clip -n 5175 2925 m 5175 3150 l gs col0 s gr gr - -% arrowhead -n 5205 3030 m 5175 3150 l 5145 3030 l col0 s -% Polyline -n 1350 5175 m 3600 5175 l 3600 5625 l 1350 5625 l cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -1575 5400 m -gs 1 -1 sc (IOException e1) col0 sh gr -% Polyline -n 1575 5175 m 1575 4950 l 3825 4950 l 3825 5400 l 3600 5400 l 3600 5175 l - 1575 5175 l cp gs 0.00 setgray ef gr gs col0 s gr -% Polyline -n 1350 3600 m 3600 3600 l 3600 4050 l 1350 4050 l cp gs col0 s gr -/Courier-Bold ff 210.00 scf sf -1575 3825 m -gs 1 -1 sc (int n) col0 sh gr -% Polyline -n 1575 3600 m 1575 3375 l 3825 3375 l 3825 3825 l 3600 3825 l 3600 3600 l - 1575 3600 l cp gs 0.00 setgray ef gr gs col0 s gr -% Polyline -n 7200 4050 m 10350 4050 l 10350 4500 l 7200 4500 l cp gs col0 s gr -% Polyline -n 7425 4050 m 7425 3825 l 10575 3825 l 10575 4275 l 10350 4275 l 10350 4050 l - 8325 4050 l gs 0.00 setgray ef gr gs col0 s gr -/Courier-Bold ff 210.00 scf sf -7425 4275 m -gs 1 -1 sc (Exception handler 1) col0 sh gr -% Polyline -gs clippath -4152 5071 m 4275 5085 l 4160 5131 l 4294 5113 l 4286 5053 l cp -clip -n 3600 5175 m 4275 5085 l gs col0 s gr gr - -% arrowhead -n 4152 5071 m 4275 5085 l 4160 5131 l 4156 5101 l 4152 5071 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -4190 2475 m 4275 2385 l 4243 2504 l 4309 2386 l 4256 2357 l cp -clip -n 3600 3600 m 4275 2385 l gs col0 s gr gr - -% arrowhead -n 4190 2475 m 4275 2385 l 4243 2504 l 4217 2490 l 4190 2475 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -4221 6324 m 4275 6435 l 4175 6362 l 4262 6466 l 4308 6427 l cp -clip -n 3600 5625 m 4275 6435 l gs col0 s gr gr - -% arrowhead -n 4221 6324 m 4275 6435 l 4175 6362 l 4198 6343 l 4221 6324 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6635 5029 m 6525 5085 l 6596 4984 l 6494 5072 l 6533 5117 l cp -clip -n 7200 4500 m 6525 5085 l gs col0 s gr gr - -% arrowhead -n 6635 5029 m 6525 5085 l 6596 4984 l 6616 5006 l 6635 5029 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6645 4215 m 6525 4185 l 6645 4155 l 6510 4155 l 6510 4215 l cp -clip -n 7200 4185 m 6525 4185 l gs col0 s gr gr - -% arrowhead -n 6645 4215 m 6525 4185 l 6645 4155 l 6645 4185 l 6645 4215 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6582 3395 m 6525 3285 l 6627 3355 l 6538 3254 l 6493 3294 l cp -clip -n 7200 4050 m 6525 3285 l gs col0 s gr gr - -% arrowhead -n 6582 3395 m 6525 3285 l 6627 3355 l 6604 3375 l 6582 3395 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -4329 7977 m 4320 8100 l 4269 7987 l 4293 8120 l 4352 8110 l cp -clip -n 3600 4050 m 4320 8100 l gs col0 s gr gr - -% arrowhead -n 4329 7977 m 4320 8100 l 4269 7987 l 4299 7982 l 4329 7977 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6649 7784 m 6525 7785 l 6633 7726 l 6503 7760 l 6518 7818 l cp -clip -n 6525 4635 m 6527 4636 l 6532 4640 l 6542 4646 l 6556 4655 l 6575 4667 l - 6600 4683 l 6628 4702 l 6661 4723 l 6695 4746 l 6731 4771 l - 6768 4796 l 6804 4821 l 6838 4845 l 6871 4869 l 6902 4892 l - 6931 4915 l 6958 4936 l 6983 4957 l 7005 4977 l 7026 4996 l - 7045 5015 l 7063 5034 l 7080 5054 l 7095 5073 l 7110 5093 l - 7124 5113 l 7137 5133 l 7150 5154 l 7162 5176 l 7174 5199 l - 7185 5223 l 7196 5247 l 7207 5273 l 7216 5299 l 7226 5326 l - 7235 5353 l 7243 5381 l 7251 5409 l 7258 5438 l 7265 5467 l - 7271 5496 l 7276 5525 l 7281 5554 l 7286 5582 l 7290 5611 l - 7293 5639 l 7296 5667 l 7299 5694 l 7301 5721 l 7303 5748 l - 7305 5775 l 7306 5802 l 7308 5829 l 7309 5857 l 7310 5885 l - 7310 5914 l 7311 5944 l 7311 5974 l 7311 6004 l 7311 6035 l - 7310 6067 l 7310 6099 l 7309 6131 l 7308 6163 l 7307 6195 l - 7306 6227 l 7305 6258 l 7304 6289 l 7302 6320 l 7301 6350 l - 7299 6379 l 7298 6407 l 7296 6435 l 7295 6462 l 7293 6489 l - 7292 6514 l 7290 6540 l 7288 6567 l 7287 6595 l 7285 6622 l - 7283 6650 l 7281 6677 l 7279 6706 l 7277 6734 l 7275 6762 l - 7273 6791 l 7270 6820 l 7268 6848 l 7265 6877 l 7263 6905 l - 7260 6932 l 7257 6959 l 7255 6986 l 7252 7011 l 7249 7036 l - 7246 7060 l 7243 7084 l 7240 7106 l 7237 7128 l 7233 7149 l - 7230 7170 l 7226 7195 l 7221 7219 l 7216 7243 l 7211 7268 l - 7205 7292 l 7198 7317 l 7191 7342 l 7183 7366 l 7174 7390 l - 7165 7414 l 7155 7436 l 7144 7459 l 7133 7480 l 7121 7500 l - 7108 7519 l 7095 7537 l 7081 7553 l 7066 7569 l 7051 7584 l - 7035 7598 l 7020 7609 l 7003 7621 l 6985 7632 l 6966 7642 l - 6945 7653 l 6921 7663 l 6895 7674 l 6867 7684 l 6836 7695 l - 6803 7706 l 6767 7717 l 6730 7728 l 6693 7739 l 6656 7750 l - 6622 7759 l 6592 7767 l 6567 7774 l 6525 7785 l gs col0 s gr gr - -% arrowhead -n 6649 7784 m 6525 7785 l 6633 7726 l 6641 7755 l 6649 7784 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6619 7615 m 6525 7695 l 6570 7580 l 6492 7690 l 6541 7725 l cp -clip -n 6525 6840 m 6526 6843 l 6529 6850 l 6533 6863 l 6540 6882 l 6549 6908 l - 6560 6938 l 6572 6973 l 6585 7010 l 6598 7048 l 6610 7086 l - 6622 7122 l 6632 7157 l 6642 7189 l 6650 7219 l 6657 7246 l - 6663 7271 l 6667 7294 l 6671 7315 l 6673 7335 l 6675 7354 l - 6675 7373 l 6674 7394 l 6672 7415 l 6669 7435 l 6663 7455 l - 6656 7476 l 6648 7498 l 6637 7520 l 6624 7544 l 6610 7568 l - 6595 7593 l 6579 7617 l 6564 7640 l 6550 7660 l 6525 7695 l gs col0 s gr gr - -% arrowhead -n 6619 7615 m 6525 7695 l 6570 7580 l 6595 7597 l 6619 7615 l cp gs 0.00 setgray ef gr col0 s -$F2psEnd -rs - -%%EndDocument - @endspecial 844 4373 a Fq(Figur)n(e)k(5:)31 b(Instr)o(uction)26 -b(list)g(for)g Fh(readInt\(\))d Fq(method)0 4834 y Fg(3.3.6)99 -b(Instruction)25 b(factories)0 5011 y Ft(T)-8 b(o)16 -b(simplify)i(the)f(cr)n(eation)g(of)g(certain)h(instr)o(uctions)e(the)h -(user)f(can)i(use)e(the)g(supplied)g Ff(InstructionFact)o(or)o(y)0 -5124 y Ft(class)28 b(which)f(of)n(fers)g(a)h(lot)f(of)g(useful)g -(methods)e(to)i(cr)n(eate)g(instr)o(uctions)f(fr)n(om)i(scratch.)42 -b(Alternatively)-10 b(,)28 b(he)0 5237 y(can)j(also)g(use)e -Fs(compound)i(instructions)p Ft(:)45 b(When)29 b(pr)n(oducing)h(byte)f -(code,)j(some)d(patterns)g(typically)i(occur)0 5350 y(very)25 -b(fr)n(equently)-10 b(,)24 b(for)h(instance)g(the)g(compilation)h(of)f -(arithmetic)h(or)f(comparison)g(expr)n(essions.)34 b(Y)-8 -b(ou)24 b(cer)n(-)0 5463 y(tainly)k(do)f(not)g(want)h(to)f(r)n(ewrite)g -(the)g(code)g(that)g(translates)g(such)g(expr)n(essions)f(into)h(byte)g -(code)g(in)h(every)1863 5712 y Fq(17)p eop -%%Page: 18 18 -18 17 bop 0 407 a Ft(place)26 b(they)f(may)h(appear)-7 -b(.)36 b(In)26 b(or)n(der)e(to)h(support)f(this,)i(the)e -Fe(BCEL)j Ft(API)e(includes)h(a)g Fs(compound)g(instruction)0 -520 y Ft(\(an)k(interface)f(with)f(a)i(single)e Ff(getInstructionL)o -(is)o(t\()o(\))23 b Ft(method\).)45 b(Instances)27 b(of)i(this)g(class) -g(may)g(be)0 633 y(used)21 b(in)i(any)g(place)g(wher)n(e)f(normal)h -(instr)o(uctions)f(would)g(occur)-7 b(,)23 b(particularly)h(in)f -(append)e(operations.)0 898 y Fg(Example:)43 b(Pushing)32 -b(constants.)92 b Ft(Pushing)28 b(constants)g(onto)f(the)h(operand)g -(stack)g(may)h(be)g(coded)f(in)0 1011 y(dif)n(fer)n(ent)g(ways.)44 -b(As)27 b(explained)h(in)g(section)g(2.2)h(ther)n(e)e(ar)n(e)h(some)f -(\223short-cut\224)h(instr)o(uctions)f(that)h(can)h(be)0 -1124 y(used)20 b(to)h(make)g(the)f(pr)n(oduced)g(byte)g(code)h(mor)n(e) -g(compact.)28 b(The)20 b(smallest)i(instr)o(uction)f(to)f(push)h(a)h -(single)e Ff(1)0 1237 y Ft(onto)h(the)h(stack)g(is)g -Ff(iconst)p 1002 1237 28 4 v 30 w(1)p Ft(,)g(other)f(possibilities)i -(ar)n(e)f Ff(bipush)e Ft(\(can)k(be)e(used)f(to)h(push)f(values)i -(between)0 1350 y(-128)h(and)f(127\),)h Ff(sipush)c Ft(\(between)h -(-32768)26 b(and)c(32767\),)j(or)e Ff(ldc)e Ft(\(load)i(constant)f(fr)n -(om)h(constant)f(pool\).)146 1465 y(Instead)28 b(of)i(r)n(epeatedly)d -(selecting)i(the)g(most)f(compact)i(instr)o(uction)f(in,)j(say)-10 -b(,)30 b(a)g(switch,)h(one)e(can)h(use)0 1578 y(the)20 -b(compound)g Ff(PUSH)g Ft(instr)o(uction)h(whenever)f(pushing)g(a)h -(constant)g(number)g(or)g(string.)26 b(It)21 b(will)h(pr)n(oduce)0 -1691 y(the)g(appr)n(opriate)g(byte)g(code)f(instr)o(uction)i(and)f -(insert)g(entries)f(into)i(to)f(constant)f(pool)h(if)i(necessary)-10 -b(.)109 1929 y Ff(il.append\(new)49 b(PUSH\(cp,)i("Hello,)g -(world"\)\);)109 2042 y(il.append\(new)e(PUSH\(cp,)i(4711\)\);)0 -2315 y Fg(3.3.7)99 b(Code)25 b(patterns)f(using)i(regular)e -(expressions)0 2496 y Ft(When)j(transforming)g(code,)g(for)g(instance)g -(during)g(optimization)h(or)f(when)f(inserting)h(analysis)g(method)0 -2609 y(calls,)35 b(one)c(typically)h(sear)n(ches)f(for)g(certain)h -(patterns)e(of)i(code)e(to)h(perform)g(the)g(transformation)g(at.)55 -b(T)-8 b(o)0 2722 y(simplify)27 b(handling)g(such)f(situations)g -Fe(BCEL)i Ft(intr)n(oduces)e(a)h(special)g(featur)n(e:)35 -b(One)27 b(can)g(sear)n(ch)g(for)f(given)0 2835 y(code)17 -b(patterns)e(within)j(an)g(instr)o(uction)f(list)h(using)e -Fs(r)n(egular)k(expr)n(essions)p Ft(.)30 b(In)17 b(such)g(expr)n -(essions,)f(instr)o(uctions)0 2948 y(ar)n(e)26 b(r)n(epr)n(esented)e -(by)i(symbolic)g(names,)h(e.g.)37 b(\224)p Ff(`IfInstruction')p -Ft(\224.)32 b(Meta)26 b(characters)g(like)g Ff(+)p Ft(,)h -Ff(*)p Ft(,)f(and)0 3061 y Ff(\(..|..\))20 b Ft(have)j(their)f(usual)h -(meanings.)k(Thus,)22 b(the)f(expr)n(ession)109 3300 -y Ff("`NOP'+\(`ILOAD_)o(_')o(|`)o(ALO)o(AD)o(__)o('\))o(*")146 -3536 y Ft(r)n(epr)n(esents)28 b(a)i(piece)f(of)h(code)f(consisting)g -(of)h(at)g(least)f(one)g Ff(NOP)g Ft(followed)g(by)h(a)g(possibly)f -(empty)g(se-)0 3649 y(quence)22 b(of)g Ff(ILOAD)f Ft(and)i -Ff(ALOAD)d Ft(instr)o(uctions.)146 3764 y(The)j Ff(search\(\))d -Ft(method)j(of)g(class)i Ff(FindPattern)18 b Ft(gets)k(an)i(instr)o -(uction)g(list)g(and)f(a)i(r)n(egular)e(expr)n(es-)0 -3877 y(sion)g(as)g(ar)n(guments)f(and)h(r)n(eturns)f(an)i(array)f -(describing)g(the)g(ar)n(ea)h(of)f(matched)g(instr)o(uctions.)28 -b(Additional)0 3990 y(constraints)d(to)h(the)f(matching)i(ar)n(ea)g(of) -g(instr)o(uctions,)f(which)g(can)h(not)f(be)g(implemented)f(via)j(r)n -(egular)e(ex-)0 4103 y(pr)n(essions,)21 b(may)i(be)f(expr)n(essed)e -(via)k Fs(code)g(constraints)p Ft(.)0 4376 y Fg(3.3.8)99 -b(Example:)30 b(Optimizing)25 b(boolean)g(expressions.)0 -4557 y Ft(In)17 b(Java,)j(boolean)d(values)h(ar)n(e)f(mapped)g(to)g(1)h -(and)f(to)g(0,)h(r)n(espectively)-10 b(.)25 b(Thus,)18 -b(the)e(simplest)h(way)g(to)g(evaluate)0 4670 y(boolean)k(expr)n -(essions)e(is)j(to)f(push)f(a)i(1)g(or)f(a)h(0)g(onto)f(the)f(operand)g -(stack)h(depending)f(on)h(the)f(tr)o(uth)h(value)h(of)0 -4783 y(the)i(expr)n(ession.)31 b(But)23 b(this)h(way)-10 -b(,)25 b(the)e(subsequent)f(combination)k(of)e(boolean)h(expr)n -(essions)d(\(with)i Ff(&&)p Ft(,)g(e.g\))0 4896 y(yields)e(long)g -(chunks)g(of)h(code)e(that)i(push)e(lots)h(of)h(1s)g(and)f(0s)h(onto)f -(the)f(stack.)146 5011 y(When)i(the)f(code)g(has)h(been)f(\002nalized)i -(these)d(chunks)h(can)h(be)g(optimized)g(with)g(a)g Fs(peep)i(hole)f -Ft(algorithm:)0 5124 y(An)i Ff(IfInstruction)20 b Ft(\(e.g.)38 -b(the)26 b(comparison)g(of)g(two)g(integers:)33 b Ff(if)p -2529 5124 V 32 w(icmpeq)p Ft(\))24 b(that)h(either)h(pr)n(oduces)f(a)0 -5237 y(1)32 b(or)f(a)g(0)h(on)f(the)f(stack)h(and)g(is)h(followed)e(by) -h(an)h Ff(ifne)e Ft(instr)o(uction)g(\(branch)j(if)f(stack)f(value)h -Fd(6)p Fc(=)f Ft(0\))h(may)0 5350 y(be)d(r)n(eplaced)f(by)h(the)f -Ff(IfInstruction)23 b Ft(with)29 b(its)f(branch)i(tar)n(get)e(r)n -(eplaced)g(by)h(the)f(tar)n(get)g(of)h(the)f Ff(ifne)0 -5463 y Ft(instr)o(uction:)1863 5712 y Fq(18)p eop -%%Page: 19 19 -19 18 bop 109 407 a Ff(InstructionList)48 b(il)53 b(=)i(new)e -(InstructionLis)o(t\()o(\);)109 520 y(...)109 633 y(CodeConstraint)48 -b(constraint)i(=)k(new)g(CodeConstraint)o(\(\))48 b({)218 -746 y(public)k(boolean)f(checkCode\(Instru)o(ct)o(io)o(nH)o(an)o(dle)o -([])d(match\))k({)327 858 y(IfInstruction)d(if1)k(=)h -(\(IfInstruction\))o(ma)o(tch)o([0)o(].)o(ge)o(tI)o(nst)o(ru)o(ct)o(io) -o(n\()o(\);)327 971 y(GOTO)544 b(g)163 b(=)54 b(\(GOTO\)match[2].)o(ge) -o(tIn)o(st)o(ru)o(ct)o(io)o(n\(\))o(;)327 1084 y(return)e -(\(if1.getTarget\()o(\))c(==)54 b(match[3]\))c(&&)709 -1197 y(\(g.getTarget\(\))e(==)54 b(match[4]\);)218 1310 -y(})109 1423 y(};)109 1536 y(FindPattern)c(f)163 b(=)54 -b(new)f(FindPattern\(il\))o(;)109 1649 y(String)325 b(pat)53 -b(=)h("`IfInstruction)o('`)o(IC)o(ON)o(ST)o(_0')o(`G)o(OT)o(O')o(`I)o -(CON)o(ST)o(_1)o('")48 b(+)1091 1762 y("`NOP'\(`IFEQ'|`)o(IF)o(NE)o -('\))o(";)109 1875 y(InstructionHand)o(le)o([])g(match;)109 -1988 y(for\(Instruction)o(Ha)o(nd)o(le)g(ih)54 b(=)g(f.search\(pat,)48 -b(constraint\);)327 2100 y(ih)54 b(!=)g(null;)e(ih)h(=)i -(f.search\(pat,)48 b(match[0],)j(constraint\)\))e({)218 -2213 y(match)j(=)j(f.getMatch\(\);)48 b(//)54 b(Constraint)c(already)h -(checked)218 2326 y(...)218 2439 y(match[0].setTar)o(ge)o(t\(m)o(at)o -(ch)o([5)o(].)o(get)o(Ta)o(rg)o(et)o(\(\))o(\);)d(//)54 -b(Update)e(target)218 2552 y(...)218 2665 y(try)h({)327 -2778 y(il.delete\(match)o([1])o(,)48 b(match[5]\);)218 -2891 y(})54 b(catch\(TargetLos)o(tEx)o(ce)o(pt)o(io)o(n)48 -b(e\))54 b({)g(...)f(})109 3004 y(})146 3325 y Ft(The)26 -b(applied)g(code)f(constraint)h(object)g(ensur)n(es)f(that)h(the)f -(matched)h(code)f(r)n(eally)i(corr)n(esponds)d(to)i(the)0 -3437 y(tar)n(geted)e(expr)n(ession)g(pattern.)35 b(Subsequent)24 -b(application)j(of)e(this)h(algorithm)g(r)n(emoves)f(all)i(unnecessary) -0 3550 y(stack)g(operations)e(and)i(branch)h(instr)o(uctions)e(fr)n(om) -h(the)f(byte)g(code.)40 b(If)27 b(any)g(of)g(the)f(deleted)f(instr)o -(uctions)0 3663 y(is)g(still)h(r)n(efer)n(enced)d(by)i(an)h -Ff(InstructionTar)o(ge)o(te)o(r)19 b Ft(object,)25 b(the)f(r)n(efer)n -(ence)g(has)h(to)g(be)f(updated)g(in)h(the)0 3776 y Ff(catch)p -Ft(-clause.)146 3903 y(Code)g(example)h(A.1)g(gives)f(a)h(verbose)f -(example)h(of)f(how)h(to)f(cr)n(eate)h(a)g(class)g(\002le,)g(while)g -(example)g(A.3)0 4016 y(shows)e(how)i(to)f(implement)h(a)g(simple)g -(peephole)e(optimizer)i(and)g(how)g(to)f(deal)h(with)g -Ff(TargetLost)21 b Ft(ex-)0 4129 y(ceptions.)0 4468 y -Fg(Example)j(application:)91 b Ft(The)22 b(expr)n(ession)109 -4803 y Ff(if\(\(a)52 b(==)i(null\))e(||)i(\(i)g(<)g(2\)\))218 -4916 y(System.out.prin)o(tl)o(n\(")o(Oo)o(op)o(s")o(\);)146 -5237 y Ft(can)31 b(be)f(mapped)f(to)h(both)f(of)h(the)g(chunks)f(of)h -(byte)f(code)g(shown)g(in)i(\002gur)n(e)e(3.3.8.)51 b(The)29 -b(left)i(column)0 5350 y(r)n(epr)n(esents)18 b(the)i(unoptimized)g -(code)g(while)h(the)f(right)g(column)h(displays)f(the)g(same)g(code)g -(after)h(an)g(aggr)n(es-)0 5463 y(sively)i(optimizing)g(peep)e(hole)h -(algorithm)h(has)g(been)f(applied:)1863 5712 y Fq(19)p -eop -%%Page: 20 20 -20 19 bop 0 1311 a Ff(5:)108 b(aload_0)0 1424 y(6:)g(ifnull)434 -b(#13)0 1537 y(9:)108 b(iconst_0)0 1649 y(10:)53 b(goto)544 -b(#14)0 1762 y(13:)53 b(iconst_1)0 1875 y(14:)g(nop)0 -1988 y(15:)g(ifne)544 b(#36)0 2101 y(18:)53 b(iload_1)0 -2214 y(19:)g(iconst_2)0 2327 y(20:)g(if_icmplt)269 b(#27)0 -2440 y(23:)53 b(iconst_0)0 2553 y(24:)g(goto)544 b(#28)0 -2666 y(27:)53 b(iconst_1)0 2779 y(28:)g(nop)0 2891 y(29:)g(ifne)544 -b(#36)0 3004 y(32:)53 b(iconst_0)0 3117 y(33:)g(goto)544 -b(#37)0 3230 y(36:)53 b(iconst_1)0 3343 y(37:)g(nop)0 -3456 y(38:)g(ifeq)544 b(#52)0 3569 y(41:)53 b(getstatic)269 -b(System.out)0 3682 y(44:)53 b(ldc)599 b("Ooops")0 3795 -y(46:)53 b(invokevirtual)c(println)0 3908 y(52:)k(return)1899 -1311 y(10:)g(aload_0)1899 1424 y(11:)g(ifnull)434 b(#19)1899 -1537 y(14:)53 b(iload_1)1899 1650 y(15:)g(iconst_2)1899 -1763 y(16:)g(if_icmpge)269 b(#27)1899 1876 y(19:)53 b(getstatic)269 -b(System.out)1899 1989 y(22:)53 b(ldc)599 b("Ooops")1899 -2102 y(24:)53 b(invokevirtual)c(println)1899 2215 y(27:)k(return)995 -4181 y Fq(Figur)n(e)26 b(6:)31 b(Optimizing)25 b(boolean)h(expr)n -(essions)1863 5712 y(20)p eop -%%Page: 21 21 -21 20 bop 0 410 a Fr(4)143 b(Application)33 b(areas)0 -662 y Ft(Ther)n(e)20 b(ar)n(e)i(many)f(possible)g(application)h(ar)n -(eas)f(for)g Fe(BCEL)i Ft(ranging)e(fr)n(om)g(class)h(br)n(owsers,)e -(pr)n(o\002lers,)g(byte)0 774 y(code)30 b(optimizers,)i(and)e -(compilers)g(to)g(sophisticated)f(r)o(un-time)i(analysis)g(tools)e(and) -i(extensions)d(to)i(the)0 887 y(Java)24 b(language)f([AFM97,)g(MBL97].) -146 1020 y(Compilers)33 b(like)g(the)f(Barat)h(compiler)g([BS98])g(use) -f Fe(BCEL)j Ft(to)d(implement)h(a)g(byte)f(code)g(generating)0 -1133 y(back)22 b(end.)27 b(Other)21 b(possible)g(application)i(ar)n -(eas)f(ar)n(e)f(the)g(static)h(analysis)g(of)g(byte)e(code)h([TK98)q(]) -h(or)f(examin-)0 1246 y(ing)e(the)f(r)o(un-time)i(behavior)f(of)g -(classes)g(by)g(inserting)f(calls)i(to)f(pr)n(o\002ling)g(methods)e -(into)i(the)f(code.)26 b(Further)0 1359 y(examples)h(ar)n(e)h -(extending)e(Java)k(with)e(Eif)n(fel-like)h(assertions)d([FM98],)k -(automated)d(delegation)f([Cos98)q(],)0 1472 y(or)c(with)h(the)f -(concepts)f(of)i(\223Aspect-Oriented)e(Pr)n(ogramming\224)i([KLM)2542 -1439 y Fb(+)2601 1472 y Ft(97)q(].)0 1882 y Fm(4.1)119 -b(Class)30 b(loaders)0 2099 y Ft(Class)d(loaders)f(ar)n(e)h(r)n -(esponsible)f(for)h(loading)g(class)g(\002les)f(fr)n(om)i(the)e(\002le) -h(system)e(or)h(other)g(r)n(esour)n(ces)f(and)0 2212 -y(passing)k(the)g(byte)h(code)f(to)g(the)g(V)-5 b(irtual)31 -b(Machine)g([LB98].)50 b(A)30 b(custom)g Ff(ClassLoader)25 -b Ft(object)30 b(may)g(be)0 2325 y(used)h(to)h(inter)n(cept)g(the)g -(standar)n(d)g(pr)n(ocedur)n(e)f(of)i(loading)f(a)i(class,)h(i.e.)58 -b(the)31 b(system)g(class)i(loader)-7 b(,)35 b(and)0 -2438 y(perform)22 b(some)g(transformations)g(befor)n(e)g(actually)i -(passing)e(the)f(byte)h(code)g(to)g(the)g(JVM.)146 2571 -y(A)28 b(possible)f(scenario)h(is)g(described)f(in)h(\002gur)n(e)g(7:) -39 b(During)28 b(r)o(un-time)g(the)f(V)-5 b(irtual)28 -b(Machine)h(r)n(equests)0 2683 y(a)d(custom)g(class)g(loader)g(to)f -(load)h(a)g(given)g(class.)38 b(But)25 b(befor)n(e)h(the)f(JVM)h -(actually)h(sees)d(the)h(byte)g(code,)h(the)0 2796 y(class)h(loader)f -(makes)f(a)i(\223side-step\224)e(and)h(performs)f(some)g -(transformation)h(to)g(the)f(class.)39 b(T)-8 b(o)26 -b(make)g(sur)n(e)0 2909 y(that)21 b(the)f(modi\002ed)g(byte)g(code)g -(is)i(still)f(valid)i(and)e(does)e(not)h(violate)i(any)f(of)g(the)f -(JVM's)h(r)o(ules)g(it)g(is)g(checked)0 3022 y(by)i(the)e(veri\002er)i -(befor)n(e)f(the)g(JVM)h(\002nally)g(executes)e(it.)0 -4050 y @beginspecial 0 @llx 0 @lly 683 @urx 144 @ury -4590 @rwi @setspecial -%%BeginDocument: eps/classloader.eps -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: classloader.eps -%%Creator: fig2dev Version 3.2 Patchlevel 0-beta3 -%%CreationDate: Thu Mar 18 16:45:56 1999 -%%For: dahm@gromit (Markus Dahm) -%%Orientation: Portrait -%%BoundingBox: 0 0 683 144 -%%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 def - -end -save --55.0 171.0 translate -1 -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 -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n -1000 3712 m -1000 -1000 l 12712 -1000 l 12712 3712 l cp clip - 0.06299 0.06299 sc -% Polyline -7.500 slw -n 1005 450 m 900 450 900 1020 105 arcto 4 {pop} repeat - 900 1125 3045 1125 105 arcto 4 {pop} repeat - 3150 1125 3150 555 105 arcto 4 {pop} repeat - 3150 450 1005 450 105 arcto 4 {pop} repeat - cp gs col0 s gr -/Helvetica ff 210.00 scf sf -1350 900 m -gs 1 -1 sc (Java class file) col0 sh gr -% Polyline -n 3600 450 m 5850 450 l 5850 1125 l 3600 1125 l cp gs col0 s gr -/Helvetica ff 210.00 scf sf -4140 855 m -gs 1 -1 sc (Class loader) col0 sh gr -% Polyline -n 6750 450 m 9000 450 l 9000 1125 l 6750 1125 l cp gs col0 s gr -/Helvetica ff 210.00 scf sf -7020 855 m -gs 1 -1 sc (Byte code verifier) col0 sh gr -% Polyline -n 9450 450 m 11700 450 l 11700 1125 l 9450 1125 l cp gs col0 s gr -/Helvetica ff 210.00 scf sf -9900 900 m -gs 1 -1 sc (Interpreter/JIT) col0 sh gr -% Polyline -n 4950 1575 m 7875 1575 l 7875 2700 l 4950 2700 l cp gs col0 s gr -/Helvetica ff 210.00 scf sf -5175 2475 m -gs 1 -1 sc (Byte code transformations) col0 sh gr -/Courier-Bold ff 210.00 scf sf -5850 2025 m -gs 1 -1 sc (JavaClass) col0 sh gr -% Polyline -gs clippath -3453 735 m 3573 765 l 3453 795 l 3615 795 l 3615 735 l cp -clip -n 3150 765 m 3600 765 l gs col0 s gr gr - -% arrowhead -n 3453 735 m 3573 765 l 3453 795 l 3453 765 l 3453 735 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -9303 735 m 9423 765 l 9303 795 l 9465 795 l 9465 735 l cp -clip -n 9000 765 m 9450 765 l gs col0 s gr gr - -% arrowhead -n 9303 735 m 9423 765 l 9303 795 l 9303 765 l 9303 735 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6105 1428 m 6075 1548 l 6045 1428 l 6045 1590 l 6105 1590 l cp -clip -n 5850 765 m 6075 765 l 6075 1575 l gs col0 s gr gr - -% arrowhead -n 6105 1428 m 6075 1548 l 6045 1428 l 6075 1428 l 6105 1428 l cp gs 0.00 setgray ef gr col0 s -% Polyline -gs clippath -6603 735 m 6723 765 l 6603 795 l 6765 795 l 6765 735 l cp -clip -n 6525 1575 m 6525 765 l 6750 765 l gs col0 s gr gr - -% arrowhead -n 6603 735 m 6723 765 l 6603 795 l 6603 765 l 6603 735 l cp gs 0.00 setgray ef gr col0 s -$F2psEnd -rs - -%%EndDocument - @endspecial 1414 4253 a Fq(Figur)n(e)26 b(7:)k(Class)25 -b(loaders)146 4672 y Ft(Using)i(class)h(loaders)f(is)g(an)h(elegant)f -(way)g(of)h(extending)d(the)i(Java)i(V)-5 b(irtual)28 -b(Machine)g(with)g(new)e(fea-)0 4785 y(tur)n(es)20 b(without)g -(actually)i(modifying)f(it.)27 b(This)21 b(concept)f(enables)h -(developers)e(to)h(use)g Fs(load-time)j(r)n(e\003ection)g -Ft(to)0 4898 y(implement)28 b(their)f(ideas)h(as)g(opposed)d(to)j(the)f -(static)h(r)n(e\003ection)g(supported)d(by)j(the)f(Java)j(Re\003ection) -d(API)0 5011 y([Jav98)r(].)45 b(Load-time)28 b(transformations)g -(supply)f(the)g(user)g(with)h(a)h(new)f(level)h(of)f(abstraction.)45 -b(He)27 b(is)i(not)0 5124 y(strictly)24 b(tied)f(to)h(the)f(static)h -(constraints)f(of)h(the)g(original)h(authors)e(of)h(the)f(classes)h -(but)g(may)g(customize)g(the)0 5237 y(applications)i(with)f(thir)n -(d-party)g(code)g(in)g(or)n(der)g(to)f(bene\002t)h(fr)n(om)h(new)e -(featur)n(es.)36 b(Such)25 b(transformations)0 5350 y(may)j(be)g -(executed)d(on)j(demand)f(and)h(neither)e(interfer)n(e)h(with)h(other)e -(users,)h(nor)h(alter)f(the)g(original)i(byte)0 5463 -y(code.)e(In)22 b(fact,)h(class)h(loaders)d(may)i(even)f(cr)n(eate)h -(classes)f Fs(ad)i(hoc)f Ft(without)f(loading)h(a)g(\002le)g(at)f(all.) -1863 5712 y Fq(21)p eop -%%Page: 22 22 -22 21 bop 0 407 a Fg(4.1.1)99 b(Example:)30 b(Poor)25 -b(Man')-5 b(s)24 b(Genericity)0 587 y Ft(The)17 b(\223Poor)g(Man's)h -(Genericity\224)g(pr)n(oject)f([BD98)r(])h(that)f(extends)f(Java)j -(with)f(parameterized)f(classes,)h(for)f(ex-)0 700 y(ample,)j(uses)e -Fe(BCEL)i Ft(in)f(two)g(places)g(to)g(generate)e(instances)i(of)g -(parameterized)f(classes:)26 b(During)19 b(compile-)0 -813 y(time)36 b(\(the)f(standar)n(d)g Ff(javac)f Ft(with)i(some)f -(slightly)g(changed)g(classes\))h(and)g(at)g(r)o(un-time)f(using)h(a)g -(cus-)0 926 y(tom)28 b(class)g(loader)-7 b(.)43 b(The)28 -b(compiler)g(puts)f(some)g(additional)h(type)e(information)j(into)f -(class)g(\002les)g(which)g(is)0 1039 y(evaluated)e(at)h(load-time)f(by) -g(the)g(class)h(loader)-7 b(.)38 b(The)26 b(class)h(loader)e(performs)h -(some)f(transformations)g(on)0 1152 y(the)i(loaded)g(class)i(and)e -(passes)g(them)g(to)g(the)g(VM.)h(The)f(following)h(algorithm)g -(illustrates)g(how)f(the)g(load)0 1264 y(method)21 b(of)i(the)f(class)h -(loader)f(ful\002lls)i(the)e(r)n(equest)f(for)h(a)h(parameterized)f -(class,)h(e.g.)k Ff(Stack<String>)127 1487 y Ft(1.)49 -b(Sear)n(ch)19 b(for)g(class)g Ff(Stack)p Ft(,)f(load)h(it,)g(and)g -(check)g(for)g(a)g(certain)g(class)h(attribute)e(containing)h -(additional)244 1600 y(type)i(information.)28 b(I.e.)f(the)22 -b(attribute)g(de\002nes)f(the)h(\223r)n(eal\224)i(name)f(of)g(the)e -(class,)i(i.e.)28 b Ff(Stack<A>)p Ft(.)127 1794 y(2.)49 -b(Replace)28 b(all)h(occurr)n(ences)e(and)h(r)n(efer)n(ences)f(to)g -(the)g(formal)i(type)d Ff(A)i Ft(with)g(r)n(efer)n(ences)f(to)g(the)g -(actual)244 1907 y(type)21 b Ff(String)p Ft(.)k(For)d(example)g(the)g -(method)353 2168 y Ff(void)53 b(push\(A)f(obj\))g({)i(...)g(})244 -2429 y Ft(becomes)353 2690 y Ff(void)f(push\(String)c(obj\))k({)h(...)f -(})127 2952 y Ft(3.)c(Return)21 b(the)h(r)n(esulting)g(class)h(to)f -(the)g(V)-5 b(irtual)23 b(Machine.)0 3293 y Fr(References)0 -3508 y Ft([AFM97])109 b(O.)29 b(Agesen,)f(S.)h(N.)f(Fr)n(eund,)h(and)g -(J.)h(C.)f(Mitchell.)54 b(Adding)27 b(T)-8 b(ype)28 b(Parameterization) -i(to)e(the)467 3621 y(Java)c(Language.)31 b(In)23 b Fs(Pr)n(oceedings)i -(OOPSLA)-5 b('97)p Ft(,)21 b(Atlanta,)i(GA,)f(1997.)0 -3815 y([AP98])191 b(D.)24 b(Antonioli)f(and)h(M.)g(Pilz.)37 -b(Statistische)23 b(Analyse)g(von)h(Java-Class\002les.)38 -b(In)23 b(Clemens)h(Cap,)467 3928 y(editor)-7 b(,)21 -b Fs(Pr)n(oceedings)k(JIT'98)p Ft(.)f(Springer)-7 b(,)22 -b(1998.)0 4122 y([BD98])191 b(B.)21 b(Bokowski)f(and)i(M.)f(Dahm.)32 -b(Poor)21 b(Man's)h(Genericity)g(for)f(Java.)33 b(In)21 -b(Clemens)h(Cap,)g(editor)-7 b(,)467 4235 y Fs(Pr)n(oceedings)25 -b(JIT'98)p Ft(.)f(Springer)-7 b(,)21 b(1998.)0 4429 y([BS98])213 -b(B.)28 b(Bokowski)f(and)i(A.)f(Spiegel.)51 b(Barat)29 -b(\226)h(A)e(Fr)n(ont-End)f(for)i(Java.)54 b(T)-8 b(echnical)30 -b(r)n(eport,)f(Fr)n(eie)467 4542 y(Universit)8 b(\250)-38 -b(at)22 b(Berlin,)g(1998.)0 4736 y([CCK98])123 b(Geof)n(f)24 -b(Cohen,)f(Jef)n(f)h(Chase,)g(and)f(David)i(Kaminsky)-10 -b(.)35 b(Automatic)24 b(Pr)n(ogram)f(T)-8 b(ransformation)467 -4849 y(with)22 b(JOIE.)33 b(In)22 b Fs(Pr)n(oceedings)j(USENIX)c -(Annual)h(T)-10 b(echnical)23 b(Symposium)p Ft(,)g(1998.)0 -5043 y([CCZ97])128 b(Suzanne)34 b(Collin,)39 b(Dominique)d(Colnet,)h -(and)e(Olivier)h(Zendra.)70 b(T)-8 b(ype)33 b(Infer)n(ence)h(for)h -(Late)467 5156 y(Binding.)22 b(The)g(SmallEif)n(fel)j(Compiler.)32 -b(In)23 b Fs(Pr)n(oceedings)i(JMLC'97)p Ft(,)e(1997.)0 -5350 y([Cos98])164 b(Pascal)42 b(Costanza.)90 b Fs(The)41 -b(ClassFilters)i(package)p Ft(.)91 b(Universit)8 b(\250)-38 -b(at)41 b(Bonn,)i Ff(http://www.cs.)467 5463 y(uni-)t(bonn.de/\230co)o -(st)o(an)o(za)o(/Cl)o(as)o(sF)o(il)o(te)o(rs/)o Ft(,)17 -b(1998.)1863 5712 y Fq(22)p eop -%%Page: 23 23 -23 22 bop 0 407 a Ft([FM98])180 b(C.)29 b(Fischer)f(and)g(D.)h -(Meemken.)50 b(JaW)-8 b(a:)41 b(Java)30 b(with)f(Assertions.)49 -b(In)28 b(Clemens)h(Cap,)h(editor)-7 b(,)467 520 y Fs(Pr)n(oceedings)25 -b(JIT'98)p Ft(.)f(Springer)-7 b(,)21 b(1998.)0 707 y([GHJV95])76 -b(E.)17 b(Gamma,)k(R.)d(Helm,)h(R.)f(Johnson,)g(and)g(J.)g(Vlissides.)k -Fs(Design)d(Patterns:)27 b(Elements)19 b(of)g(Reusable)467 -820 y(Object-Oriented)25 b(Softwar)n(e)p Ft(.)34 b(Addison-W)-8 -b(esley)e(,)19 b(1995.)0 1008 y([GJS96])170 b(J.)32 b(Gosling,)j(B.)d -(Joy)-10 b(,)34 b(and)f(G.)f(Steele.)63 b Fs(The)33 b(Java)h(Language)f -(Speci\002cation)p Ft(.)66 b(Addison-W)-8 b(esley)e(,)467 -1121 y(1996.)0 1308 y([Jav98])191 b(JavaSoft.)71 b Fs(Re\003ection)35 -b(API)p Ft(.)70 b Ff(http://java.sun)o(.c)o(om)o(/pr)o(od)o(uc)o(ts)o -(/j)o(dk/)o(1.)o(1/)o(do)o(cs)o(/)467 1421 y(guide/reflecti)o(on/)o -Ft(,)17 b(1998.)0 1609 y([KH98])175 b(Ralph)33 b(Keller)f(and)h(Urs)f -(H)10 b(\250)-40 b(olzle.)65 b(Binary)32 b(Component)g(Adaptation.)63 -b(In)33 b(Eric)g(Jul,)i(editor)-7 b(,)467 1722 y Fs(Pr)n(oceedings)25 -b(ECOOP'98)p Ft(.)d(Springer)-7 b(,)21 b(1998.)0 1910 -y([KLM)238 1877 y Fb(+)297 1910 y Ft(97])50 b(Gr)n(egor)27 -b(Kiczales,)i(John)e(Lamping,)h(Anurag)f(Mendhekar)-7 -b(,)27 b(Chris)h(Maeda,)g(Cristina)g(Lopes,)467 2022 -y(Jean-Mar)n(c)f(Loingtier)-7 b(,)26 b(and)g(John)g(Irwin.)43 -b(Aspect-Oriented)24 b(Pr)n(ogramming.)43 b(T)-8 b(echnical)27 -b(r)n(e-)467 2135 y(port,)21 b(Xer)n(ox)h(Palo)h(Alto)f(Resear)n(ch)g -(Center)-7 b(,)22 b(1997.)0 2323 y([LB98])205 b(Sheng)23 -b(Lian)i(and)g(Gilad)h(Bracha.)39 b(Dynamic)26 b(Class)g(Loading)d(in)i -(the)f(Java)j(V)-5 b(irtual)25 b(Machine.)467 2436 y(In)d -Fs(Pr)n(oceedings)j(OOPSLA)-5 b('98)p Ft(,)22 b(1998.)0 -2623 y([L)-8 b(Y97])208 b(T)-5 b(im)35 b(Lindholm)f(and)g(Frank)g(Y)-8 -b(ellin.)69 b Fs(The)35 b(Java)h(V)-7 b(irtual)35 b(Machine)g -(Speci\002cation)p Ft(.)71 b(Addison-)467 2736 y(W)-8 -b(esley)e(,)20 b(1997.)0 2924 y([LZ98])200 b(Han)25 b(Bok)f(Lee)f(and)i -(Benjamin)h(G.)f(Zorn.)38 b(BIT)-5 b(:)24 b(A)h(T)-8 -b(ool)24 b(for)h(Instr)o(umenting)e(Java)j(Bytecodes.)467 -3037 y(In)c Fs(Pr)n(oceedings)j(USENIX)c(Symposium)j(on)e(Internet)i(T) --10 b(echnologies)25 b(and)e(Systems)p Ft(,)h(1998.)0 -3225 y([MBL97])119 b(A.C.)24 b(Myers,)g(J.)h(A.)g(Bank,)f(and)h(B.)f -(Liskov)-10 b(.)39 b(Parameterized)24 b(T)-8 b(ypes)23 -b(for)i(Java.)41 b(In)25 b Fs(Pr)n(oceedings)467 3337 -y(POPL)m('97)p Ft(,)c(Paris,)i(France,)f(1997.)0 3525 -y([MD97])161 b(J.)23 b(Meyer)e(and)h(T)-7 b(.)23 b(Downing.)32 -b Fs(Java)24 b(V)-7 b(irtual)24 b(Machine)p Ft(.)33 b(O'Reilly)-10 -b(,)23 b(1997.)0 3713 y([Sil98])217 b(Shawn)28 b(Silverman.)51 -b Fs(The)28 b(class\002le)i(API)p Ft(.)50 b(University)27 -b(of)h(Manitoba,)i Ff(http://Meurrens)o(.)467 3826 y(ML.org/ip-)t -(Links)o(/j)o(av)o(a/)o(cod)o(eE)o(ng)o(in)o(ee)o(rin)o(g/)o(vi)o(ew)o -(er)o(s.h)o(tm)o(l)p Ft(,)16 b(1998.)0 4013 y([T)-8 b(af96])194 -b(T)-8 b(ucker)23 b(T)-8 b(aft.)37 b(Pr)n(ogramming)25 -b(the)e(Internet)f(in)j(Ada95.)38 b(In)24 b Fs(Pr)n(oceedings)j -(Ada-Eur)n(ope)f(Interna-)467 4126 y(tional)e(Confer)n(ence)g(on)e -(Reliable)j(Softwar)n(e)f(T)-10 b(echnologies)p Ft(,)25 -b(1996.)0 4314 y([TK98])195 b(M.)35 b(Thies)f(and)h(U.)f(Kastens.)71 -b(Statische)34 b(Analyse)g(von)h(Bibliotheken)f(als)i(Gr)o(undlage)f -(dy-)467 4427 y(namischer)23 b(Optimier)o(ung.)32 b(In)23 -b(Clemens)f(Cap,)h(editor)-7 b(,)21 b Fs(Pr)n(oceedings)26 -b(JIT'98)p Ft(.)d(Springer)-7 b(,)22 b(1998.)0 4614 y([Y)-8 -b(ou98])159 b(Matt)42 b(T)-7 b(.)42 b(Y)-8 b(ourst.)92 -b Fs(Inside)44 b(Java)f(Class)g(Files)p Ft(.)96 b(Laserstars)40 -b(T)-8 b(echnologies,)45 b Ff(http://www.)467 4727 y(laserstars.com)o -(/ar)o(ti)o(cl)o(es)o(/d)o(dj/)o(in)o(si)o(de)o(jc)o(f/)p -Ft(,)16 b(1998.)1863 5712 y Fq(23)p eop -%%Page: 24 24 -24 23 bop 0 410 a Fr(A)143 b(Code)35 b(examples)e(for)i(the)g(ClassGen) -f(API)0 658 y Fm(A.1)119 b(HelloW)-9 b(orldBuilder)i(.java)0 -835 y Ft(The)18 b(following)h(Java)i(pr)n(ogram)e(r)n(eads)f(a)i(name)f -(fr)n(om)g(the)g(standar)n(d)f(input)g(and)h(prints)f(a)i(friendly)f -(\223Hello\224.)0 948 y(Since)31 b(the)f Ff(readLine\(\))d -Ft(method)j(may)h(thr)n(ow)g(an)g Ff(IOException)26 b -Ft(it)32 b(is)f(enclosed)e(by)i(a)h Ff(try-catch)0 1060 -y Ft(block.)0 1268 y Ff(import)52 b(java.io.*;)0 1494 -y(public)g(class)g(HelloWorld)e({)109 1607 y(public)i(static)g(void)g -(main\(String[])d(argv\))j({)218 1720 y(BufferedReader)c(in)54 -b(=)g(new)f(BufferedReader\()o(new)1418 1833 y(InputStreamRead)o(er)o -(\(Sy)o(st)o(em)o(.i)o(n\))o(\);)218 1946 y(String)f(name)h(=)h(null;) -218 2172 y(try)f({)327 2284 y(System.out.prin)o(t\(")o(Pl)o(ea)o(se)48 -b(enter)k(your)h(name>)f("\);)327 2397 y(name)h(=)h(in.readLine\(\);) -218 2510 y(})g(catch\(IOExcepti)o(on)48 b(e\))54 b({)g(return;)d(})218 -2736 y(System.out.prin)o(tl)o(n\(")o(He)o(ll)o(o,)d(")54 -b(+)g(name\);)109 2849 y(})0 2962 y(})0 3343 y Fm(A.2)119 -b(HelloW)-9 b(orldBuilder)i(.java)0 3520 y Ft(W)f(e)28 -b(will)i(sketch)e(her)n(e)g(how)g(the)g(above)h(Java)i(class)e(can)h -(be)f(cr)n(eated)f(fr)n(om)h(the)f(scratch)h(using)g(the)f -Fe(BCEL)0 3633 y Ft(API.)h(For)g(ease)g(of)h(r)n(eading)g(we)f(will)i -(use)e(textual)g(signatur)n(es)g(and)h(not)f(cr)n(eate)h(them)f -(dynamically)-10 b(.)51 b(For)0 3746 y(example,)22 b(the)g(signatur)n -(e)109 3954 y Ff("\(Ljava/lang/St)o(ri)o(ng)o(;\)L)o(ja)o(va)o(/l)o(an) -o(g/S)o(tr)o(in)o(gB)o(uf)o(fer)o(;")146 4161 y Ft(would)g(actually)i -(be)f(cr)n(eated)f(with)109 4369 y Ff(Type.getMethodS)o(ig)o(na)o(tur)o -(e\()o(Ty)o(pe)o(.S)o(TRI)o(NG)o(BU)o(FF)o(ER)o(,)49 -b(new)k(Type[])f({)i(Type.STRING)49 b(}\);)0 4627 y Fg(A.2.1)99 -b(Initialization:)0 4803 y Ft(First)22 b(we)g(cr)n(eate)g(an)i(empty)d -(class)i(and)g(an)g(instr)o(uction)f(list:)109 5011 y -Ff(ClassGen)106 b(cg)53 b(=)h(new)f(ClassGen\("HelloW)o(or)o(ld)o(",)48 -b("java.lang.Obje)o(ct)o(",)1636 5124 y("<generated>",)h(ACC_PUBLIC)h -(|)k(ACC_SUPER,)1636 5237 y(null\);)109 5350 y(ConstantPoolGen)48 -b(cp)53 b(=)i(cg.getConstant)o(Po)o(ol)o(\(\))o(;)49 -b(//)k(cg)h(creates)d(constant)g(pool)109 5463 y(InstructionList)d(il) -53 b(=)i(new)e(InstructionLis)o(t\()o(\);)p eop -%%Page: 25 25 -25 24 bop 146 407 a Ft(W)-8 b(e)26 b(then)f(cr)n(eate)i(the)e(main)j -(method,)d(supplying)g(the)h(method's)f(name)h(and)h(the)e(symbolic)i -(type)e(sig-)0 520 y(natur)n(e)d(encoded)f(with)i Ff(Type)e -Ft(objects.)109 705 y Ff(MethodGen)105 b(mg)54 b(=)g(new)f -(MethodGen\(ACC_S)o(TA)o(TI)o(C)48 b(|)55 b(ACC_PUBLIC,//)48 -b(access)k(flags)1745 818 y(Type.VOID,)760 b(//)53 b(return)f(type)1745 -931 y(new)i(Type[])d({)655 b(//)53 b(argument)e(types)1855 -1044 y(new)i(ArrayType\(Type)o(.S)o(TRI)o(NG)o(,)48 b(1\))54 -b(},)1745 1156 y(new)g(String[])d({)j("argv")d(},)j(//)g(arg)f(names) -1745 1269 y("main",)f("HelloWorld",)212 b(//)54 b(method,)d(class)1745 -1382 y(il,)j(cp\);)109 1495 y(InstructionFact)o(or)o(y)48 -b(factory)k(=)i(new)f(InstructionFact)o(or)o(y\()o(cg\))o(;)146 -1680 y Ft(W)-8 b(e)22 b(de\002ne)f(some)h(often)g(use)f(types:)109 -1865 y Ff(ObjectType)50 b(i_stream)h(=)j(new)f(ObjectType\("jav)o(a.i)o -(o.)o(In)o(pu)o(tS)o(tre)o(am)o("\))o(;)109 1978 y(ObjectType)d -(p_stream)h(=)j(new)f(ObjectType\("jav)o(a.i)o(o.)o(Pr)o(in)o(tS)o(tre) -o(am)o("\))o(;)0 2233 y Fg(A.2.2)99 b(Create)24 b(variables)h -Fa(in)f Fg(and)h Fa(name)p Fg(:)0 2410 y Ft(W)-8 b(e)16 -b(call)j(the)e(constr)o(uctors,)f(i.e.)26 b(execute)15 -b Ff(BufferedReader\(I)o(np)o(ut)o(St)o(rea)o(mR)o(ea)o(de)o(r\()o(Sys) -o(te)o(m.)o(in)o(\)\))o Ft(.)0 2522 y(The)j(r)n(efer)n(ence)h(to)g(the) -f Ff(BufferedReader)13 b Ft(object)19 b(stays)f(on)h(top)f(of)h(the)g -(stack)g(and)g(is)g(stor)n(ed)f(in)h(the)g(newly)0 2635 -y(allocated)k Ff(in)f Ft(variable.)109 2820 y Ff(il.append\(facto)o(ry) -o(.c)o(rea)o(te)o(Ne)o(w\()o("j)o(ava)o(.i)o(o.)o(Bu)o(ff)o(ere)o(dR)o -(ea)o(de)o(r")o(\)\);)109 2933 y(il.append\(Instr)o(uc)o(ti)o(onC)o(on) -o(st)o(an)o(ts)o(.DU)o(P\))o(;)48 b(//)54 b(Use)f(predefined)d -(constant)109 3046 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(Ne)o(w\()o -("j)o(ava)o(.i)o(o.)o(In)o(pu)o(tSt)o(re)o(am)o(Re)o(ad)o(er")o(\)\))o -(;)109 3159 y(il.append\(Instr)o(uc)o(ti)o(onC)o(on)o(st)o(an)o(ts)o -(.DU)o(P\))o(;)109 3272 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(Fi)o -(el)o(dA)o(cce)o(ss)o(\(")o(ja)o(va)o(.la)o(ng)o(.S)o(ys)o(te)o(m",)e -("in",)k(i_stream,)2073 3385 y(Constants.GETS)o(TA)o(TIC)o(\)\))o(;)109 -3498 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o(ke)o(\("j)o -(av)o(a.)o(io)o(.I)o(npu)o(tS)o(tr)o(ea)o(mR)o(ead)o(er)o(",)c -("<init>",)1800 3611 y(Type.VOID,)i(new)j(Type[])f({)i(i_stream)d(},) -1800 3724 y(Constants.INVOK)o(ES)o(PE)o(CI)o(AL\))o(\);)109 -3837 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o(ke)o(\("j)o -(av)o(a.)o(io)o(.B)o(uff)o(er)o(ed)o(Re)o(ad)o(er")o(,)d("<init>",)j -(Type.VOID,)1800 3950 y(new)i(Type[])f({new)h(ObjectType\("ja)o(va)o -(.io)o(.R)o(ea)o(de)o(r")o(\)},)1800 4062 y(Constants.INVOK)o(ES)o(PE)o -(CI)o(AL\))o(\);)109 4288 y(LocalVariableGe)o(n)48 b(lg)54 -b(=)218 4401 y(mg.addLocalVari)o(ab)o(le\()o("i)o(n")o(,)1309 -4514 y(new)f(ObjectType\("jav)o(a.i)o(o.)o(Bu)o(ff)o(er)o(edR)o(ea)o -(de)o(r")o(\),)48 b(null,)k(null\);)109 4627 y(int)h(in)h(=)g -(lg.getIndex\(\);)109 4740 y(lg.setStart\(il.)o(ap)o(pe)o(nd\()o(ne)o -(w)48 b(ASTORE\(in\)\)\);)h(//)54 b(`i')f(valid)f(from)h(here)146 -4925 y Ft(Cr)n(eate)23 b(local)h(variable)h Ff(name)c -Ft(and)h(initialize)j(it)e(to)f Ff(null)p Ft(.)109 5110 -y Ff(lg)54 b(=)g(mg.addLocalVar)o(iab)o(le)o(\(")o(na)o(me)o(",)48 -b(Type.STRING,)h(null,)j(null\);)109 5223 y(int)h(name)g(=)h -(lg.getIndex\(\);)109 5336 y(il.append\(Instr)o(uc)o(ti)o(onC)o(on)o -(st)o(an)o(ts)o(.AC)o(ON)o(ST)o(_N)o(UL)o(L\);)109 5449 -y(lg.setStart\(il.)o(ap)o(pe)o(nd\()o(ne)o(w)48 b(ASTORE\(name\)\)\);)g -(//)54 b(`name')d(valid)i(from)f(here)p eop -%%Page: 26 26 -26 25 bop 0 407 a Fg(A.2.3)99 b(Create)24 b(try-catch)i(block)0 -584 y Ft(W)-8 b(e)31 b(r)n(emember)g(the)g(start)g(of)h(the)f(block,)j -(r)n(ead)e(a)g(line)g(fr)n(om)h(the)e(standar)n(d)g(input)g(and)h(stor) -n(e)e(it)i(into)g(the)0 697 y(variable)25 b Ff(name)p -Ft(.)109 913 y Ff(InstructionHand)o(le)48 b(try_start)i(=)218 -1026 y(il.append\(facto)o(ry)o(.cr)o(ea)o(te)o(Fi)o(el)o(dAc)o(ce)o(ss) -o(\(")o(ja)o(va.)o(la)o(ng)o(.S)o(ys)o(tem)o(",)e("out",)k(p_stream,) -2182 1139 y(Constants.GETS)o(TAT)o(IC)o(\)\))o(;)109 -1365 y(il.append\(new)d(PUSH\(cp,)i("Please)g(enter)h(your)h(name>)f -("\)\);)109 1478 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o -(ke)o(\("j)o(av)o(a.)o(io)o(.P)o(rin)o(tS)o(tr)o(ea)o(m")o(,)d -("print",)h(Type.VOID,)1800 1591 y(new)j(Type[])f({)i(Type.STRING)c(},) -1800 1704 y(Constants.INVOK)o(EV)o(IR)o(TU)o(AL\))o(\);)109 -1817 y(il.append\(new)f(ALOAD\(in\)\);)109 1930 y(il.append\(facto)o -(ry)o(.c)o(rea)o(te)o(In)o(vo)o(ke)o(\("j)o(av)o(a.)o(io)o(.B)o(uff)o -(er)o(ed)o(Re)o(ad)o(er")o(,)f("readLine",)1800 2042 -y(Type.STRING,)h(Type.NO_ARGS,)1800 2155 y(Constants.INVOK)o(EV)o(IR)o -(TU)o(AL\))o(\);)109 2268 y(il.append\(new)g(ASTORE\(name\)\);)146 -2485 y Ft(Upon)22 b(normal)h(execution)f(we)g(jump)g(behind)h -(exception)e(handler)-7 b(,)22 b(the)g(tar)n(get)g(addr)n(ess)f(is)h -(not)g(known)0 2598 y(yet.)109 2815 y Ff(GOTO)53 b(g)h(=)g(new)f -(GOTO\(null\);)109 2928 y(InstructionHand)o(le)48 b(try_end)j(=)j -(il.append\(g\);)146 3144 y Ft(W)-8 b(e)22 b(add)g(the)g(exception)g -(handler)g(which)h(simply)g(r)n(eturns)e(fr)n(om)i(the)f(method.)109 -3361 y Ff(InstructionHand)o(le)48 b(handler)j(=)j(il.append\(Instru)o -(ct)o(io)o(nC)o(on)o(sta)o(nt)o(s.)o(RE)o(TU)o(RN\))o(;)109 -3474 y(mg.addException)o(Ha)o(nd)o(ler)o(\(t)o(ry)o(_s)o(ta)o(rt,)48 -b(try_end,)j(handler,)f("java.io.IOExcep)o(ti)o(on)o("\))o(;)146 -3691 y Ft(\223Normal\224)24 b(code)e(continues,)f(now)h(we)g(can)i(set) -d(the)h(branch)i(tar)n(get)e(of)g(the)g(GOT)n(O.)109 -3908 y Ff(InstructionHand)o(le)48 b(ih)54 b(=)218 4020 -y(il.append\(facto)o(ry)o(.cr)o(ea)o(te)o(Fi)o(el)o(dAc)o(ce)o(ss)o -(\(")o(ja)o(va.)o(la)o(ng)o(.S)o(ys)o(tem)o(",)48 b("out",)k(p_stream,) -2182 4133 y(Constants.GETS)o(TAT)o(IC)o(\)\))o(;)109 -4246 y(g.setTarget\(ih\))o(;)0 4505 y Fg(A.2.4)99 b(Printing)25 -b(\224Hello\224)0 4682 y Ft(String)d(concatenation)h(compiles)f(to)g -Ff(StringBuffer)17 b Ft(operations.)109 4898 y Ff(il.append\(facto)o -(ry)o(.c)o(rea)o(te)o(Ne)o(w\()o(Ty)o(pe.)o(ST)o(RI)o(NG)o(BU)o(FFE)o -(R\))o(\);)109 5011 y(il.append\(Instr)o(uc)o(ti)o(onC)o(on)o(st)o(an)o -(ts)o(.DU)o(P\))o(;)109 5124 y(il.append\(new)49 b(PUSH\(cp,)i("Hello,) -g("\)\);)109 5237 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o -(ke)o(\("j)o(av)o(a.)o(la)o(ng)o(.St)o(ri)o(ng)o(Bu)o(ff)o(er")o(,)d -("<init>",)1800 5350 y(Type.VOID,)i(new)j(Type[])f({)i(Type.STRING)c -(},)1800 5463 y(Constants.INVOK)o(ES)o(PE)o(CI)o(AL\))o(\);)p -eop -%%Page: 27 27 -27 26 bop 109 407 a Ff(il.append\(new)49 b(ALOAD\(name\)\);)109 -520 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o(ke)o(\("j)o(av) -o(a.)o(la)o(ng)o(.St)o(ri)o(ng)o(Bu)o(ff)o(er")o(,)f("append",)1800 -633 y(Type.STRINGBUFF)o(ER)o(,)g(new)54 b(Type[])d({)j(Type.STRING)c -(},)1800 746 y(Constants.INVOK)o(EV)o(IR)o(TU)o(AL\))o(\);)109 -858 y(il.append\(facto)o(ry)o(.c)o(rea)o(te)o(In)o(vo)o(ke)o(\("j)o(av) -o(a.)o(la)o(ng)o(.St)o(ri)o(ng)o(Bu)o(ff)o(er")o(,)e("toString",)1800 -971 y(Type.STRING,)h(Type.NO_ARGS,)1800 1084 y(Constants.INVOK)o(EV)o -(IR)o(TU)o(AL\))o(\);)109 1310 y(il.append\(facto)o(ry)o(.c)o(rea)o(te) -o(In)o(vo)o(ke)o(\("j)o(av)o(a.)o(io)o(.P)o(rin)o(tS)o(tr)o(ea)o(m")o -(,)g("println",)1800 1423 y(Type.VOID,)h(new)j(Type[])f({)i -(Type.STRING)c(},)1800 1536 y(Constants.INVOK)o(EV)o(IR)o(TU)o(AL\))o -(\);)109 1649 y(il.append\(Instr)o(uc)o(ti)o(onC)o(on)o(st)o(an)o(ts)o -(.RE)o(TU)o(RN)o(\);)0 1908 y Fg(A.2.5)99 b(Finalization)0 -2085 y Ft(Finally)-10 b(,)26 b(we)e(have)i(to)e(set)g(the)g(stack)g -(size,)i(which)f(normally)h(would)e(be)h(computed)f(on)g(the)g(\003y)h -(and)g(add)g(a)0 2197 y(default)d(constr)o(uctor)g(method)f(to)h(the)g -(class,)h(which)g(is)g(empty)e(in)i(this)f(case.)109 -2418 y Ff(mg.setMaxStack\()o(5\))o(;)109 2531 y(cg.addMethod\(mg)o(.g)o -(et)o(Met)o(ho)o(d\()o(\)\))o(;)109 2644 y(il.dispose\(\);)49 -b(//)k(Allow)g(instruction)c(handles)j(to)h(be)h(reused)109 -2756 y(cg.addEmptyCons)o(tr)o(uc)o(tor)o(\(A)o(CC)o(_P)o(UB)o(LIC)o -(\);)146 2977 y Ft(Last)22 b(but)h(not)f(least)g(we)g(dump)g(the)g -Ff(JavaClass)c Ft(object)23 b(to)f(a)h(\002le.)109 3197 -y Ff(try)53 b({)218 3310 y(cg.getJavaClass)o(\(\))o(.du)o(mp)o(\(")o -(He)o(ll)o(oWo)o(rl)o(d.)o(cl)o(as)o(s"\))o(;)109 3423 -y(})h(catch\(java.io.I)o(OE)o(xce)o(pt)o(io)o(n)48 b(e\))54 -b({)g(System.err.prin)o(tl)o(n\()o(e\);)48 b(})0 3711 -y Fm(A.3)119 b(Peephole.java)0 3888 y Ft(This)20 b(class)h(implements)e -(a)i(simple)f(peephole)e(optimizer)j(that)f(r)n(emoves)f(any)h(NOP)h -(instr)o(uctions)e(fr)n(om)i(the)0 4001 y(given)i(class.)0 -4221 y Ff(import)52 b(java.io.*;)0 4334 y(import)g(de.fub.bytecod)o -(e.c)o(la)o(ss)o(fi)o(le)o(.*;)0 4447 y(import)g(de.fub.bytecod)o(e.g)o -(en)o(er)o(ic)o(.*)o(;)0 4560 y(import)g(de.fub.bytecod)o(e.R)o(ep)o -(os)o(it)o(or)o(y;)0 4785 y(public)g(class)g(Peephole)f({)109 -4898 y(public)h(static)g(void)g(main\(String[])d(argv\))j({)218 -5011 y(try)h({)327 5124 y(/*)h(Load)f(the)g(class)f(from)h(CLASSPATH.) -382 5237 y(*/)327 5350 y(JavaClass)378 b(clazz)161 b(=)54 -b(Repository.looku)o(pC)o(la)o(ss)o(\(ar)o(gv)o([0)o(]\))o(;)327 -5463 y(Method[])433 b(methods)51 b(=)j(clazz.getMethods)o(\(\))o(;)p -eop -%%Page: 28 28 -28 27 bop 327 407 a Ff(ConstantPoolGen)48 b(cp)326 b(=)54 -b(new)g(ConstantPoolGe)o(n\()o(cl)o(azz)o(.g)o(et)o(Co)o(ns)o(tan)o(tP) -o(oo)o(l\()o(\)\))o(;)327 633 y(for\(int)e(i=0;)g(i)i(<)h -(methods.length)o(;)48 b(i++\))53 b({)436 746 y(MethodGen)e(mg)381 -b(=)54 b(new)f(MethodGen\(metho)o(ds)o([i)o(],)2345 858 -y(clazz.getClassNa)o(me)o(\(\))o(,)48 b(cp\);)436 971 -y(Method)216 b(stripped)51 b(=)j(removeNOPs\(mg\))o(;)436 -1197 y(if\(stripped)c(!=)k(null\))270 b(//)54 b(Any)f(NOPs)g(stripped?) -545 1310 y(methods[i])d(=)55 b(stripped;)50 b(//)k(Overwrite)c(with)j -(stripped)e(method)327 1423 y(})327 1649 y(/*)j(Dump)f(the)g(class)f -(to)i(<class)e(name>_.class)382 1762 y(*/)327 1875 y(clazz.setConsta)o -(ntP)o(oo)o(l\()o(cp)o(.g)o(etF)o(in)o(al)o(Co)o(ns)o(tan)o(tP)o(oo)o -(l\()o(\)\))o(;)327 1988 y(clazz.dump\(claz)o(z.g)o(et)o(Cl)o(as)o(sN)o -(ame)o(\(\))c(+)54 b("_.class"\);)218 2100 y(})g(catch\(Exception)48 -b(e\))54 b({)g(e.printStackTr)o(ac)o(e\(\))o(;)48 b(})109 -2213 y(})109 2439 y(private)j(static)h(final)h(Method)e -(removeNOPs\(Metho)o(dG)o(en)d(mg\))53 b({)218 2552 y(InstructionList) -157 b(il)217 b(=)54 b(mg.getInstructio)o(nL)o(is)o(t\()o(\);)218 -2665 y(FindPattern)377 b(f)272 b(=)54 b(new)g(FindPattern\(il)o(\);)218 -2778 y(String)652 b(pat)162 b(=)54 b("\(`NOP'\)+";)c(//)k(Find)e(at)i -(least)e(one)h(NOP)218 2891 y(InstructionHand)o(le)48 -b(next)107 b(=)54 b(null;)218 3004 y(int)817 b(count)52 -b(=)i(0;)218 3230 y(for\(Instruction)o(Ha)o(ndl)o(e)48 -b(ih)54 b(=)g(f.search\(pat\);)48 b(//)54 b(Search)e(with)g(regular)g -(expression)436 3342 y(ih)i(!=)g(null;)436 3455 y(ih)g(=)g -(f.search\(pat,)49 b(next\)\))j({)327 3681 y(InstructionHand)o(le[)o(]) -c(match)k(=)j(f.getMatch\(\);)327 3794 y(InstructionHand)o(le)157 -b(first)52 b(=)j(match[0];)327 3907 y(InstructionHand)o(le)157 -b(last)107 b(=)55 b(match[match.le)o(ng)o(th)48 b(-)54 -b(1];)327 4133 y(/*)g(Some)f(nasty)f(Java)h(compilers)d(may)j(add)g -(NOP)h(at)f(end)g(of)h(method.)382 4246 y(*/)327 4359 -y(if\(\(next)d(=)j(last.getNext\(\)\))48 b(==)54 b(null\))436 -4472 y(break;)327 4697 y(count)f(+=)g(match.length;)327 -4923 y(/*)h(Delete)e(NOPs)g(and)i(redirect)d(any)i(references)d(to)j -(them)g(to)h(the)f(following)382 5036 y(*)h(\(non-nop\))c(instruction.) -382 5149 y(*/)327 5262 y(try)j({)436 5375 y(il.delete\(first,)48 -b(last\);)p eop -%%Page: 29 29 -29 28 bop 327 407 a Ff(})54 b(catch\(TargetLost)o(Ex)o(ce)o(pt)o(io)o -(n)49 b(e\))k({)436 520 y(InstructionHandl)o(e[)o(])48 -b(targets)k(=)i(e.getTargets\(\))o(;)436 633 y(for\(int)e(i=0;)g(i)j(<) -f(targets.length)o(;)48 b(i++\))53 b({)545 746 y(InstructionTarge)o(te) -o(r[)o(])48 b(targeters)j(=)j(targets[i].getT)o(ar)o(ge)o(te)o(rs\()o -(\);)545 971 y(for\(int)e(j=0;)h(j)h(<)g(targeters.leng)o(th)o(;)49 -b(j++\))655 1084 y(targeters[j].u)o(pd)o(at)o(eT)o(arg)o(et)o(\(t)o(ar) -o(ge)o(ts[)o(i])o(,)f(next\);)436 1197 y(})327 1310 y(})218 -1423 y(})218 1649 y(Method)k(m)i(=)g(null;)218 1875 y(if\(count)d(>)j -(0\))g({)327 1988 y(System.out.prin)o(tln)o(\(")o(Re)o(mo)o(ve)o(d)49 -b(")54 b(+)g(count)e(+)i(")g(NOP)f(instructions)c(from)k(method)f(")i -(+)1364 2100 y(mg.getName\(\)\);)327 2213 y(m)g(=)109 -b(mg.getMethod\(\);)218 2326 y(})218 2552 y(il.dispose\(\);)49 -b(//)k(Reuse)g(instruction)c(handles)218 2665 y(return)j(m;)109 -2778 y(})0 2891 y(})p eop -%%Page: 30 30 -30 29 bop 828 5113 a @beginspecial 13 @llx 12 @lly 383 -@urx 830 @ury 2602 @rwi @setspecial -%%BeginDocument: eps/constantpool.eps -%!PS-Adobe-3.0 EPSF-3.0 -%%Title: Rose Diagram(s) -%%Creator: AdobePS5.dll Version 5.0 -%%CreationDate: 7/7/1999 17:45:21 -%%Pages: 1 -%%Orientation: Portrait -%%PageOrder: Ascend -%%DocumentNeededResources: (atend) -%%DocumentSuppliedResources: (atend) -%%DocumentData: Clean7Bit -%%TargetDevice: (HP LaserJet 5Si) (2014.108) 1 -%%LanguageLevel: 2 -%%BoundingBox: 13 12 383 830 -%%EndComments -%%BeginProcSet: epsffit 1 0 -gsave -1677.488 -356.303 translate -90 rotate -2.035 2.035 scale -%%EndProcSet - - -%%BeginDefaults -%%PageBoundingBox: 13 12 582 830 -%%EndDefaults - -%%BeginProlog -%%BeginResource: file Pscript_WinNT_ErrorHandler 5.0 0 -/currentpacking where{pop/oldpack currentpacking def/setpacking where{pop false -setpacking}if}if/$brkpage 64 dict def $brkpage begin/prnt{dup type/stringtype -ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch -def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0 -rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def -/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def/=={/cp 0 def -typeprint nl}def/typeprint{dup type exec}readonly def/lmargin 72 def/rmargin 72 -def/tprint{dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp -exch def prnt}readonly def/cvsprint{=string cvs tprint( )tprint}readonly def -/integertype{cvsprint}readonly def/realtype{cvsprint}readonly def/booleantype -{cvsprint}readonly def/operatortype{(--)tprint =string cvs tprint(-- )tprint} -readonly def/marktype{pop(-mark- )tprint}readonly def/dicttype{pop -(-dictionary- )tprint}readonly def/nulltype{pop(-null- )tprint}readonly def -/filetype{pop(-filestream- )tprint}readonly def/savetype{pop(-savelevel- ) -tprint}readonly def/fonttype{pop(-fontid- )tprint}readonly def/nametype{dup -xcheck not{(/)tprint}if cvsprint}readonly def/stringtype{dup rcheck{(\()tprint -tprint(\))tprint}{pop(-string- )tprint}ifelse}readonly def/arraytype{dup rcheck -{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}forall(]) -tprint}ifelse}{pop(-array- )tprint}ifelse}readonly def/packedarraytype{dup -rcheck{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint} -forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse}readonly def/courier -/Courier findfont 10 scalefont def end errordict/handleerror{systemdict begin -$error begin $brkpage begin newerror{/newerror false store vmstatus pop pop 0 -ne{grestoreall}if showpage initgraphics courier setfont lmargin 720 moveto -(ERROR: )prnt errorname prnt nl(OFFENDING COMMAND: )prnt/command load prnt -$error/ostack known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==} -repeat}if systemdict/showpage get exec(%%[ Error: )print errorname =print -(; OffendingCommand: )print/command load =print( ]%%)= flush}if end end end}dup -0 systemdict put dup 4 $brkpage put bind readonly put/currentpacking where{pop -/setpacking where{pop oldpack setpacking}if}if -%%EndResource -userdict /Pscript_WinNT_Incr 230 dict dup begin put -%%BeginResource: file Pscript_FatalError 5.0 0 -/FatalErrorIf{{initgraphics findfont exch scalefont setfont counttomark 3 div -cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def -%%EndResource -/VM?{vmstatus exch sub exch pop gt{[ -(This job requires more memory than is available in this printer.)100 500 -(Try one or more of the following, and then print again:)100 485 -(For the output format, choose Optimize For Portability.)115 470 -(In the Device Settings page, make sure the Available PostScript Memory is accurate.) -115 455(Reduce the number of fonts in the document.)115 440 -(Print the document in parts.)115 425 12/Times-Roman showpage -(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def -%%BeginResource: file Pscript_Win_Basic 5.0 0 -/d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^ -/index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/- -/rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true , -d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C -/closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M -/rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , d -/Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/show , d/LH/showpage -, d/K/stroke , d/W/widthshow , d/R/rotate , d/P/eoclip , d/L2? false -/languagelevel where{pop languagelevel 2 ge{pop true}if}if d L2?{/xS/xshow , d -/yS/yshow , d/zS/xyshow , d}if/b{bind d}bind d/bd{bind d}bind d/xd{~ d}bd/ld{, -d}bd/lw/Lw ld/lc/Lc ld/lj/Lj ld/sg/setgray ld/ADO_mxRot null d/self & d/OrgMx -matrix currentmatrix d/reinitialize{: OrgMx setmatrix[/TextInit/GraphInit -/UtilsInit counttomark{@ where{self eq}{F}?{cvx exec}{!}?}repeat cleartomark ;} -b/initialize{`{/ADO_mxRot ~ d/TextInitialised? F d reinitialize E}{U -/Pscript_Win_Data 230 dict @ ` put/ADO_mxRot ~ d/TextInitialised? F d -reinitialize}?}b/terminate{!{& self eq{exit}{E}?}loop E}b/suspend/terminate , d -/resume{` Pscript_Win_Data `}b/snap{transform 0.25 sub round 0.25 add ~ 0.25 -sub round 0.25 add ~ itransform}b/dsnap{dtransform round ~ round ~ idtransform} -b<04>cvn{}d/rr{1 ^ 0 - 0 ~ - neg 0 - C}b/rp{4 2 $ M 1 ^ 0 - 0 ~ - neg 0 -}b -/solid{[]0 sd}b/g{@ not{U/DefIf_save save put}if U/DefIf_bool 2 ^ put}b -/DefIf_El{if U/DefIf_bool get not @{U/DefIf_save get restore}if}b/e{DefIf_El !} -b/UDF{L2?{undefinefont}{!}?}b/UDR{L2?{undefineresource}{! !}?}b -%%EndResource -%%BeginResource: file Pscript_Win_Utils_L2 5.0 0 -/rf/rectfill , d/fx{1 1 dtransform @ 0 ge{1 sub 0.5}{1 add -0.5}? 3 -1 $ @ 0 ge -{1 sub 0.5}{1 add -0.5}? 3 1 $ 4 1 $ idtransform 4 -2 $ idtransform}b/BZ{4 -2 $ -snap + +S fx rf}b/rs/rectstroke , d/rc/rectclip , d/UtilsInit{currentglobal{F -setglobal}if}b/scol{! setcolor}b/colspA/DeviceGray d/colspABC/DeviceRGB d -/colspRefresh{colspABC setcolorspace}b/SetColSpace{colspABC setcolorspace}b -%%EndResource -end -%%EndProlog - -%%BeginSetup -[ 1 0 0 1 0 0 ] false Pscript_WinNT_Incr dup /initialize get exec -1 setlinecap 1 setlinejoin -/mysetup [ 0.24 0 0 -0.24 13.43905 829.74047 ] def -%%EndSetup - -%%Page: 1 1 -%%PageBoundingBox: 13 12 582 830 -%%EndPageComments -%%BeginPageSetup -/DeviceRGB dup setcolorspace /colspABC exch def mysetup concat colspRefresh -%%EndPageSetup - -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Win_GdiObject 5.0 0 -/SavedCTM null d/CTMsave{/SavedCTM SavedCTM currentmatrix d}b/CTMrestore -{SavedCTM setmatrix}b/mp null d/ADO_mxRot null d/GDIHMatrix null d -/GDIHPatternDict 22 dict d GDIHPatternDict `/PatternType 1 d/PaintType 2 d/Reps -L2?{1}{5}? d/XStep 8 Reps mul d/YStep XStep d/BBox[0 0 XStep YStep]d/TilingType -1 d/PaintProc{` 1 Lw[]0 sd PaintData , exec E}b/FGnd null d/BGnd null d -/HS_Horizontal{horiz}b/HS_Vertical{vert}b/HS_FDiagonal{fdiag}b/HS_BDiagonal -{biag}b/HS_Cross{horiz vert}b/HS_DiagCross{fdiag biag}b/MaxXYStep XStep YStep -gt{XStep}{YStep}? d/horiz{Reps{0 4 M XStep 0 - 0 8 +}repeat 0 -8 Reps mul + K}b -/vert{Reps{4 0 M 0 YStep - 8 0 +}repeat 0 -8 Reps mul + K}b/biag{Reps{0 0 M -MaxXYStep @ - 0 YStep neg M MaxXYStep @ - 0 8 +}repeat 0 -8 Reps mul + 0 YStep -M 8 8 - K}b/fdiag{Reps{0 0 M MaxXYStep @ neg - 0 YStep M MaxXYStep @ neg - 0 8 -+}repeat 0 -8 Reps mul + MaxXYStep @ M 8 -8 - K}b E/makehatch{4 -2 $/yOrg ~ d -/xOrg ~ d GDIHPatternDict/PaintData 3 -1 $ put CTMsave GDIHMatrix setmatrix -GDIHPatternDict matrix xOrg yOrg + mp CTMrestore ~ U ~ 2 ^ put}b/h0{/h0 -/HS_Horizontal makehatch}b/h1{/h1/HS_Vertical makehatch}b/h2{/h2/HS_FDiagonal -makehatch}b/h3{/h3/HS_BDiagonal makehatch}b/h4{/h4/HS_Cross makehatch}b/h5{/h5 -/HS_DiagCross makehatch}b/GDIBWPatternDict 25 dict @ `/PatternType 1 d -/PaintType L2?{1}{2}? d/RepsV L2?{1}{6}? d/RepsH L2?{1}{5}? d/BBox[0 0 RepsH 1] -d/TilingType 1 d/XStep 1 d/YStep 1 d/Height 8 RepsV mul d/Width 8 d/mx[Width 0 -0 Height neg 0 Height]d/FGnd null d/BGnd null d/SetBGndFGnd L2?{{FGnd null ne -{FGnd aload ! scol BBox aload ! 2 ^ sub ~ 3 ^ sub ~ rf}if BGnd null ne{BGnd -aload ! scol}if}}{{}}? b/PaintProc{` SetBGndFGnd RepsH{Width Height F mx -PaintData imagemask Width 0 +}repeat E}b E d/GDIBWPatternMx null d/pfprep{save -8 1 $/PatternOfTheDay 8 1 $ GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/yExt ~ d/Width ~ d/FGnd ~ d/BGnd ~ d/Height yExt RepsV mul d/mx[Width 0 0 -Height 0 0]d E : GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx -matrix currentmatrix d ; CTMsave GDIBWPatternMx setmatrix GDIBWPatternDict @ ` -xOrg yOrg E matrix + mp CTMrestore ~ !}b/pfbf{/fEOFill ~ d pfprep hbf fEOFill -{O}{L}? restore}b/GraphInit{GDIHMatrix null eq{/SavedCTM matrix d : ADO_mxRot -concat 0 0 snap + : 0.48 @ GDIHPatternDict ` YStep mul ~ XStep mul ~ dsnap -YStep V ~ XStep V ~ E +S/GDIHMatrix matrix currentmatrix readonly d ; : 0.24 --0.24 +S GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx matrix -currentmatrix readonly d ; ;}if}b -%%EndResource -%%BeginResource: file Pscript_Win_GdiObject_L2 5.0 0 -/mp/makepattern , d/hbf{setpattern}b/hf{:/fEOFill ~ d ~ ! setpattern fEOFill{O} -{L}? ;}b/pbf{: !/fEOFill ~ d GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/OutputBPP ~ d/Height ~ d/Width ~ d/PaintType 1 d/PatternType 1 d/TilingType 1 -d/BBox[0 0 Width Height]d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d -20 dict @ `/ImageType 1 d/Width Width d/Height Height d/ImageMatrix mx d -/BitsPerComponent 8 d OutputBPP 24 eq{/Decode[0 1 0 1 0 1]d}{OutputBPP 8 eq{ -/Decode[0 1]d}{/Decode[0 1 0 1 0 1 0 1]d}?}?/DataSource{PaintData}d E/ImageDict -~ d/PaintProc{` ImageDict image E}b & mx makepattern setpattern E fEOFill{O}{L} -? ;}b -%%EndResource -end reinitialize -: N 1409 506 185 84 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol 1 Lw N 1594 505 M 1408 505 I 1408 590 I 1594 590 I C -K -0 0 0 1 scol Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Text 5.0 0 -/TextInit{TextInitialised? not{/Pscript_Windows_Font & d/TextInitialised? T d -/fM[1 0 0 1 0 0]d/mFM matrix d/iMat[1 0 0.212557 1 0 0]d}if}b/copyfont{1 ^ -length add dict `{1 ^/FID ne{d}{! !}?}forall & E}b/EncodeDict 11 dict d/bullets -{{/bullet}repeat}b/rF{3 copyfont @ ` ~ EncodeDict ~ get/Encoding ~ 3 ^/0 eq{& -/CharStrings known{CharStrings/Eth known not{! EncodeDict/ANSIEncodingOld get} -if}if}if d E}b/mF{@ 7 1 $ findfont ~{@/Encoding get @ StandardEncoding eq{! T}{ -{ISOLatin1Encoding}stopped{! F}{eq}?{T}{@ ` T 32 1 127{Encoding 1 ^ get -StandardEncoding 3 -1 $ get eq and}for E}?}?}{F}?{1 ^ ~ rF}{0 copyfont}? 6 -2 $ -{T pd_AddEm87 ~ !}{! ~ !/pd_charset @ where{~ get 128 eq{@ FDV 2 copy get @ -length array copy put pd_CoverFCRange}if}{!}?}? 2 ^ ~ definefont fM 5 4 -1 $ -put fM 4 0 put fM makefont Pscript_Windows_Font 3 1 $ put}b/sLT{: Lw -M -currentpoint snap M 0 - 0 Lc K ;}b/xUP null d/yUP null d/uW null d/xSP null d -/ySP null d/sW null d/sSU{N/uW ~ d/yUP ~ d/xUP ~ d}b/sU{xUP yUP uW sLT}b/sST{N -/sW ~ d/ySP ~ d/xSP ~ d}b/sT{xSP ySP sW sLT}b/sR{: + R 0 0 M}b/sRxy{: matrix -astore concat 0 0 M}b/eR/; , d/AddOrigFP{{&/FontInfo known{&/FontInfo get -length 6 add}{6}? dict `/WinPitchAndFamily ~ d/WinCharSet ~ d/OrigFontType ~ d -/OrigFontStyle ~ d/OrigFontName ~ d & E/FontInfo ~ d}{! ! ! ! !}?}b/mFS -{makefont Pscript_Windows_Font 3 1 $ put}b/mF42D{0 copyfont `/FontName ~ d 2 -copy ~ sub 1 add dict `/.notdef 0 d 2 copy 1 ~{@ 3 ^ sub Encoding ~ get ~ d}for -& E/CharStrings ~ d ! ! & @ E/FontName get ~ definefont}bind d/mF42{15 dict ` @ -4 1 $/FontName ~ d/FontType 0 d/FMapType 2 d/FontMatrix[1 0 0 1 0 0]d 1 ^ 254 -add 255 idiv @ array/Encoding ~ d 0 1 3 -1 $ 1 sub{@ Encoding 3 1 $ put}for -/FDepVector Encoding length array d/CharStrings 2 dict `/.notdef 0 d & E d 0 1 -Encoding length 1 sub{@ @ 10 lt{! FontName length 1 add string}{100 lt{FontName -length 2 add string}{FontName length 3 add string}?}? @ 0 FontName @ length -string cvs putinterval @ 3 -1 $ @ 4 1 $ 3 string cvs FontName length ~ -putinterval cvn 1 ^ 256 mul @ 255 add 3 -1 $ 4 ^ findfont mF42D FDepVector 3 1 -$ put}for & @ E/FontName get ~ definefont ! ! ! mF}b/UmF{L2? -{Pscript_Windows_Font ~ undef}{!}?}b/UmF42{@ findfont/FDepVector get{/FontName -get undefinefont}forall undefinefont}b -%%EndResource -end reinitialize -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Encoding256 5.0 0 -/CharCol256Encoding[/.notdef/breve/caron/dotaccent/dotlessi/fi/fl/fraction -/hungarumlaut/Lslash/lslash/minus/ogonek/ring/Zcaron/zcaron/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/exclam/quotedbl/numbersign -/dollar/percent/ampersand/quotesingle/parenleft/parenright/asterisk/plus/comma -/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S -/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/grave -/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright -/asciitilde/.notdef/.notdef/.notdef/quotesinglbase/florin/quotedblbase/ellipsis -/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef -/.notdef/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet -/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef -/Ydieresis/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section -/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/.notdef/registered -/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph -/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter -/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis -/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute -/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls -/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute -/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve -/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex -/udieresis/yacute/thorn/ydieresis]def EncodeDict/256 CharCol256Encoding put -%%EndResource -end reinitialize - -%%IncludeResource: font Helvetica -F /F0 0 /256 T /Helvetica mF -/F0S18 F0 [24.66 0 0 -24.66 0 0 ] mFS -F0S18 Ji -1433 537 M (ConstantCP)[18 14 14 13 7 14 14 7 18 0]xS -0.602 0 0.199 1 scol N 1594 551 M 1408 551 I 1408 590 I 1594 590 I C -K -N 1594 565 M 1408 565 I 1408 590 I 1594 590 I C -K -: N 1292 714 375 85 rp C -1 1 0.801 1 scol L ; N 1667 713 M 1291 713 I 1291 799 I 1667 799 I C -K -0 0 0 1 scol 1324 745 M (ConstantInterfaceMethodref)[18 14 14 13 7 14 14 7 6 14 7 14 8 7 14 13 14 21 14 7 14 14 14 8 14 0]xS -0.602 0 0.199 1 scol N 1667 759 M 1291 759 I 1291 799 I 1667 799 I C -K -N 1667 773 M 1291 773 I 1291 799 I 1667 799 I C -K -: N 1710 714 262 85 rp C -1 1 0.801 1 scol L ; N 1972 713 M 1709 713 I 1709 799 I 1972 799 I C -K -0 0 0 1 scol 1734 745 M (ConstantMethodref)[18 14 14 13 7 14 14 7 21 14 7 14 14 14 8 14 0]xS -0.602 0 0.199 1 scol N 1972 759 M 1709 759 I 1709 799 I 1972 799 I C -K -N 1972 773 M 1709 773 I 1709 799 I 1972 799 I C -K -: N 1011 714 235 85 rp C -1 1 0.801 1 scol L ; N 1246 713 M 1010 713 I 1010 799 I 1246 799 I C -K -0 0 0 1 scol 1036 745 M (ConstantFieldref)[18 14 14 13 7 14 14 7 15 6 14 6 14 8 14 0]xS -0.602 0 0.199 1 scol N 1246 759 M 1010 759 I 1010 799 I 1246 799 I C -K -N 1246 773 M 1010 773 I 1010 799 I 1246 799 I C -K -: N 1516 58 213 125 rp C -1 1 0.801 1 scol L ; N 1729 57 M 1515 57 I 1515 183 I 1729 183 I C -K -0 0 0 1 scol 1546 89 M (ConstantPool)[18 14 14 13 7 14 14 7 17 14 14 0]xS -0.602 0 0.199 1 scol N 1729 103 M 1515 103 I 1515 183 I 1729 183 I C -K -N 1729 116 M 1515 116 I 1515 183 I 1729 183 I C -K -0 0 0 1 scol 1555 158 M (getConstant\(\))[14 14 7 18 14 14 13 7 14 14 7 8 0]xS -: N 1550 265 144 84 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1694 264 M 1549 264 I 1549 349 I 1694 349 I C -K -0 0 0 1 scol 1571 296 M (Constant)[18 14 14 13 7 14 14 0]xS -0.602 0 0.199 1 scol N 1694 310 M 1549 310 I 1549 349 I 1694 349 I C -K -N 1694 323 M 1549 323 I 1549 349 I 1694 349 I C -K -N 1622 223 M 1622 184 I K -N 1652 175 14 29 rp C -1 1 1 1 scol L 0 0 0 1 scol 1652 198 M (1)S -0.602 0 0.199 1 scol N 1622 184 M 1632 203 I 1622 221 I 1612 203 I 1622 184 I C -: 1 1 1 1 scol O ; K -N 1622 223 M 1622 263 I K -N 1654 245 11 28 rp C -1 1 1 1 scol L 0 0 0 1 scol 1654 268 M (*)S -N 1652 175 14 29 rp C -1 1 1 1 scol L 0 0 0 1 scol 1652 198 M (1)S -N 1654 245 11 28 rp C -1 1 1 1 scol L 0 0 0 1 scol 1654 268 M (*)S -0.602 0 0.199 1 scol N 1494 655 M 1494 591 I K -N 1123 655 M 1828 655 I K -N 1494 591 M 1509 632 I 1479 632 I C -: 1 1 1 1 scol O ; K -N 1123 713 M 1123 655 I K -: N 1743 506 219 84 rp C -1 1 0.801 1 scol L ; N 1962 505 M 1742 505 I 1742 590 I 1962 590 I C -K -0 0 0 1 scol 1769 537 M (ConstantString)[18 14 14 13 7 14 14 7 17 7 8 6 14 0]xS -0.602 0 0.199 1 scol N 1962 551 M 1742 551 I 1742 590 I 1962 590 I C -K -N 1962 565 M 1742 565 I 1742 590 I 1962 590 I C -K -: N 822 506 219 84 rp C -1 1 0.801 1 scol L ; N 1041 505 M 821 505 I 821 590 I 1041 590 I C -K -0 0 0 1 scol 849 537 M (ConstantClass)[18 14 14 13 7 14 14 7 18 6 14 13 0]xS -0.602 0 0.199 1 scol N 1041 551 M 821 551 I 821 590 I 1041 590 I C -K -N 1041 565 M 821 565 I 821 590 I 1041 590 I C -K -: N 1236 254 224 84 rp C -1 1 0.801 1 scol L ; N 1460 253 M 1235 253 I 1235 338 I 1460 338 I C -K -0 0 0 1 scol 1259 285 M (ConstantInteger)[18 14 14 13 7 14 14 7 6 14 7 14 14 14 0]xS -0.602 0 0.199 1 scol N 1460 299 M 1235 299 I 1235 338 I 1460 338 I C -K -N 1460 312 M 1235 312 I 1235 338 I 1460 338 I C -K -: N 958 254 232 84 rp C -1 1 0.801 1 scol L ; N 1190 253 M 957 253 I 957 338 I 1190 338 I C -K -0 0 0 1 scol 984 285 M (ConstantDouble)[18 14 14 13 7 14 14 7 18 14 14 14 6 0]xS -0.602 0 0.199 1 scol N 1190 299 M 957 299 I 957 338 I 1190 338 I C -K -N 1190 312 M 957 312 I 957 338 I 1190 338 I C -K -: N 1102 506 207 84 rp C -1 1 0.801 1 scol L ; N 1309 505 M 1101 505 I 1101 590 I 1309 590 I C -K -0 0 0 1 scol 1127 537 M (ConstantFloat)[18 14 14 13 7 14 14 7 15 6 14 14 0]xS -0.602 0 0.199 1 scol N 1309 551 M 1101 551 I 1101 590 I 1309 590 I C -K -N 1309 565 M 1101 565 I 1101 590 I 1309 590 I C -K -: N 708 254 206 84 rp C -1 1 0.801 1 scol L ; N 914 253 M 707 253 I 707 338 I 914 338 I C -K -0 0 0 1 scol 732 285 M (ConstantLong)[18 14 14 13 7 14 14 7 14 14 14 0]xS -0.602 0 0.199 1 scol N 914 299 M 707 299 I 707 338 I 914 338 I C -K -N 914 312 M 707 312 I 707 338 I 914 338 I C -K -: N 2025 506 246 84 rp C -1 1 0.801 1 scol L ; N 2271 505 M 2024 505 I 2024 590 I 2271 590 I C -K -0 0 0 1 scol 2051 537 M (ConstantUnicode)[18 14 14 13 7 14 14 7 18 14 6 13 14 14 0]xS -0.602 0 0.199 1 scol N 2271 545 M 2024 545 I 2024 590 I 2271 590 I C -K -N 2271 558 M 2024 558 I 2024 590 I 2271 590 I C -K -: N 1790 254 322 84 rp C -1 1 0.801 1 scol L ; N 2112 253 M 1789 253 I 1789 338 I 2112 338 I C -K -0 0 0 1 scol 1817 285 M (ConstantNameAndType)[18 14 14 13 7 14 14 7 18 14 22 14 17 14 14 14 12 14 0]xS -0.602 0 0.199 1 scol N 2112 299 M 1789 299 I 1789 338 I 2112 338 I C -K -N 2112 312 M 1789 312 I 1789 338 I 2112 338 I C -K -: N 2172 254 194 84 rp C -1 1 0.801 1 scol L ; N 2366 253 M 2171 253 I 2171 338 I 2366 338 I C -K -0 0 0 1 scol 2195 285 M (ConstantUtf8)[18 14 14 13 7 14 14 7 18 7 7 0]xS -0.602 0 0.199 1 scol N 2366 293 M 2171 293 I 2171 338 I 2366 338 I C -K -N 2366 306 M 2171 306 I 2171 338 I 2366 338 I C -K -N 1626 428 M 1626 350 I K -N 809 428 M 2269 428 I K -N 1626 350 M 1641 391 I 1611 391 I C -: 1 1 1 1 scol O ; K -N 933 505 M 933 428 I K -N 1848 505 M 1848 428 I K -N 1068 339 M 1068 428 I K -N 2146 505 M 2146 428 I K -N 809 339 M 809 428 I K -N 2269 339 M 2269 428 I K -N 1500 505 M 1500 428 I K -N 1336 339 M 1336 428 I K -N 1201 505 M 1201 428 I K -N 1926 339 M 1926 428 I K -N 1468 713 M 1468 655 I K -N 1828 713 M 1828 655 I K -LH -%%PageTrailer - -%%Trailer -%%DocumentNeededResources: -%%+ font Helvetica -%%DocumentSuppliedResources: -Pscript_WinNT_Incr dup /terminate get exec -%%EOF -grestore - -%%EndDocument - @endspecial 824 5316 a Fq(Figur)n(e)26 b(8:)k(UML)25 -b(diagram)g(for)h(the)f(ConstantPool)i(API)p eop -%%Page: 31 31 -31 30 bop 749 5113 a @beginspecial 13 @llx 12 @lly 410 -@urx 830 @ury 2792 @rwi @setspecial -%%BeginDocument: eps/instructions.eps -%!PS-Adobe-3.0 EPSF-3.0 -%%Title: Rose Diagram(s) -%%Creator: AdobePS5.dll Version 5.0 -%%CreationDate: 7/7/1999 17:43:39 -%%Pages: 1 -%%Orientation: Portrait -%%PageOrder: Ascend -%%DocumentNeededResources: (atend) -%%DocumentSuppliedResources: (atend) -%%DocumentData: Clean7Bit -%%TargetDevice: (HP LaserJet 5Si) (2014.108) 1 -%%LanguageLevel: 2 -%%BoundingBox: 13 12 410 830 -%%EndComments -%%BeginProcSet: epsffit 1 0 -gsave -1409.418 -167.686 translate -90 rotate -1.711 1.711 scale -%%EndProcSet - - -%%BeginDefaults -%%PageBoundingBox: 13 12 582 830 -%%EndDefaults - -%%BeginProlog -%%BeginResource: file Pscript_WinNT_ErrorHandler 5.0 0 -/currentpacking where{pop/oldpack currentpacking def/setpacking where{pop false -setpacking}if}if/$brkpage 64 dict def $brkpage begin/prnt{dup type/stringtype -ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch -def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0 -rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def -/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def/=={/cp 0 def -typeprint nl}def/typeprint{dup type exec}readonly def/lmargin 72 def/rmargin 72 -def/tprint{dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp -exch def prnt}readonly def/cvsprint{=string cvs tprint( )tprint}readonly def -/integertype{cvsprint}readonly def/realtype{cvsprint}readonly def/booleantype -{cvsprint}readonly def/operatortype{(--)tprint =string cvs tprint(-- )tprint} -readonly def/marktype{pop(-mark- )tprint}readonly def/dicttype{pop -(-dictionary- )tprint}readonly def/nulltype{pop(-null- )tprint}readonly def -/filetype{pop(-filestream- )tprint}readonly def/savetype{pop(-savelevel- ) -tprint}readonly def/fonttype{pop(-fontid- )tprint}readonly def/nametype{dup -xcheck not{(/)tprint}if cvsprint}readonly def/stringtype{dup rcheck{(\()tprint -tprint(\))tprint}{pop(-string- )tprint}ifelse}readonly def/arraytype{dup rcheck -{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}forall(]) -tprint}ifelse}{pop(-array- )tprint}ifelse}readonly def/packedarraytype{dup -rcheck{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint} -forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse}readonly def/courier -/Courier findfont 10 scalefont def end errordict/handleerror{systemdict begin -$error begin $brkpage begin newerror{/newerror false store vmstatus pop pop 0 -ne{grestoreall}if showpage initgraphics courier setfont lmargin 720 moveto -(ERROR: )prnt errorname prnt nl(OFFENDING COMMAND: )prnt/command load prnt -$error/ostack known{nl nl(STACK:)prnt nl nl $error/ostack get aload length{==} -repeat}if systemdict/showpage get exec(%%[ Error: )print errorname =print -(; OffendingCommand: )print/command load =print( ]%%)= flush}if end end end}dup -0 systemdict put dup 4 $brkpage put bind readonly put/currentpacking where{pop -/setpacking where{pop oldpack setpacking}if}if -%%EndResource -userdict /Pscript_WinNT_Incr 230 dict dup begin put -%%BeginResource: file Pscript_FatalError 5.0 0 -/FatalErrorIf{{initgraphics findfont exch scalefont setfont counttomark 3 div -cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def -%%EndResource -/VM?{vmstatus exch sub exch pop gt{[ -(This job requires more memory than is available in this printer.)100 500 -(Try one or more of the following, and then print again:)100 485 -(For the output format, choose Optimize For Portability.)115 470 -(In the Device Settings page, make sure the Available PostScript Memory is accurate.) -115 455(Reduce the number of fonts in the document.)115 440 -(Print the document in parts.)115 425 12/Times-Roman showpage -(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def -%%BeginResource: file Pscript_Win_Basic 5.0 0 -/d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^ -/index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/- -/rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true , -d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C -/closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M -/rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , d -/Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/show , d/LH/showpage -, d/K/stroke , d/W/widthshow , d/R/rotate , d/P/eoclip , d/L2? false -/languagelevel where{pop languagelevel 2 ge{pop true}if}if d L2?{/xS/xshow , d -/yS/yshow , d/zS/xyshow , d}if/b{bind d}bind d/bd{bind d}bind d/xd{~ d}bd/ld{, -d}bd/lw/Lw ld/lc/Lc ld/lj/Lj ld/sg/setgray ld/ADO_mxRot null d/self & d/OrgMx -matrix currentmatrix d/reinitialize{: OrgMx setmatrix[/TextInit/GraphInit -/UtilsInit counttomark{@ where{self eq}{F}?{cvx exec}{!}?}repeat cleartomark ;} -b/initialize{`{/ADO_mxRot ~ d/TextInitialised? F d reinitialize E}{U -/Pscript_Win_Data 230 dict @ ` put/ADO_mxRot ~ d/TextInitialised? F d -reinitialize}?}b/terminate{!{& self eq{exit}{E}?}loop E}b/suspend/terminate , d -/resume{` Pscript_Win_Data `}b/snap{transform 0.25 sub round 0.25 add ~ 0.25 -sub round 0.25 add ~ itransform}b/dsnap{dtransform round ~ round ~ idtransform} -b<04>cvn{}d/rr{1 ^ 0 - 0 ~ - neg 0 - C}b/rp{4 2 $ M 1 ^ 0 - 0 ~ - neg 0 -}b -/solid{[]0 sd}b/g{@ not{U/DefIf_save save put}if U/DefIf_bool 2 ^ put}b -/DefIf_El{if U/DefIf_bool get not @{U/DefIf_save get restore}if}b/e{DefIf_El !} -b/UDF{L2?{undefinefont}{!}?}b/UDR{L2?{undefineresource}{! !}?}b -%%EndResource -%%BeginResource: file Pscript_Win_Utils_L2 5.0 0 -/rf/rectfill , d/fx{1 1 dtransform @ 0 ge{1 sub 0.5}{1 add -0.5}? 3 -1 $ @ 0 ge -{1 sub 0.5}{1 add -0.5}? 3 1 $ 4 1 $ idtransform 4 -2 $ idtransform}b/BZ{4 -2 $ -snap + +S fx rf}b/rs/rectstroke , d/rc/rectclip , d/UtilsInit{currentglobal{F -setglobal}if}b/scol{! setcolor}b/colspA/DeviceGray d/colspABC/DeviceRGB d -/colspRefresh{colspABC setcolorspace}b/SetColSpace{colspABC setcolorspace}b -%%EndResource -end -%%EndProlog - -%%BeginSetup -[ 1 0 0 1 0 0 ] false Pscript_WinNT_Incr dup /initialize get exec -1 setlinecap 1 setlinejoin -/mysetup [ 0.24 0 0 -0.24 13.43905 829.74047 ] def -%%EndSetup - -%%Page: 1 1 -%%PageBoundingBox: 13 12 582 830 -%%EndPageComments -%%BeginPageSetup -/DeviceRGB dup setcolorspace /colspABC exch def mysetup concat colspRefresh -%%EndPageSetup - -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Win_GdiObject 5.0 0 -/SavedCTM null d/CTMsave{/SavedCTM SavedCTM currentmatrix d}b/CTMrestore -{SavedCTM setmatrix}b/mp null d/ADO_mxRot null d/GDIHMatrix null d -/GDIHPatternDict 22 dict d GDIHPatternDict `/PatternType 1 d/PaintType 2 d/Reps -L2?{1}{5}? d/XStep 8 Reps mul d/YStep XStep d/BBox[0 0 XStep YStep]d/TilingType -1 d/PaintProc{` 1 Lw[]0 sd PaintData , exec E}b/FGnd null d/BGnd null d -/HS_Horizontal{horiz}b/HS_Vertical{vert}b/HS_FDiagonal{fdiag}b/HS_BDiagonal -{biag}b/HS_Cross{horiz vert}b/HS_DiagCross{fdiag biag}b/MaxXYStep XStep YStep -gt{XStep}{YStep}? d/horiz{Reps{0 4 M XStep 0 - 0 8 +}repeat 0 -8 Reps mul + K}b -/vert{Reps{4 0 M 0 YStep - 8 0 +}repeat 0 -8 Reps mul + K}b/biag{Reps{0 0 M -MaxXYStep @ - 0 YStep neg M MaxXYStep @ - 0 8 +}repeat 0 -8 Reps mul + 0 YStep -M 8 8 - K}b/fdiag{Reps{0 0 M MaxXYStep @ neg - 0 YStep M MaxXYStep @ neg - 0 8 -+}repeat 0 -8 Reps mul + MaxXYStep @ M 8 -8 - K}b E/makehatch{4 -2 $/yOrg ~ d -/xOrg ~ d GDIHPatternDict/PaintData 3 -1 $ put CTMsave GDIHMatrix setmatrix -GDIHPatternDict matrix xOrg yOrg + mp CTMrestore ~ U ~ 2 ^ put}b/h0{/h0 -/HS_Horizontal makehatch}b/h1{/h1/HS_Vertical makehatch}b/h2{/h2/HS_FDiagonal -makehatch}b/h3{/h3/HS_BDiagonal makehatch}b/h4{/h4/HS_Cross makehatch}b/h5{/h5 -/HS_DiagCross makehatch}b/GDIBWPatternDict 25 dict @ `/PatternType 1 d -/PaintType L2?{1}{2}? d/RepsV L2?{1}{6}? d/RepsH L2?{1}{5}? d/BBox[0 0 RepsH 1] -d/TilingType 1 d/XStep 1 d/YStep 1 d/Height 8 RepsV mul d/Width 8 d/mx[Width 0 -0 Height neg 0 Height]d/FGnd null d/BGnd null d/SetBGndFGnd L2?{{FGnd null ne -{FGnd aload ! scol BBox aload ! 2 ^ sub ~ 3 ^ sub ~ rf}if BGnd null ne{BGnd -aload ! scol}if}}{{}}? b/PaintProc{` SetBGndFGnd RepsH{Width Height F mx -PaintData imagemask Width 0 +}repeat E}b E d/GDIBWPatternMx null d/pfprep{save -8 1 $/PatternOfTheDay 8 1 $ GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/yExt ~ d/Width ~ d/FGnd ~ d/BGnd ~ d/Height yExt RepsV mul d/mx[Width 0 0 -Height 0 0]d E : GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx -matrix currentmatrix d ; CTMsave GDIBWPatternMx setmatrix GDIBWPatternDict @ ` -xOrg yOrg E matrix + mp CTMrestore ~ !}b/pfbf{/fEOFill ~ d pfprep hbf fEOFill -{O}{L}? restore}b/GraphInit{GDIHMatrix null eq{/SavedCTM matrix d : ADO_mxRot -concat 0 0 snap + : 0.48 @ GDIHPatternDict ` YStep mul ~ XStep mul ~ dsnap -YStep V ~ XStep V ~ E +S/GDIHMatrix matrix currentmatrix readonly d ; : 0.24 --0.24 +S GDIBWPatternDict ` Width Height E dsnap +S/GDIBWPatternMx matrix -currentmatrix readonly d ; ;}if}b -%%EndResource -%%BeginResource: file Pscript_Win_GdiObject_L2 5.0 0 -/mp/makepattern , d/hbf{setpattern}b/hf{:/fEOFill ~ d ~ ! setpattern fEOFill{O} -{L}? ;}b/pbf{: !/fEOFill ~ d GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d -/OutputBPP ~ d/Height ~ d/Width ~ d/PaintType 1 d/PatternType 1 d/TilingType 1 -d/BBox[0 0 Width Height]d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d -20 dict @ `/ImageType 1 d/Width Width d/Height Height d/ImageMatrix mx d -/BitsPerComponent 8 d OutputBPP 24 eq{/Decode[0 1 0 1 0 1]d}{OutputBPP 8 eq{ -/Decode[0 1]d}{/Decode[0 1 0 1 0 1 0 1]d}?}?/DataSource{PaintData}d E/ImageDict -~ d/PaintProc{` ImageDict image E}b & mx makepattern setpattern E fEOFill{O}{L} -? ;}b -%%EndResource -end reinitialize -: N 1432 65 209 154 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol 1 Lw N 1641 64 M 1431 64 I 1431 219 I 1641 219 I C -K -0 0 0 1 scol Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Text 5.0 0 -/TextInit{TextInitialised? not{/Pscript_Windows_Font & d/TextInitialised? T d -/fM[1 0 0 1 0 0]d/mFM matrix d/iMat[1 0 0.212557 1 0 0]d}if}b/copyfont{1 ^ -length add dict `{1 ^/FID ne{d}{! !}?}forall & E}b/EncodeDict 11 dict d/bullets -{{/bullet}repeat}b/rF{3 copyfont @ ` ~ EncodeDict ~ get/Encoding ~ 3 ^/0 eq{& -/CharStrings known{CharStrings/Eth known not{! EncodeDict/ANSIEncodingOld get} -if}if}if d E}b/mF{@ 7 1 $ findfont ~{@/Encoding get @ StandardEncoding eq{! T}{ -{ISOLatin1Encoding}stopped{! F}{eq}?{T}{@ ` T 32 1 127{Encoding 1 ^ get -StandardEncoding 3 -1 $ get eq and}for E}?}?}{F}?{1 ^ ~ rF}{0 copyfont}? 6 -2 $ -{T pd_AddEm87 ~ !}{! ~ !/pd_charset @ where{~ get 128 eq{@ FDV 2 copy get @ -length array copy put pd_CoverFCRange}if}{!}?}? 2 ^ ~ definefont fM 5 4 -1 $ -put fM 4 0 put fM makefont Pscript_Windows_Font 3 1 $ put}b/sLT{: Lw -M -currentpoint snap M 0 - 0 Lc K ;}b/xUP null d/yUP null d/uW null d/xSP null d -/ySP null d/sW null d/sSU{N/uW ~ d/yUP ~ d/xUP ~ d}b/sU{xUP yUP uW sLT}b/sST{N -/sW ~ d/ySP ~ d/xSP ~ d}b/sT{xSP ySP sW sLT}b/sR{: + R 0 0 M}b/sRxy{: matrix -astore concat 0 0 M}b/eR/; , d/AddOrigFP{{&/FontInfo known{&/FontInfo get -length 6 add}{6}? dict `/WinPitchAndFamily ~ d/WinCharSet ~ d/OrigFontType ~ d -/OrigFontStyle ~ d/OrigFontName ~ d & E/FontInfo ~ d}{! ! ! ! !}?}b/mFS -{makefont Pscript_Windows_Font 3 1 $ put}b/mF42D{0 copyfont `/FontName ~ d 2 -copy ~ sub 1 add dict `/.notdef 0 d 2 copy 1 ~{@ 3 ^ sub Encoding ~ get ~ d}for -& E/CharStrings ~ d ! ! & @ E/FontName get ~ definefont}bind d/mF42{15 dict ` @ -4 1 $/FontName ~ d/FontType 0 d/FMapType 2 d/FontMatrix[1 0 0 1 0 0]d 1 ^ 254 -add 255 idiv @ array/Encoding ~ d 0 1 3 -1 $ 1 sub{@ Encoding 3 1 $ put}for -/FDepVector Encoding length array d/CharStrings 2 dict `/.notdef 0 d & E d 0 1 -Encoding length 1 sub{@ @ 10 lt{! FontName length 1 add string}{100 lt{FontName -length 2 add string}{FontName length 3 add string}?}? @ 0 FontName @ length -string cvs putinterval @ 3 -1 $ @ 4 1 $ 3 string cvs FontName length ~ -putinterval cvn 1 ^ 256 mul @ 255 add 3 -1 $ 4 ^ findfont mF42D FDepVector 3 1 -$ put}for & @ E/FontName get ~ definefont ! ! ! mF}b/UmF{L2? -{Pscript_Windows_Font ~ undef}{!}?}b/UmF42{@ findfont/FDepVector get{/FontName -get undefinefont}forall undefinefont}b -%%EndResource -end reinitialize -Pscript_WinNT_Incr begin -%%BeginResource: file Pscript_Encoding256 5.0 0 -/CharCol256Encoding[/.notdef/breve/caron/dotaccent/dotlessi/fi/fl/fraction -/hungarumlaut/Lslash/lslash/minus/ogonek/ring/Zcaron/zcaron/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef -/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/exclam/quotedbl/numbersign -/dollar/percent/ampersand/quotesingle/parenleft/parenright/asterisk/plus/comma -/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon -/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S -/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/grave -/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright -/asciitilde/.notdef/.notdef/.notdef/quotesinglbase/florin/quotedblbase/ellipsis -/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef -/.notdef/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet -/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef -/Ydieresis/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section -/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/.notdef/registered -/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph -/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter -/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis -/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute -/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis -/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls -/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute -/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve -/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex -/udieresis/yacute/thorn/ydieresis]def EncodeDict/256 CharCol256Encoding put -%%EndResource -end reinitialize - -%%IncludeResource: font Helvetica -F /F0 0 /256 T /Helvetica mF -/F0S21 F0 [33.09 0 0 -33.09 0 0 ] mFS -F0S21 Ji -1461 104 M (Instruction)[9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1641 117 M 1431 117 I 1431 219 I 1641 219 I C -K -N 1641 212 M 1431 212 I 1431 219 I 1641 219 I C -K -0 0 0 1 scol 1478 153 M (tag)[9 17 0]xS -1478 191 M (length)[7 17 18 18 9 0]xS -: N 575 326 321 98 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 896 325 M 574 325 I 574 424 I 896 424 I C -K -0 0 0 1 scol 609 365 M (BranchInstruction)[22 11 17 18 17 18 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 896 378 M 574 378 I 574 424 I 896 424 I C -K -N 896 396 M 574 396 I 574 424 I 896 424 I C -K -: N 822 556 164 154 rp C -1 1 0.801 1 scol L ; N 986 555 M 821 555 I 821 710 I 986 710 I C -K -0 0 0 1 scol 859 595 M (Select)[22 17 7 17 17 0]xS -0.602 0 0.199 1 scol N 986 608 M 821 608 I 821 710 I 986 710 I C -K -N 986 702 M 821 702 I 821 710 I 986 710 I C -K -0 0 0 1 scol 868 644 M (targets)[9 17 11 18 17 9 0]xS -868 682 M (keys)[16 17 15 0]xS -: N 584 815 303 100 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 887 814 M 583 814 I 583 915 I 887 915 I C -K -0 0 0 1 scol 599 855 M (LOOKUPSWITCH)[18 26 26 22 24 22 22 34 9 21 24 0]xS -0.602 0 0.199 1 scol N 887 868 M 583 868 I 583 915 I 887 915 I C -K -N 887 886 M 583 886 I 583 915 I 887 915 I C -K -: N 964 815 267 100 rp C -1 1 0.801 1 scol L ; N 1231 814 M 963 814 I 963 915 I 1231 915 I C -K -0 0 0 1 scol 978 855 M (TABLESWITCH)[21 22 22 18 22 22 34 9 21 24 0]xS -0.602 0 0.199 1 scol N 1231 868 M 963 868 I 963 915 I 1231 915 I C -K -N 1231 886 M 963 886 I 963 915 I 1231 915 I C -K -: N 567 557 208 100 rp C -1 1 0.801 1 scol L ; N 775 556 M 566 556 I 566 657 I 775 657 I C -K -0 0 0 1 scol 587 597 M (IfInstruction)[9 10 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 775 609 M 566 609 I 566 657 I 775 657 I C -K -N 775 628 M 566 628 I 566 657 I 775 657 I C -K -: N 393 557 143 100 rp C -1 1 0.801 1 scol L ; N 536 556 M 392 556 I 392 657 I 536 657 I C -K -0 0 0 1 scol 415 597 M (GOTO)[26 26 21 0]xS -0.602 0 0.199 1 scol N 536 609 M 392 609 I 392 657 I 536 657 I C -K -N 536 628 M 392 628 I 392 657 I 536 657 I C -K -N 730 499 M 730 425 I K -N 469 499 M 910 499 I K -N 730 425 M 748 473 I 712 473 I C -: 1 1 1 1 scol O ; K -N 469 556 M 469 499 I K -: N 1843 118 290 100 rp C -1 1 0.801 1 scol L ; N 2133 117 M 1842 117 I 1842 218 I 2133 218 I C -K -0 0 0 1 scol 1865 158 M (ReturnInstruction)[24 17 9 18 11 18 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 2133 168 M 1842 168 I 1842 218 I 2133 218 I C -K -N 2133 186 M 1842 186 I 1842 218 I 2133 218 I C -K -: N 1004 325 264 99 rp C -1 1 0.801 1 scol L ; N 1268 324 M 1003 324 I 1003 424 I 1268 424 I C -K -0 0 0 1 scol 1023 364 M (ArrayInstruction)[22 11 11 17 15 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1268 377 M 1003 377 I 1003 424 I 1268 424 I C -K -N 1268 396 M 1003 396 I 1003 424 I 1268 424 I C -K -: N 1704 332 232 188 rp C -1 1 0.801 1 scol L ; N 1936 331 M 1703 331 I 1703 520 I 1936 520 I C -K -0 0 0 1 scol 1722 372 M (CPInstruction)[24 22 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1936 382 M 1703 382 I 1703 520 I 1936 520 I C -K -N 1936 438 M 1703 438 I 1703 520 I 1936 520 I C -K -0 0 0 1 scol 1751 418 M (index)[7 18 18 17 0]xS -1751 494 M (getType\(\))[18 17 9 21 15 18 17 11 0]xS -: N 1038 118 274 100 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1312 117 M 1037 117 I 1037 218 I 1312 218 I C -K -0 0 0 1 scol 1059 158 M (StackInstruction)[22 9 17 17 16 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1312 170 M 1037 170 I 1037 218 I 1312 218 I C -K -N 1312 189 M 1037 189 I 1037 218 I 1312 218 I C -K -: N 1312 325 345 99 rp C -1 1 0.801 1 scol L ; N 1657 324 M 1311 324 I 1311 424 I 1657 424 I C -K -0 0 0 1 scol 1329 364 M (ConversionInstruction)[24 17 18 15 17 11 17 7 17 18 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1657 377 M 1311 377 I 1311 424 I 1657 424 I C -K -N 1657 396 M 1311 396 I 1311 424 I 1657 424 I C -K -N 675 556 M 675 499 I K -: N 619 118 337 100 rp C -1 1 0.801 1 scol L ; N 956 117 M 618 117 I 618 218 I 956 218 I C -K -0 0 0 1 scol 641 158 M (ArithmeticInstruction)[22 11 7 9 18 27 17 9 7 17 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 956 170 M 618 170 I 618 218 I 956 218 I C -K -N 956 189 M 618 189 I 618 218 I 956 218 I C -K -: N 1974 326 390 148 rp C -1 1 0.801 1 scol L ; N 2364 325 M 1973 325 I 1973 474 I 2364 474 I C -K -0 0 0 1 scol 1998 366 M (LocalVariableInstruction)[18 17 17 17 7 22 17 11 7 17 18 7 17 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 2364 376 M 1973 376 I 1973 474 I 2364 474 I C -K -N 2364 433 M 1973 433 I 1973 474 I 2364 474 I C -K -0 0 0 1 scol 2020 412 M (index)[7 18 18 17 0]xS -: N 1392 869 263 148 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 1655 868 M 1391 868 I 1391 1017 I 1655 1017 I C -K -0 0 0 1 scol 1414 908 M (FieldInstruction)[20 7 17 7 18 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 1655 921 M 1391 921 I 1391 1017 I 1655 1017 I C -K -N 1655 940 M 1391 940 I 1391 1017 I 1655 1017 I C -K -0 0 0 1 scol 1439 995 M (getFieldType\(\))[18 17 9 20 7 17 7 18 21 15 18 17 11 0]xS -: N 1735 869 351 148 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 2086 868 M 1734 868 I 1734 1017 I 2086 1017 I C -K -0 0 0 1 scol 1790 908 M (InvokeInstruction)[9 18 15 17 16 17 9 18 17 9 11 18 17 9 7 17 0]xS -0.602 0 0.199 1 scol N 2086 919 M 1734 919 I 1734 1017 I 2086 1017 I C -K -N 2086 937 M 1734 937 I 1734 1017 I 2086 1017 I C -K -0 0 0 1 scol 1781 992 M (getArgumentTypes\(\))[18 17 9 22 11 18 18 27 17 18 9 21 15 18 17 17 11 0]xS -0.602 0 0.199 1 scol N 1539 293 M 1539 220 I K -N 703 293 M 2171 293 I K -N 1539 220 M 1557 269 I 1522 269 I C -: 1 1 1 1 scol O ; K -N 2171 325 M 2171 293 I K -N 1826 331 M 1826 293 I K -N 898 784 M 898 711 I K -N 737 784 M 1069 784 I K -N 898 711 M 916 760 I 880 760 I C -: 1 1 1 1 scol O ; K -N 737 814 M 737 784 I K -N 1116 324 M 1116 293 I K -N 792 219 M 792 293 I K -N 1487 324 M 1487 293 I K -N 1984 219 M 1984 293 I K -N 1166 219 M 1166 293 I K -: N 1554 623 248 148 rp C -1 1 0.801 1 scol L ; N 1802 622 M 1553 622 I 1553 771 I 1802 771 I C -K -0 0 0 1 scol 1572 663 M (FieldOrMethod)[20 7 17 7 18 26 11 27 17 9 18 17 0]xS -0.602 0 0.199 1 scol N 1802 676 M 1553 676 I 1553 771 I 1802 771 I C -K -N 1802 694 M 1553 694 I 1553 771 I 1802 771 I C -K -0 0 0 1 scol 1601 749 M (getName\(\))[18 17 9 24 17 27 17 11 0]xS -: N 2179 635 186 99 rp C -1 1 0.801 1 scol L ; 0.602 0 0.199 1 scol N 2365 634 M 2178 634 I 2178 734 I 2365 734 I C -K -0 0 0 1 scol 2232 674 M (NEW)[24 22 0]xS -0.602 0 0.199 1 scol N 2365 684 M 2178 684 I 2178 734 I 2365 734 I C -K -N 2365 703 M 2178 703 I 2178 734 I 2365 734 I C -K -N 703 325 M 703 293 I K -N 1820 594 M 1820 521 I K -N 1657 594 M 2249 594 I K -N 1820 521 M 1838 570 I 1802 570 I C -: 1 1 1 1 scol O ; K -: N 1889 635 250 99 rp C -1 1 0.801 1 scol L ; N 2139 634 M 1888 634 I 1888 734 I 2139 734 I C -K -0 0 0 1 scol 1907 674 M (INSTANCEOF)[9 24 22 21 22 24 24 22 26 0]xS -0.602 0 0.199 1 scol N 2139 684 M 1888 684 I 1888 734 I 2139 734 I C -K -N 2139 703 M 1888 703 I 1888 734 I 2139 734 I C -K -N 2014 634 M 2014 594 I K -N 2249 634 M 2249 594 I K -N 1657 622 M 1657 594 I K -N 1069 814 M 1069 784 I K -N 1677 845 M 1677 772 I K -N 1511 845 M 1907 845 I K -N 1677 772 M 1695 821 I 1660 821 I C -: 1 1 1 1 scol O ; K -N 1907 868 M 1907 845 I K -N 1511 868 M 1511 845 I K -N 910 555 M 910 499 I K -LH -%%PageTrailer - -%%Trailer -%%DocumentNeededResources: -%%+ font Helvetica -%%DocumentSuppliedResources: -Pscript_WinNT_Incr dup /terminate get exec -%%EOF -grestore - -%%EndDocument - @endspecial 880 5316 a Fq(Figur)n(e)26 b(9:)31 b(UML)25 -b(diagram)g(for)g(the)h(Instr)o(uction)g(API)p eop -%%Trailer -end -userdict /end-hook known{end-hook}if -%%EOF diff --git a/docs/manual.tex b/docs/manual.tex deleted file mode 100644 index a79ce572..00000000 --- a/docs/manual.tex +++ /dev/null @@ -1,1079 +0,0 @@ -\documentclass[12pt,twoside]{article} - -\usepackage{epsf,a4wide,moreverb,url} -\usepackage{palatino} - -\newcommand\jc{{\sffamily BCEL }} -\newcommand\cp{{constant pool }} -\newcommand\cpe{constant pool} -\newcommand\jvm{{Java Virtual Machine }} -\newcommand\jvme{{Java Virtual Machine}} -\newcommand\vm{{Virtual Machine }} -\newcommand\href[2]{#2} - -\begin{document} - -\title{Byte Code Engineering Library (BCEL)\\ - Description and usage manual\\ - {\small \textbf{Version 1.0}}} - -\author{{\Large Markus Dahm}\\\\ - \href{mailto:markus.dahm@inf.fu-berlin.de}{\texttt{markus.dahm@berlin.de}}} - -\maketitle - -%\tableofcontents - -\begin{abstract} -Extensions and improvements of the programming language Java and its -related execution environment (Java Virtual Machine, JVM) are the -subject of a large number of research projects and proposals. There -are projects, for instance, to add parameterized types to Java, to -implement ``Aspect-Oriented Programming'', to perform sophisticated -static analysis, and to improve the run-time performance. - -Since Java classes are compiled into portable binary class files -(called \emph{byte code}), it is the most convenient and -platform-independent way to implement these improvements not by -writing a new compiler or changing the JVM, but by transforming the -byte code. These transformations can either be performed after -compile-time, or at load-time. Many programmers are doing this by -implementing their own specialized byte code manipulation tools, which -are, however, restricted in the range of their re-usability. - -To deal with the necessary class file transformations, we introduce an -API that helps developers to conveniently implement their -transformations. -\end{abstract} - -\section{Introduction}\label{sec:intro} - -The Java language \cite{gosling} has become very popular and many -research projects deal with further improvements of the language or -its run-time behavior. The possibility to extend a language with new -concepts is surely a desirable feature, but implementation issues -should be hidden from the user. Fortunately, the concepts of the \jvm -permit the user-transparent implementation of such extensions with -relatively little effort. - -Because the target language of Java is an interpreted language with a -small and easy-to-understand set of instructions (the \emph{byte -code}), developers can implement and test their concepts in a very -elegant way. One can write a plug-in replacement for the system's -class loader which is responsible for dynamically loading class files -at run-time and passing the byte code to the \vm (see section -\ref{sec:classloaders}). Class loaders may thus be used to intercept -the loading process and transform classes before they get actually -executed by the JVM \cite{classloader}. While the original class -files always remain unaltered, the behavior of the class loader may be -reconfigured for every execution or instrumented dynamically. - -The \jc API (Byte Code Engineering Library), formerly known as -JavaClass, is a toolkit for the static analysis and dynamic creation -or transformation of Java class files. It enables developers to -implement the desired features on a high level of abstraction without -handling all the internal details of the Java class file format and -thus re-inventing the wheel every time. \jc is written entirely in -Java and freely available under the terms of the Apache Software -License. \footnote{The distribution is available at - \url{http://jakarta.apache.org/bcel/}, including several code - examples and javadoc manuals. } - -This paper is structured as follows: We give a brief description of -the \jvm and the class file format in section \ref{sec:jvm}. Section -\ref{sec:api} introduces the \jc API. Section \ref{sec:application} -describes some typical application areas and example projects. The -appendix contains code examples that are to long to be presented in -the main part of this paper. All examples are included in the -down-loadable distribution. - -\subsection{Related work} - -There are a number of proposals and class libraries that have some -similarities with \textsc{BCEL}: The JOIE \cite{joie} toolkit can -be used to instrument class loaders with dynamic behavior. Similarly, -``Binary Component Adaptation'' \cite{bca} allows components to be -adapted and evolved on-the-fly. Han Lee's ``Byte-code Instrumenting -Tool'' \cite{bit} allows the user to insert calls to analysis methods -anywhere in the byte code. The Jasmin language \cite{jasmin} can be -used to hand-write or generate pseudo-assembler code. D-Java -\cite{classfile} and JCF \cite{inside} are class viewing tools. - -In contrast to these projects, \jc is intended to be a general purpose -tool for ``byte code engineering''. It gives full control to the -developer on a high level of abstraction and is not restricted to any -particular application area. - -\section{The Java Virtual Machine}\label{sec:jvm} - -Readers already familiar with the \jvm and the Java class file format -may want to skip this section and proceed with section \ref{sec:api}. - -Programs written in the Java language are compiled into a portable -binary format called \emph{byte code}. Every class is represented by -a single class file containing class related data and byte code -instructions. These files are loaded dynamically into an interpreter -(\jvme, JVM) and executed. - -Figure \ref{fig:jvm} illustrates the procedure of compiling and -executing a Java class: The source file (\texttt{HelloWorld.java}) is -compiled into a Java class file (\texttt{HelloWorld.class}), loaded by -the byte code interpreter and executed. In order to implement -additional features, researchers may want to transform class files -(drawn with bold lines) before they get actually executed. This -application area is one of the main issues of this article. - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfxsize\textwidth - \epsfbox{eps/jvm.eps} - \caption{Compilation and execution of Java classes} - \label{fig:jvm} - \end{center} -\end{figure} - -Note that the use of the general term ``Java'' implies two meanings: -on the one hand, Java as a programming language is meant, on the other -hand, the Java Virtual Machine, which is not necessarily targeted by -the Java language exclusively, but may be used by other languages as -well (e.g. Eiffel \cite{eiffel}, or Ada \cite{ada}). We assume the -reader to be familiar with the Java language and to have a general -understanding of the Virtual Machine. - -\subsection{Java class file format}\label{sec:format} - -Giving a full overview of the design issues of the Java class file -format and the associated byte code instructions is beyond the scope -of this paper. We will just give a brief introduction covering the -details that are necessary for understanding the rest of this -paper. The format of class files and the byte code instruction set are -described in more detail in the ``\jvm Specification'' \cite{jvm} -\footnote{Also available online at -\url{http://www.javasoft.com/docs/books/vmspec/index.html}}, and in -\cite{jasmin}. Especially, we will not deal with the security -constraints that the \jvm has to check at run-time, i.e. the byte code -verifier. - -Figure \ref{fig:classfile} shows a simplified example of the contents -of a Java class file: It starts with a header containing a ``magic -number'' (\texttt{0xCAFEBABE}) and the version number, followed by the -\emph{\cpe}, which can be roughly thought of as the text segment of an -executable, the \emph{access rights} of the class encoded by a bit -mask, a list of interfaces implemented by the class, lists containing -the fields and methods of the class, and finally the \emph{class -attributes}, e.g. the \texttt{SourceFile} attribute telling the name -of the source file. Attributes are a way of putting additional, -e.g. user-defined, information into class file data structures. For -example, a custom class loader may evaluate such attribute data in -order to perform its transformations. The JVM specification declares -that unknown, i.e. user-defined attributes must be ignored by any \vm -implementation. - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfxsize\textwidth - \epsfbox{eps/classfile.eps} - \caption{Java class file format} - \label{fig:classfile} - \end{center} -\end{figure} - -Because all of the information needed to dynamically resolve the -symbolic references to classes, fields and methods at run-time is -coded with string constants, the \cp contains in fact the largest -portion of an average class file, approximately 60\% \cite{statistic}. -The byte code instructions themselves just make up 12\%. - -The right upper box shows a ``zoomed'' excerpt of the \cpe, while the -rounded box below depicts some instructions that are contained within -a method of the example class. These instructions represent the -straightforward translation of the well-known statement: - -\begin{verbatim} - System.out.println("Hello, world"); -\end{verbatim} - -The first instruction loads the contents of the field \texttt{out} of -class \texttt{java.lang.System} onto the operand stack. This is an -instance of the class \texttt{java.io.PrintStream}. The \texttt{ldc} -(``Load constant'') pushes a reference to the string "Hello world" on -the stack. The next instruction invokes the instance method -\texttt{println} which takes both values as parameters (Instance -methods always implicitly take an instance reference as their first -argument). - -Instructions, other data structures within the class file and -constants themselves may refer to constants in the \cpe. Such -references are implemented via fixed indexes encoded directly into the -instructions. This is illustrated for some items of the figure -emphasized with a surrounding box. - -For example, the \texttt{invokevirtual} instruction refers to a -\texttt{MethodRef} constant that contains information about the name -of the called method, the signature (i.e. the encoded argument and -return types), and to which class the method belongs. In fact, as -emphasized by the boxed value, the \texttt{MethodRef} constant itself -just refers to other entries holding the real data, e.g. it refers to -a \texttt{ConstantClass} entry containing a symbolic reference to the -class \texttt{java.io.PrintStream}. To keep the class file compact, -such constants are typically shared by different instructions. -Similarly, a field is represented by a \texttt{Fieldref} constant that -includes information about the name, the type and the containing class -of the field. - -The \cp basically holds the following types of constants: References -to methods, fields and classes, strings, integers, floats, longs, and -doubles. - -\subsection{Byte code instruction set}\label{sec:code} - -The JVM is a stack-oriented interpreter that creates a local stack -frame of fixed size for every method invocation. The size of the local -stack has to be computed by the compiler. Values may also be stored -intermediately in a frame area containing \emph{local variables} which -can be used like a set of registers. These local variables are -numbered from 0 to 65535, i.e. you have a maximum of 65536 of local -variables. The stack frames of caller and callee method are -overlapping, i.e. the caller pushes arguments onto the operand stack -and the called method receives them in local variables. - -The byte code instruction set currently consists of 212 instructions, -44 opcodes are marked as reserved and may be used for future -extensions or intermediate optimizations within the Virtual -Machine. The instruction set can be roughly grouped as follows: - -\begin{description} -\item[Stack operations:] Constants can be pushed onto the stack either -by loading them from the \cp with the \texttt{ldc} instruction or with -special ``short-cut'' instructions where the operand is encoded into -the instructions, e.g. \texttt{iconst\_0} or \texttt{bipush} (push -byte value). - -\item[Arithmetic operations:] The instruction set of the \jvm -distinguishes its operand types using different instructions to -operate on values of specific type. Arithmetic operations starting -with \texttt{i}, for example, denote an integer operation. E.g., -\texttt{iadd} that adds two integers and pushes the result back on the -stack. The Java types \texttt{boolean}, \texttt{byte}, -\texttt{short}, and \texttt{char} are handled as integers by the JVM. - -\item[Control flow:] There are branch instructions like \texttt{goto} -and \texttt{if\_icmpeq}, which compares two integers for -equality. There is also a \texttt{jsr} (jump sub-routine) and -\texttt{ret} pair of instructions that is used to implement the -\texttt{finally} clause of \texttt{try-catch} blocks. Exceptions may -be thrown with the \texttt{athrow} instruction. - -Branch targets are coded as offsets from the current byte code -position, i.e. with an integer number. - -\item[Load and store operations] for local variables like -\texttt{iload} and \texttt{istore}. There are also array operations -like \texttt{iastore} which stores an integer value into an array. - -\item[Field access:] The value of an instance field may be retrieved -with \texttt{getfield} and written with \texttt{putfield}. For static -fields, there are \texttt{getstatic} and \texttt{putstatic} -counterparts. - -\item[Method invocation:] Methods may either be called via static -references with \texttt{invokesta\-tic} or be bound virtually with the -\texttt{invokevirtual} instruction. Super class methods and private -methods are invoked with \texttt{invokespecial}. - -\item[Object allocation:] Class instances are allocated with the -\texttt{new} instruction, arrays of basic type like \texttt{int[]} -with \texttt{newarray}, arrays of references like \texttt{String[][]} -with \texttt{anewarray} or \texttt{multianewarray}. - -\item[Conversion and type checking:] For stack operands of basic type -there exist casting operations like \texttt{f2i} which converts a -float value into an integer. The validity of a type cast may be -checked with \texttt{checkcast} and the \texttt{instanceof} operator -can be directly mapped to the equally named instruction. -\end{description} - -Most instructions have a fixed length, but there are also some -variable-length instructions: In particular, the \texttt{lookupswitch} -and \texttt{tableswitch} instructions, which are used to implement -\texttt{switch()} statements. Since the number of \texttt{case} -clauses may vary, these instructions contain a variable number of -statements. - -We will not list all byte code instructions here, since these are -explained in detail in the JVM specification. The opcode names are -mostly self-explaining, so understanding the following code examples -should be fairly intuitive. - -\subsection{Method code}\label{sec:code2} - -Non-abstract methods contain an attribute (\texttt{Code}) that holds -the following data: The maximum size of the method's stack frame, the -number of local variables and an array of byte code -instructions. Optionally, it may also contain information about the -names of local variables and source file line numbers that can be used -by a debugger. - -Whenever an exception is thrown, the JVM performs exception handling -by looking into a table of exception handlers. The table marks -handlers, i.e. pieces of code, to be responsible for exceptions of -certain types that are raised within a given area of the byte -code. When there is no appropriate handler the exception is propagated -back to the caller of the method. The handler information is itself -stored in an attribute contained within the \texttt{Code} attribute. - -\subsection{Byte code offsets}\label{sec:offsets} - -Targets of branch instructions like \texttt{goto} are encoded as -relative offsets in the array of byte codes. Exception handlers and -local variables refer to absolute addresses within the byte code. The -former contains references to the start and the end of the -\texttt{try} block, and to the instruction handler code. The latter -marks the range in which a local variable is valid, i.e. its scope. -This makes it difficult to insert or delete code areas on this level -of abstraction, since one has to recompute the offsets every time and -update the referring objects. We will see in section \ref{sec:cgapi} -how \jc remedies this restriction. - -\subsection{Type information}\label{sec:types} - -Java is a type-safe language and the information about the types of -fields, local variables, and methods is stored in -\emph{signatures}. These are strings stored in the \cp and encoded in -a special format. For example the argument and return types of the -\texttt{main} method - -\begin{verbatim} - public static void main(String[] argv) -\end{verbatim} - -are represented by the signature - -\begin{verbatim} - ([java/lang/String;)V -\end{verbatim} - -Classes and arrays are internally represented by strings like -\texttt{"java/lang/String"}, basic types like \texttt{float} by an -integer number. Within signatures they are represented by single -characters, e.g., \texttt{"I"}, for integer. - -\subsection{Code example}\label{sec:fac} - -The following example program prompts for a number and prints the -faculty of it. The \texttt{readLine()} method reading from the -standard input may raise an \texttt{IOException} and if a misspelled -number is passed to \texttt{parseInt()} it throws a -\texttt{NumberFormatException}. Thus, the critical area of code must be -encapsulated in a \texttt{try-catch} block. - -{\small \begin{verbatim} -import java.io.*; -public class Faculty { - private static BufferedReader in = new BufferedReader(new - InputStreamReader(System.in)); - public static final int fac(int n) { - return (n == 0)? 1 : n * fac(n - 1); - } - public static final int readInt() { - int n = 4711; - try { - System.out.print("Please enter a number> "); - n = Integer.parseInt(in.readLine()); - } catch(IOException e1) { System.err.println(e1); } - catch(NumberFormatException e2) { System.err.println(e2); } - return n; - } - public static void main(String[] argv) { - int n = readInt(); - System.out.println("Faculty of " + n + " is " + fac(n)); - }} -\end{verbatim}} - -This code example typically compiles to the following chunks of byte -code: - -\subsubsection{Method fac} - -{\small \begin{verbatim} -0: iload_0 -1: ifne #8 -4: iconst_1 -5: goto #16 -8: iload_0 -9: iload_0 -10: iconst_1 -11: isub -12: invokestatic Faculty.fac (I)I (12) -15: imul -16: ireturn - -LocalVariable(start_pc = 0, length = 16, index = 0:int n) -\end{verbatim}} - -The method \texttt{fac} has only one local variable, the argument -\texttt{n}, stored in slot 0. This variable's scope ranges from the -start of the byte code sequence to the very end. If the value of -\texttt{n} (stored in local variable 0, i.e. the value fetched with -\texttt{iload\_0}) is not equal to 0, the \texttt{ifne} instruction -branches to the byte code at offset 8, otherwise a 1 is pushed onto -the operand stack and the control flow branches to the final return. -For ease of reading, the offsets of the branch instructions, which are -actually relative, are displayed as absolute addresses in these -examples. - -If recursion has to continue, the arguments for the multiplication -(\texttt{n} and \texttt{fac(n - 1)}) are evaluated and the results -pushed onto the operand stack. After the multiplication operation has -been performed the function returns the computed value from the top of -the stack. - -\subsubsection{Method readInt} - -{\small \begin{verbatim} -0: sipush 4711 -3: istore_0 -4: getstatic java.lang.System.out Ljava/io/PrintStream; -7: ldc "Please enter a number> " -9: invokevirtual java.io.PrintStream.print (Ljava/lang/String;)V -12: getstatic Faculty.in Ljava/io/BufferedReader; -15: invokevirtual java.io.BufferedReader.readLine ()Ljava/lang/String; -18: invokestatic java.lang.Integer.parseInt (Ljava/lang/String;)I -21: istore_0 -22: goto #44 -25: astore_1 -26: getstatic java.lang.System.err Ljava/io/PrintStream; -29: aload_1 -30: invokevirtual java.io.PrintStream.println (Ljava/lang/Object;)V -33: goto #44 -36: astore_1 -37: getstatic java.lang.System.err Ljava/io/PrintStream; -40: aload_1 -41: invokevirtual java.io.PrintStream.println (Ljava/lang/Object;)V -44: iload_0 -45: ireturn - -Exception handler(s) = -From To Handler Type -4 22 25 java.io.IOException(6) -4 22 36 NumberFormatException(10) -\end{verbatim}} - -First the local variable \texttt{n} (in slot 0) is initialized to the -value 4711. The next instruction, \texttt{getstatic}, loads the -static \texttt{System.out} field onto the stack. Then a string is -loaded and printed, a number read from the standard input and -assigned to \texttt{n}. - -If one of the called methods (\texttt{readLine()} and -\texttt{parseInt()}) throws an exception, the \jvm calls one of the -declared exception handlers, depending on the type of the exception. -The \texttt{try}-clause itself does not produce any code, it merely -defines the range in which the following handlers are active. In the -example the specified source code area maps to a byte code area -ranging from offset 4 (inclusive) to 22 (exclusive). If no exception -has occurred (``normal'' execution flow) the \texttt{goto} -instructions branch behind the handler code. There the value of -\texttt{n} is loaded and returned. - -For example the handler for \texttt{java.io.IOException} starts at -offset 25. It simply prints the error and branches back to the normal -execution flow, i.e. as if no exception had occurred. - -\section{The BCEL API}\label{sec:api} - -The \jc API abstracts from the concrete circumstances of the \jvm and -how to read and write binary Java class files. The API mainly -consists of three parts: - -\begin{enumerate} - -\item A package that contains classes that describe ``static'' - constraints of class files, i.e., reflect the class file format and - is not intended for byte code modifications. The classes may be - used to read and write class files from or to a file. This is - useful especially for analyzing Java classes without having the - source files at hand. The main data structure is called - \texttt{JavaClass} which contains methods, fields, etc.. - -\item A package to dynamically generate or modify \texttt{JavaClass} -objects. It may be used e.g. to insert analysis code, to strip -unnecessary information from class files, or to implement the code -generator back-end of a Java compiler. - -\item Various code examples and utilities like a class file viewer, a -tool to convert class files into HTML, and a converter from class -files to the Jasmin assembly language \cite{jasmin}. -\end{enumerate} - -\subsection{JavaClass}\label{sec:javaclass} - -The ``static'' component of the \jc API resides in the package -\path{de.fub.bytecode.classfile} and represents class files. All of the -binary components and data structures declared in the JVM -specification \cite{jvm} and described in section \ref{sec:jvm} are -mapped to classes. Figure \ref{fig:umljc} shows an UML diagram of the -hierarchy of classes of the \jc API. Figure \ref{fig:umlcp} in the -appendix also shows a detailed diagram of the \texttt{ConstantPool} -components. - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfysize0.93\textheight - \epsfbox{eps/javaclass.eps} - \caption{UML diagram for the \jc API}\label{fig:umljc} - \end{center} -\end{figure} - -The top-level data structure is \texttt{JavaClass}, which in most -cases is created by a \texttt{Class\-Par\-ser} object that is capable -of parsing binary class files. A \texttt{JavaClass} object basically -consists of fields, methods, symbolic references to the super class -and to the implemented interfaces. - -The \cp serves as some kind of central repository and is thus of -outstanding importance for all components. \texttt{ConstantPool} -objects contain an array of fixed size of \texttt{Constant} entries, -which may be retrieved via the \texttt{getConstant()} method taking an -integer index as argument. Indexes to the \cp may be contained in -instructions as well as in other components of a class file and in \cp -entries themselves. - -Methods and fields contain a signature, symbolically defining their -types. Access flags like \texttt{public static final} occur in -several places and are encoded by an integer bit mask, e.g. -\texttt{public static final} matches to the Java expression - -\begin{verbatim} - int access_flags = ACC_PUBLIC | ACC_STATIC | ACC_FINAL; -\end{verbatim} - -As mentioned in section \ref{sec:format} already, several components -may contain \emph{attribute} objects: classes, fields, methods, and -\texttt{Code} objects (introduced in section \ref{sec:code2}). The -latter is an attribute itself that contains the actual byte code -array, the maximum stack size, the number of local variables, a table -of handled exceptions, and some optional debugging information coded -as \texttt{LineNumberTable} and \texttt{LocalVariableTable} -attributes. Attributes are in general specific to some data structure, -i.e. no two components share the same kind of attribute, though this -is not explicitly forbidden. In the figure the \texttt{Attribute} -classes are marked with the component they belong to. - -\subsection{Class repository} - -Using the provided \texttt{Repository} class, reading class files into -a \texttt{JavaClass} object is quite simple: - -\begin{verbatim} - JavaClass clazz = Repository.lookupClass("java.lang.String"); -\end{verbatim} - -The repository also contains methods providing the dynamic equivalent -of the \texttt{instanceof} operator, and other useful routines: - -\begin{verbatim} - if(Repository.instanceOf(clazz, super_class) { - ... - } -\end{verbatim} - -\subsubsection{Accessing class file data} - -Information within the class file components may be accessed like Java -Beans via intuitive set/get methods. All of them also define a -\texttt{toString()} method so that implementing a simple class viewer -is very easy. In fact all of the examples used here have been produced -this way: - -{\small \begin{verbatim} - System.out.println(clazz); - printCode(clazz.getMethods()); - ... - public static void printCode(Method[] methods) { - for(int i=0; i < methods.length; i++) { - System.out.println(methods[i]); - - Code code = methods[i].getCode(); - if(code != null) // Non-abstract method - System.out.println(code); - } - } -\end{verbatim}} - -\subsubsection{Analyzing class data} - -Last but not least, \jc supports the \emph{Visitor} design -pattern \cite{design}, so one can write visitor objects to traverse -and analyze the contents of a class file. Included in the distribution -is a class \texttt{JasminVisitor} that converts class files into the -Jasmin assembler language \cite{jasmin}. - -\subsection{ClassGen}\label{sec:cgapi} - -This part of the API (package \path{ork.apache.bcel.generic}) supplies -an abstraction level for creating or transforming class files -dynamically. It makes the static constraints of Java class files like -the hard-coded byte code addresses generic. The generic \cpe, for -example, is implemented by the class \texttt{ConstantPoolGen} which -offers methods for adding different types of constants. Accordingly, -\texttt{ClassGen} offers an interface to add methods, fields, and -attributes. Figure \ref{fig:umlcg} gives an overview of this part of -the API. - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfysize0.93\textheight - \epsfbox{eps/classgen.eps} - \caption{UML diagram of the ClassGen API}\label{fig:umlcg} - \end{center} -\end{figure} - -\subsubsection{Types} - -We abstract from the concrete details of the type signature syntax -(see \ref{sec:types}) by introducing the \texttt{Type} class, which is -used, for example, by methods to define their return and argument -types. Concrete sub-classes are \texttt{BasicType}, -\texttt{ObjectType}, and \texttt{ArrayType} which consists of the -element type and the number of dimensions. For commonly used types the -class offers some predefined constants. For example the method -signature of the \texttt{main} method as shown in section -\ref{sec:types} is represented by: - -\begin{verbatim} - Type return_type = Type.VOID; - Type[] arg_types = new Type[] { new ArrayType(Type.STRING, 1) }; -\end{verbatim} - -\texttt{Type} also contains methods to convert types into textual -signatures and vice versa. The sub-classes contain implementations of -the routines and constraints specified by the Java Language -Specification \cite{gosling}. - -\subsubsection{Generic fields and methods} - -Fields are represented by \texttt{FieldGen} objects, which may be -freely modified by the user. If they have the access rights -\texttt{static final}, i.e. are constants and of basic type, they may -optionally have an initializing value. - -Generic methods contain methods to add exceptions the method may -throw, local variables, and exception handlers. The latter two are -represented by user-configurable objects as well. Because exception -handlers and local variables contain references to byte code -addresses, they also take the role of an \emph{instruction targeter} -in our terminology. Instruction targeters contain a method -\texttt{updateTarget()} to redirect a reference. Generic -(non-abstract) methods refer to \emph{instruction lists} that consist -of instruction objects. References to byte code addresses are -implemented by handles to instruction objects. This is explained in -more detail in the following sections. - -The maximum stack size needed by the method and the maximum number of -local variables used may be set manually or computed via the -\texttt{setMaxStack()} and \texttt{setMaxLocals()} methods -automatically. - -\subsubsection{Instructions} - -Modeling instructions as objects may look somewhat odd at first sight, -but in fact enables programmers to obtain a high-level view upon -control flow without handling details like concrete byte code offsets. -Instructions consist of a tag, i.e. an opcode, their length in bytes -and an offset (or index) within the byte code. Since many instructions -are immutable, the \texttt{InstructionConstants} interface offers -shareable predefined ``fly-weight'' constants to use. - -Instructions are grouped via sub-classing, the type hierarchy of -instruction classes is illustrated by (incomplete) figure -\ref{fig:umlinstr} in the appendix. The most important family of -instructions are the \emph{branch instructions}, e.g. \texttt{goto}, -that branch to targets somewhere within the byte code. Obviously, -this makes them candidates for playing an \texttt{InstructionTargeter} -role, too. Instructions are further grouped by the interfaces they -implement, there are, e.g., \texttt{TypedInstruction}s that are -associated with a specific type like \texttt{ldc}, or -\texttt{ExceptionThrower} instructions that may raise exceptions when -executed. - -All instructions can be traversed via \texttt{accept(Visitor v)} methods, -i.e., the Visitor design pattern. There is however some special trick -in these methods that allows to merge the handling of certain -instruction groups. The \texttt{accept()} do not only call the -corresponding \texttt{visit()} method, but call \texttt{visit()} -methods of their respective super classes and implemented interfaces -first, i.e. the most specific \texttt{visit()} call is last. Thus one -can group the handling of, say, all \texttt{BranchInstruction}s into -one single method. - -For debugging purposes it may even make sense to ``invent'' your own -instructions. In a sophisticated code generator like the one used as a -backend of the Barat framework \cite{barat} one often has to insert -temporary \texttt{nop} (No operation) instructions. When examining -the produced code it may be very difficult to track back where the -\texttt{nop} was actually inserted. One could think of a derived -\texttt{nop2} instruction that contains additional debugging -information. When the instruction list is dumped to byte code, the -extra data is simply dropped. - -One could also think of new byte code instructions operating on -complex numbers that are replaced by normal byte code upon load-time -or are recognized by a new JVM. - -\subsubsection{Instruction lists}\label{sec:il} - -An \emph{instruction list} is implemented by a list of -\emph{instruction handles} encapsulating instruction objects. -References to instructions in the list are thus not implemented by -direct pointers to instructions but by pointers to instruction -\emph{handles}. This makes appending, inserting and deleting areas of -code very simple. Since we use symbolic references, computation of -concrete byte code offsets does not need to occur until finalization, -i.e. until the user has finished the process of generating or -transforming code. We will use the term instruction handle and -instruction synonymously throughout the rest of the paper. -Instruction handles may contain additional user-defined data using the -\texttt{addAttribute()} method. - -\paragraph{Appending.} -One can append instructions or other instruction lists anywhere to an -existing list. The instructions are appended after the given -instruction handle. All append methods return a new instruction -handle which may then be used as the target of a branch instruction, -e.g.. - -{\small \begin{verbatim} - InstructionList il = new InstructionList(); - ... - GOTO g = new GOTO(null); - il.append(g); - ... - InstructionHandle ih = il.append(InstructionConstants.ACONST_NULL); - g.setTarget(ih); -\end{verbatim}} - -\paragraph{Inserting.} -Instructions may be inserted anywhere into an existing list. They are -inserted before the given instruction handle. All insert methods -return a new instruction handle which may then be used as the start -address of an exception handler, for example. - -{\small \begin{verbatim} - InstructionHandle start = il.insert(insertion_point, - InstructionConstants.NOP); - ... - mg.addExceptionHandler(start, end, handler, "java.io.IOException"); -\end{verbatim}} - - -\paragraph{Deleting.} -Deletion of instructions is also very straightforward; all instruction -handles and the contained instructions within a given range are -removed from the instruction list and disposed. The \texttt{delete()} -method may however throw a \texttt{TargetLostException} when there are -instruction targeters still referencing one of the deleted -instructions. The user is forced to handle such exceptions in a -\texttt{try-catch} block and redirect these references elsewhere. The -\emph{peep hole} optimizer described in section \ref{sec:nop} gives a -detailed example for this. - -{\small \begin{verbatim} - try { - il.delete(first, last); - } catch(TargetLostException e) { - InstructionHandle[] targets = e.getTargets(); - for(int i=0; i < targets.length; i++) { - InstructionTargeter[] targeters = targets[i].getTargeters(); - for(int j=0; j < targeters.length; j++) - targeters[j].updateTarget(targets[i], new_target); - } - } -\end{verbatim}} - -\paragraph{Finalizing.} -When the instruction list is ready to be dumped to pure byte code, all -symbolic references must be mapped to real byte code offsets. This is -done by the \texttt{getByteCode()} method which is called by default -by \texttt{MethodGen.getMethod()}. Afterwards you should call -\texttt{dispose()} so that the instruction handles can be reused -internally. This helps to reduce memory usage. - -\begin{verbatim} - InstructionList il = new InstructionList(); - - ClassGen cg = new ClassGen("HelloWorld", "java.lang.Object", - "<generated>", ACC_PUBLIC | ACC_SUPER, - null); - MethodGen mg = new MethodGen(ACC_STATIC | ACC_PUBLIC, - Type.VOID, new Type[] { - new ArrayType(Type.STRING, 1) - }, new String[] { "argv" }, - "main", "HelloWorld", il, cp); - ... - cg.addMethod(mg.getMethod()); - il.dispose(); // Reuse instruction handles of list -\end{verbatim} - -\subsubsection{Code example revisited} - -Using instruction lists gives us a generic view upon the code: In -Figure \ref{fig:il} we again present the code chunk of the -\texttt{readInt()} method of the faculty example in section -\ref{sec:fac}: The local variables \texttt{n} and \texttt{e1} both -hold two references to instructions, defining their scope. There are -two \texttt{goto}s branching to the \texttt{iload} at the end of the -method. One of the exception handlers is displayed, too: it references -the start and the end of the \texttt{try} block and also the exception -handler code. - -\begin{figure}[htbp] - \begin{center} - \leavevmode - \epsfxsize\textwidth - \epsfbox{eps/il.eps} - \caption{Instruction list for \texttt{readInt()} method} - \label{fig:il} - \end{center} -\end{figure} - -\subsubsection{Instruction factories}\label{sec:compound} - -To simplify the creation of certain instructions the user can use the -supplied \texttt{InstructionFactory} class which offers a lot of -useful methods to create instructions from scratch. Alternatively, he -can also use \emph{compound instructions}: When producing byte code, -some patterns typically occur very frequently, for instance the -compilation of arithmetic or comparison expressions. You certainly do -not want to rewrite the code that translates such expressions into -byte code in every place they may appear. In order to support this, -the \jc API includes a \emph{compound instruction} (an interface with -a single \texttt{getInstructionList()} method). Instances of this -class may be used in any place where normal instructions would occur, -particularly in append operations. - -\paragraph{Example: Pushing constants.} -Pushing constants onto the operand stack may be coded in different -ways. As explained in section \ref{sec:code} there are some -``short-cut'' instructions that can be used to make the produced byte -code more compact. The smallest instruction to push a single -\texttt{1} onto the stack is \texttt{iconst\_1}, other possibilities -are \texttt{bipush} (can be used to push values between -128 and 127), -\texttt{sipush} (between -32768 and 32767), or \texttt{ldc} (load -constant from \cpe). - -Instead of repeatedly selecting the most compact instruction in, say, -a switch, one can use the compound \texttt{PUSH} instruction whenever -pushing a constant number or string. It will produce the appropriate -byte code instruction and insert entries into to \cp if necessary. - -\begin{verbatim} - il.append(new PUSH(cp, "Hello, world")); - il.append(new PUSH(cp, 4711)); -\end{verbatim} - -\subsubsection{Code patterns using regular expressions}\label{sec:peephole} - -When transforming code, for instance during optimization or when -inserting analysis method calls, one typically searches for certain -patterns of code to perform the transformation at. To simplify -handling such situations \jc introduces a special feature: One can -search for given code patterns within an instruction list using -\emph{regular expressions}. In such expressions, instructions are -represented by symbolic names, e.g. "\texttt{`IfInstruction'}". Meta -characters like \verb|+|, \verb|*|, and \verb@(..|..)@ have their -usual meanings. Thus, the expression - -\begin{verbatim} - "`NOP'+(`ILOAD__'|`ALOAD__')*" -\end{verbatim} - -represents a piece of code consisting of at least one \texttt{NOP} -followed by a possibly empty sequence of \texttt{ILOAD} and -\texttt{ALOAD} instructions. - -The \texttt{search()} method of class \texttt{FindPattern} gets an -instruction list and a regular expression as arguments and returns an -array describing the area of matched instructions. Additional -constraints to the matching area of instructions, which can not be -implemented via regular expressions, may be expressed via \emph{code -constraints}. - -\subsubsection{Example: Optimizing boolean expressions.} - -In Java, boolean values are mapped to 1 and to 0, respectively. Thus, -the simplest way to evaluate boolean expressions is to push a 1 or a 0 -onto the operand stack depending on the truth value of the expression. -But this way, the subsequent combination of boolean expressions (with -\verb|&&|, e.g) yields long chunks of code that push lots of 1s and -0s onto the stack. - -When the code has been finalized these chunks can be optimized with a -\emph{peep hole} algorithm: An \texttt{IfInstruction} (e.g. the -comparison of two integers: \texttt{if\_icmpeq}) that either produces -a 1 or a 0 on the stack and is followed by an \texttt{ifne} -instruction (branch if stack value $\neq$ 0) may be replaced by the -\texttt{IfInstruction} with its branch target replaced by the target -of the \texttt{ifne} instruction: - -{\small \verbatimtabinput{bool.java}} - -The applied code constraint object ensures that the matched code -really corresponds to the targeted expression pattern. Subsequent -application of this algorithm removes all unnecessary stack operations -and branch instructions from the byte code. If any of the deleted -instructions is still referenced by an \texttt{InstructionTargeter} -object, the reference has to be updated in the \texttt{catch}-clause. - -Code example \ref{sec:hello} gives a verbose example of how to create -a class file, while example \ref{sec:nop} shows how to implement a -simple peephole optimizer and how to deal with \texttt{TargetLost} -exceptions. - -\paragraph{Example application:} -The expression - -\begin{verbatim} - if((a == null) || (i < 2)) - System.out.println("Ooops"); -\end{verbatim} - -can be mapped to both of the chunks of byte code shown in figure -\ref{fig:code}. The left column represents the unoptimized code while -the right column displays the same code after an aggressively -optimizing peep hole algorithm has been applied: - -\begin{figure}[hpt] -\begin{minipage}{0.49\textwidth} - {\small \verbatimtabinput{unopt}} \vfil -\end{minipage} -\begin{minipage}{0.49\textwidth} - {\small \verbatimtabinput{opt}} \vfil -\end{minipage}\label{fig:code}\caption{Optimizing boolean expressions} -\begin{center} - - -\end{center} -\end{figure} -\section{Application areas}\label{sec:application} - -There are many possible application areas for \jc ranging from class -browsers, profilers, byte code optimizers, and compilers to -sophisticated run-time analysis tools and extensions to the Java -language \cite{agesen, myers}. - -Compilers like the Barat compiler \cite{barat} use \jc to implement a -byte code generating back end. Other possible application areas are -the static analysis of byte code \cite{thies} or examining the -run-time behavior of classes by inserting calls to profiling methods -into the code. Further examples are extending Java with Eiffel-like -assertions \cite{jawa}, automated delegation \cite{classfilters}, or -with the concepts of ``Aspect-Oriented Programming'' \cite{aspect}. - -\subsection{Class loaders}\label{sec:classloaders} - -Class loaders are responsible for loading class files from the file -system or other resources and passing the byte code to the \vm -\cite{classloader}. A custom \texttt{ClassLoader} object may be used -to intercept the standard procedure of loading a class, i.e. the -system class loader, and perform some transformations before actually -passing the byte code to the JVM. - -A possible scenario is described in figure \ref{fig:classloader}: -During run-time the \vm requests a custom class loader to load a given -class. But before the JVM actually sees the byte code, the class -loader makes a ``side-step'' and performs some transformation to the -class. To make sure that the modified byte code is still valid and -does not violate any of the JVM's rules it is checked by the verifier -before the JVM finally executes it. - -\begin{figure}[ht] - \begin{center} - \leavevmode - \epsfxsize\textwidth - \epsfbox{eps/classloader.eps} - \caption{Class loaders}\label{fig:classloader} - \end{center} -\end{figure} - -Using class loaders is an elegant way of extending the \jvm with new -features without actually modifying it. This concept enables -developers to use \emph{load-time reflection} to implement their ideas -as opposed to the static reflection supported by the Java Reflection -API \cite{reflection}. Load-time transformations supply the user with -a new level of abstraction. He is not strictly tied to the static -constraints of the original authors of the classes but may customize -the applications with third-party code in order to benefit from new -features. Such transformations may be executed on demand and neither -interfere with other users, nor alter the original byte code. In fact, -class loaders may even create classes \emph{ad hoc} without loading a -file at all. - -\subsubsection{Example: Poor Man's Genericity} - -The ``Poor Man's Genericity'' project \cite{pmg} that extends Java -with parameterized classes, for example, uses \jc in two places to -generate instances of parameterized classes: During compile-time (the -standard \texttt{javac} with some slightly changed classes) and at -run-time using a custom class loader. The compiler puts some -additional type information into class files which is evaluated at -load-time by the class loader. The class loader performs some -transformations on the loaded class and passes them to the VM. The -following algorithm illustrates how the load method of the class -loader fulfills the request for a parameterized class, -e.g. \verb|Stack<String>| - -\begin{enumerate} -\item Search for class \texttt{Stack}, load it, and check for a -certain class attribute containing additional type information. I.e. -the attribute defines the ``real'' name of the class, -i.e. \verb|Stack<A>|. - -\item Replace all occurrences and references to the formal type -\texttt{A} with references to the actual type \texttt{String}. For -example the method - -\begin{verbatim} - void push(A obj) { ... } -\end{verbatim} - -becomes - -\begin{verbatim} - void push(String obj) { ... } -\end{verbatim} - -\item Return the resulting class to the Virtual Machine. -\end{enumerate} - -\bibliographystyle{alpha}\bibliography{manual} - -\newpage\appendix - -\pagestyle{empty} -\include{appendix} -\include{diagrams} - -\end{document} -% LocalWords: Freie Universit Institut Informatik dahm inf fu berlin de JOIE -% LocalWords: JCF HelloWorld Jasmin Eiffel SourceFile classfile lang io ldc ar -% LocalWords: PrintStream invokevirtual MethodRef ConstantClass Fieldref dup -% LocalWords: iconst bipush iadd cmpeq jsr athrow iload istore iastore er ic -% LocalWords: getfield putfield getstatic putstatic invokestatic newarray nop -% LocalWords: anewarray checkcast instanceof lookupswitch tableswitch Barat VM -% LocalWords: ConstantPool getConstant LineNumberTable LocalvariableTable ifne -% LocalWords: invokesta invokespecial multianewarray ConstantPoolGen MethodGen -% LocalWords: BasicType ObjectType ArrayType InstructionTarge getByteCode bool -% LocalWords: BranchInstruction InstructionTargeter InstructionHandle regex -% LocalWords: TargetLostException codeconstraint CompoundInstruction sipush -% LocalWords: getInstructionList FindPattern CodeConstraint IfInstruction fac -% LocalWords: TargetLost javac readLine IOException parseInt readInt CLASSPATH -% LocalWords: NumberFormatException toString JasminVisitor getSignature JVM's -% LocalWords: FieldGen updateTarget LGPL BCEL LocalVariableTable setMaxStack -% LocalWords: setMaxLocals InstructionConstants TypedInstruction addAttribute -% LocalWords: ExceptionThrower getMethod InstructionFactory ALOAD - diff --git a/docs/opt b/docs/opt deleted file mode 100644 index fd57764f..00000000 --- a/docs/opt +++ /dev/null @@ -1,24 +0,0 @@ -10: aload_0 -11: ifnull #19 -14: iload_1 -15: iconst_2 -16: if_icmpge #27 -19: getstatic System.out -22: ldc "Ooops" -24: invokevirtual println -27: return - - - - - - - - - - - - - - - diff --git a/docs/unopt b/docs/unopt deleted file mode 100644 index c458bf40..00000000 --- a/docs/unopt +++ /dev/null @@ -1,24 +0,0 @@ -5: aload_0 -6: ifnull #13 -9: iconst_0 -10: goto #14 -13: iconst_1 -14: nop -15: ifne #36 -18: iload_1 -19: iconst_2 -20: if_icmplt #27 -23: iconst_0 -24: goto #28 -27: iconst_1 -28: nop -29: ifne #36 -32: iconst_0 -33: goto #37 -36: iconst_1 -37: nop -38: ifeq #52 -41: getstatic System.out -44: ldc "Ooops" -46: invokevirtual println -52: return |