am 8eeeefc: Merge change 891 into donut
Merge commit '8eeeefccffb5e06107cd444436cc229f282a2b72'
* commit '8eeeefccffb5e06107cd444436cc229f282a2b72':
Corrected behavior of Constructor.newInstance on abstract classes.
diff --git a/README.txt b/README.txt
index 6955945..a7dd7da 100644
--- a/README.txt
+++ b/README.txt
@@ -1,5 +1,5 @@
-This directory contains the Dalvik virtual machine and associated
-class library.
+This directory contains the Dalvik virtual machine and core class library,
+as well as related tools, libraries, and tests.
A note about the licenses and header comments
---------------------------------------------
diff --git a/dalvikvm/Main.c b/dalvikvm/Main.c
index 70cc61f..a6439fb 100644
--- a/dalvikvm/Main.c
+++ b/dalvikvm/Main.c
@@ -115,7 +115,7 @@
}
getModifiersId = (*env)->GetMethodID(env, methodClass,
"getModifiers", "()I");
- if (methodClass == NULL) {
+ if (getModifiersId == NULL) {
fprintf(stderr, "Dalvik VM unable to find reflect.Method.getModifiers\n");
goto bail;
}
diff --git a/dexdump/DexDump.c b/dexdump/DexDump.c
index a4d97eb..bd91236 100644
--- a/dexdump/DexDump.c
+++ b/dexdump/DexDump.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* The "dexdump" tool is intended to mimic "objdump". When possible, use
* similar command-line arguments.
@@ -45,9 +46,12 @@
/* command-line options */
struct {
+ bool checksumOnly;
bool disassemble;
bool showFileHeaders;
bool showSectionHeaders;
+ bool ignoreBadChecksum;
+ bool dumpRegisterMaps;
const char* tempFileName;
} gOptions;
@@ -67,6 +71,14 @@
}
/*
+ * Get 4 little-endian bytes.
+ */
+static inline u4 get4LE(unsigned char const* pSrc)
+{
+ return pSrc[0] | (pSrc[1] << 8) | (pSrc[2] << 16) | (pSrc[3] << 24);
+}
+
+/*
* Return a newly-allocated string for the "dot version" of the class
* name for the given type descriptor. That is, The initial "L" and
* final ";" (if any) have been removed and all occurrences of '/'
@@ -465,10 +477,6 @@
void dumpInstruction(DexFile* pDexFile, const DexCode* pCode, int insnIdx,
int insnWidth, const DecodedInstruction* pDecInsn)
{
- static const float gSpecialTab[16] = {
- -2.0f, -1.0f, -0.5f, -0.25f, -0.1f, 0.1f, 0.25f, 0.5f,
- 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 10.0f, 100.0f, 1000.0f
- };
const u2* insns = pCode->insns;
int i;
@@ -958,6 +966,8 @@
/*
* Dump the class.
+ *
+ * Note "idx" is a DexClassDef index, not a DexTypeId index.
*/
void dumpClass(DexFile* pDexFile, int idx)
{
@@ -1039,6 +1049,208 @@
free(accessStr);
}
+
+/*
+ * Advance "ptr" to ensure 32-bit alignment.
+ */
+static inline const u1* align32(const u1* ptr)
+{
+ return (u1*) (((int) ptr + 3) & ~0x03);
+}
+
+
+/*
+ * Dump a map in the "differential" format.
+ *
+ * TODO: show a hex dump of the compressed data. (We can show the
+ * uncompressed data if we move the compression code to libdex; otherwise
+ * it's too complex to merit a fast & fragile implementation here.)
+ */
+void dumpDifferentialCompressedMap(const u1** pData)
+{
+ const u1* data = *pData;
+ const u1* dataStart = data -1; // format byte already removed
+ u1 regWidth;
+ u2 numEntries;
+
+ /* standard header */
+ regWidth = *data++;
+ numEntries = *data++;
+ numEntries |= (*data++) << 8;
+
+ /* compressed data begins with the compressed data length */
+ int compressedLen = readUnsignedLeb128(&data);
+ int addrWidth = 1;
+ if ((*data & 0x80) != 0)
+ addrWidth++;
+
+ int origLen = 4 + (addrWidth + regWidth) * numEntries;
+ int compLen = (data - dataStart) + compressedLen;
+
+ printf(" (differential compression %d -> %d [%d -> %d])\n",
+ origLen, compLen,
+ (addrWidth + regWidth) * numEntries, compressedLen);
+
+ /* skip past end of entry */
+ data += compressedLen;
+
+ *pData = data;
+}
+
+/*
+ * Dump register map contents of the current method.
+ *
+ * "*pData" should point to the start of the register map data. Advances
+ * "*pData" to the start of the next map.
+ */
+void dumpMethodMap(DexFile* pDexFile, const DexMethod* pDexMethod, int idx,
+ const u1** pData)
+{
+ const u1* data = *pData;
+ const DexMethodId* pMethodId;
+ const char* name;
+ int offset = data - (u1*) pDexFile->pOptHeader;
+
+ pMethodId = dexGetMethodId(pDexFile, pDexMethod->methodIdx);
+ name = dexStringById(pDexFile, pMethodId->nameIdx);
+ printf(" #%d: 0x%08x %s\n", idx, offset, name);
+
+ u1 format;
+ int addrWidth;
+
+ format = *data++;
+ if (format == 1) { /* kRegMapFormatNone */
+ /* no map */
+ printf(" (no map)\n");
+ addrWidth = 0;
+ } else if (format == 2) { /* kRegMapFormatCompact8 */
+ addrWidth = 1;
+ } else if (format == 3) { /* kRegMapFormatCompact16 */
+ addrWidth = 2;
+ } else if (format == 4) { /* kRegMapFormatDifferential */
+ dumpDifferentialCompressedMap(&data);
+ goto bail;
+ } else {
+ printf(" (unknown format %d!)\n", format);
+ /* don't know how to skip data; failure will cascade to end of class */
+ goto bail;
+ }
+
+ if (addrWidth > 0) {
+ u1 regWidth;
+ u2 numEntries;
+ int idx, addr, byte;
+
+ regWidth = *data++;
+ numEntries = *data++;
+ numEntries |= (*data++) << 8;
+
+ for (idx = 0; idx < numEntries; idx++) {
+ addr = *data++;
+ if (addrWidth > 1)
+ addr |= (*data++) << 8;
+
+ printf(" %4x:", addr);
+ for (byte = 0; byte < regWidth; byte++) {
+ printf(" %02x", *data++);
+ }
+ printf("\n");
+ }
+ }
+
+bail:
+ //if (addrWidth >= 0)
+ // *pData = align32(data);
+ *pData = data;
+}
+
+/*
+ * Dump the contents of the register map area.
+ *
+ * These are only present in optimized DEX files, and the structure is
+ * not really exposed to other parts of the VM itself. We're going to
+ * dig through them here, but this is pretty fragile. DO NOT rely on
+ * this or derive other code from it.
+ */
+void dumpRegisterMaps(DexFile* pDexFile)
+{
+ const u1* pClassPool = pDexFile->pRegisterMapPool;
+ const u4* classOffsets;
+ const u1* ptr;
+ u4 numClasses;
+ int baseFileOffset = (u1*) pClassPool - (u1*) pDexFile->pOptHeader;
+ int idx;
+
+ if (pClassPool == NULL) {
+ printf("No register maps found\n");
+ return;
+ }
+
+ ptr = pClassPool;
+ numClasses = get4LE(ptr);
+ ptr += sizeof(u4);
+ classOffsets = (const u4*) ptr;
+
+ printf("RMAP begins at offset 0x%07x\n", baseFileOffset);
+ printf("Maps for %d classes\n", numClasses);
+ for (idx = 0; idx < (int) numClasses; idx++) {
+ const DexClassDef* pClassDef;
+ const char* classDescriptor;
+
+ pClassDef = dexGetClassDef(pDexFile, idx);
+ classDescriptor = dexStringByTypeIdx(pDexFile, pClassDef->classIdx);
+
+ printf("%4d: +%d (0x%08x) %s\n", idx, classOffsets[idx],
+ baseFileOffset + classOffsets[idx], classDescriptor);
+
+ if (classOffsets[idx] == 0)
+ continue;
+
+ /*
+ * What follows is a series of RegisterMap entries, one for every
+ * direct method, then one for every virtual method.
+ */
+ DexClassData* pClassData;
+ const u1* pEncodedData;
+ const u1* data = (u1*) pClassPool + classOffsets[idx];
+ u2 methodCount;
+ int i;
+
+ pEncodedData = dexGetClassData(pDexFile, pClassDef);
+ pClassData = dexReadAndVerifyClassData(&pEncodedData, NULL);
+ if (pClassData == NULL) {
+ fprintf(stderr, "Trouble reading class data\n");
+ continue;
+ }
+
+ methodCount = *data++;
+ methodCount |= (*data++) << 8;
+ data += 2; /* two pad bytes follow methodCount */
+ if (methodCount != pClassData->header.directMethodsSize
+ + pClassData->header.virtualMethodsSize)
+ {
+ printf("NOTE: method count discrepancy (%d != %d + %d)\n",
+ methodCount, pClassData->header.directMethodsSize,
+ pClassData->header.virtualMethodsSize);
+ /* this is bad, but keep going anyway */
+ }
+
+ printf(" direct methods: %d\n",
+ pClassData->header.directMethodsSize);
+ for (i = 0; i < (int) pClassData->header.directMethodsSize; i++) {
+ dumpMethodMap(pDexFile, &pClassData->directMethods[i], i, &data);
+ }
+
+ printf(" virtual methods: %d\n",
+ pClassData->header.virtualMethodsSize);
+ for (i = 0; i < (int) pClassData->header.virtualMethodsSize; i++) {
+ dumpMethodMap(pDexFile, &pClassData->virtualMethods[i], i, &data);
+ }
+
+ free(pClassData);
+ }
+}
+
/*
* Dump the requested sections of the file.
*/
@@ -1049,6 +1261,11 @@
printf("Opened '%s', DEX version '%.3s'\n", fileName,
pDexFile->pHeader->magic +4);
+ if (gOptions.dumpRegisterMaps) {
+ dumpRegisterMaps(pDexFile);
+ return;
+ }
+
if (gOptions.showFileHeaders)
dumpFileHeader(pDexFile);
@@ -1077,14 +1294,21 @@
goto bail;
mapped = true;
- pDexFile = dexFileParse(map.addr, map.length,
- kDexParseVerifyChecksum | kDexParseContinueOnError);
+ int flags = kDexParseVerifyChecksum;
+ if (gOptions.ignoreBadChecksum)
+ flags |= kDexParseContinueOnError;
+
+ pDexFile = dexFileParse(map.addr, map.length, flags);
if (pDexFile == NULL) {
fprintf(stderr, "ERROR: DEX parse failed\n");
goto bail;
}
- processDexFile(fileName, pDexFile);
+ if (gOptions.checksumOnly) {
+ printf("Checksum verified\n");
+ } else {
+ processDexFile(fileName, pDexFile);
+ }
result = 0;
@@ -1103,11 +1327,16 @@
void usage(void)
{
fprintf(stderr, "Copyright (C) 2007 The Android Open Source Project\n\n");
- fprintf(stderr, "%s: [-d] [-f] [-h] [-t tempfile] dexfile...\n", gProgName);
+ fprintf(stderr,
+ "%s: [-c] [-d] [-f] [-h] [-m] [-i] [-t tempfile] dexfile...\n",
+ gProgName);
fprintf(stderr, "\n");
+ fprintf(stderr, " -c : verify checksum and exit\n");
fprintf(stderr, " -d : disassemble code sections\n");
fprintf(stderr, " -f : display summary information from file header\n");
fprintf(stderr, " -h : display file header details\n");
+ fprintf(stderr, " -i : ignore checksum failures\n");
+ fprintf(stderr, " -m : dump register maps (and nothing else)\n");
fprintf(stderr, " -t : temp file name (defaults to /sdcard/dex-temp-*)\n");
}
@@ -1124,11 +1353,14 @@
memset(&gOptions, 0, sizeof(gOptions));
while (1) {
- ic = getopt(argc, argv, "dfht:");
+ ic = getopt(argc, argv, "cdfhimt:");
if (ic < 0)
break;
switch (ic) {
+ case 'c': // verify the checksum then exit
+ gOptions.checksumOnly = true;
+ break;
case 'd': // disassemble Dalvik instructions
gOptions.disassemble = true;
break;
@@ -1138,6 +1370,12 @@
case 'h': // dump section headers, i.e. all meta-data
gOptions.showSectionHeaders = true;
break;
+ case 'i': // continue even if checksum is bad
+ gOptions.ignoreBadChecksum = true;
+ break;
+ case 'm': // dump register maps only
+ gOptions.dumpRegisterMaps = true;
+ break;
case 't': // temp file, used when opening compressed Jar
gOptions.tempFileName = argv[optind];
break;
@@ -1152,6 +1390,11 @@
wantUsage = true;
}
+ if (gOptions.checksumOnly && gOptions.ignoreBadChecksum) {
+ fprintf(stderr, "Can't specify both -c and -i\n");
+ wantUsage = true;
+ }
+
/* initialize some VM tables */
gInstrWidth = dexCreateInstrWidthTable();
gInstrFormat = dexCreateInstrFormatTable();
@@ -1161,11 +1404,14 @@
return 2;
}
- while (optind < argc)
- process(argv[optind++]);
+ int result = 0;
+ while (optind < argc) {
+ result |= process(argv[optind++]);
+ }
free(gInstrWidth);
free(gInstrFormat);
- return 0;
+ return (result != 0);
}
+
diff --git a/docs/debugger.html b/docs/debugger.html
index 6e23f0d..7d93caf 100644
--- a/docs/debugger.html
+++ b/docs/debugger.html
@@ -202,6 +202,40 @@
to a program that throws lots of exceptions can result in out-of-memory
errors. This will be fixed in a future release.
</p><p>
+
+</p><p>
+The translation from Java bytecode to Dalvik bytecode may result in
+identical sequences of instructions being combined. This can make it
+look like the wrong bit of code is being executed. For example:
+<pre> int test(int i) {
+ if (i == 1) {
+ return 0;
+ }
+ return 1;
+ }</pre>
+The Dalvik bytecode uses a common <code>return</code> instruction for both
+<code>return</code> statements, so when <code>i</code> is 1 the debugger
+will single-step through <code>return 0</code> and then <code>return 1</code>.
+</p><p>
+
+</p><p>
+Dalvik handles synchronized methods differently from other VMs.
+Instead of marking a method as <code>synchronized</code> and expecting
+the VM to handle the locks, <code>dx</code> inserts a "lock"
+instruction at the top of the method and an "unlock" instruction in a
+synthetic <code>finally</code> block. As a result, when single-stepping
+a <code>return</code> statement, the "current line" cursor may jump to
+the last line in the method.
+</p><p>
+This can also affect the way the debugger processes exceptions. The
+debugger may decide to break on an
+exception based on whether that exception is "caught" or "uncaught". To
+be considered uncaught, there must be no matching <code>catch</code> block
+or <code>finally</code> clause between the current point of execution and
+the top of the thread. An exception thrown within or below a synchronized
+method will always be considered "caught", so the debugger won't stop
+until the exception is re-thrown from the synthetic <code>finally</code> block.
+</p><p>
<address>Copyright © 2009 The Android Open Source Project</address>
diff --git a/docs/embedded-vm-control.html b/docs/embedded-vm-control.html
index f90f0e5..28b19f6 100644
--- a/docs/embedded-vm-control.html
+++ b/docs/embedded-vm-control.html
@@ -15,6 +15,7 @@
<li><a href="#execmode">Execution Mode</a>
<li><a href="#dp">Deadlock Prediction</a>
<li><a href="#stackdump">Stack Dumps</a>
+ <li><a href="#dexcheck">DEX File Checksums</a>
</ul>
<h2><a name="overview">Overview</a></h2>
@@ -235,6 +236,35 @@
<p>If the property is not defined, the VM will write the stack traces to
the Android log when the signal arrives.
+
+<h2><a name="dexcheck">DEX File Checksums</a></h2>
+
+<p>For performance reasons, the checksum on "optimized" DEX files is
+ignored. This is usually safe, because the files are generated on the
+device, and have access permissions that prevent modification.
+
+<p>If the storage on a device becomes unreliable, however, data corruption
+can occur. This usually manifests itself as a repeatable virtual machine
+crash. To speed diagnosis of such failures, the VM provides the
+<code>-Xcheckdexsum</code> argument. When set, the checksums on all DEX
+files are verified before the contents are used.
+
+<p>The application framework will provide this argument during VM
+creation if the <code>dalvik.vm.check-dex-sum</code> property is enabled.
+
+<p>To enable extended DEX checksum verification:
+<pre>adb shell setprop dalvik.vm.check-dex-sum true</pre>
+
+<p>Incorrect checksums will prevent the DEX data from being used, and will
+cause errors to be written to the log file. If a device has a history of
+problems it may be useful to add the property to
+<code>/data/local.prop</code>.
+
+<p>Note also that the
+<code>dexdump</code> tool always verifies DEX checksums, and can be used
+to check for corruption in a large set of files.
+
+
<address>Copyright © 2008 The Android Open Source Project</address>
</body></html>
diff --git a/docs/heap-profiling.html b/docs/heap-profiling.html
new file mode 100644
index 0000000..0a6ce5c
--- /dev/null
+++ b/docs/heap-profiling.html
@@ -0,0 +1,164 @@
+<html>
+<head>
+ <title>Dalvik Heap Profiling</title>
+</head>
+
+<body>
+<h1>Dalvik Heap Profiling</h1>
+
+<p>
+The Dalvik virtual machine can produce a complete dump of the contents
+of the virtual heap. This is very useful for debugging memory usage
+and looking for memory leaks. Getting at the information can be tricky,
+but has become easier in recent releases.
+
+
+<h2>Getting the data</h2>
+<p>
+The first step is to cause the VM to dump its status, and then pull the hprof
+data off. The exact manner for doing so has changed over time.
+</p><p>
+There is a <code>runhat</code> shell function, added by
+<code>build/envsetup.sh</code>, that partially automates these steps. The
+function changes in each release to accommodate newer behavior, so you have
+to be careful that you don't use the wrong version.
+</p><p>
+
+<h3>Early releases (1.0/1.1)</h3>
+<p>
+You can only generate heap data on the emulator or a device with root
+access, because of the way the dump is initiated and where the output
+files go.
+</p><p>
+Get a command shell on the device:
+<blockquote><pre>
+$ adb shell
+</pre></blockquote>
+</p><p>
+You can verify that you're running as root with the <code>id</code> command.
+The response should look like <code>uid=0(root) gid=0(root)</code>. If not,
+type <code>su</code> and try again. If <code>su</code> fails, you're out
+of luck.
+
+</p><p>
+Next, ensure the target directory exists:
+<blockquote><pre>
+# mkdir /data/misc
+# chmod 777 /data/misc
+</pre></blockquote>
+
+</p><p>
+Use <code>ps</code> or DDMS to determine the process ID of your application,
+then send a <code>SIGUSR1</code> to the target process:
+
+<blockquote><pre>
+# kill -10 <pid>
+</pre></blockquote>
+
+</p><p>
+The signal causes a GC, followed by the heap dump (to be completely
+accurate, they actually happen concurrently, but the results in the heap
+dump reflect the post-GC state). This can take a couple of seconds,
+so you have to watch for the GC log message to know when it's complete.
+</p><p>
+Next:
+
+<blockquote><pre>
+# ls /data/misc/heap-dump*
+# exit
+</pre></blockquote>
+
+</p><p>
+Use <code>ls</code> to check the file names, then <code>exit</code> to quit
+the device command shell.
+
+</p><p>
+You should see two output files, named
+<code>/data/misc/heap-dump-BLAH-BLAH.hprof</code> and
+<code>.hprof-head</code>, where BLAH is a runtime-generated value
+that ensures the filename is unique. Pull them off of the device and
+remove the device-side copy:
+
+<blockquote><pre>
+$ adb pull /data/misc/heap-dump-BLAH-BLAH.hprof tail.hprof
+$ adb pull /data/misc/heap-dump-BLAH-BLAH.hprof-head head.hprof
+$ adb shell rm /data/misc/heap-dump-BLAH-BLAH.hprof /data/misc/heap-dump-BLAH-BLAH.hprof-head
+</pre></blockquote>
+
+</p><p>
+Merge them together and remove the intermediates:
+
+<blockquote><pre>
+$ cat head.hprof tail.hprof > dump.hprof
+$ rm head.hprof tail.hprof
+</pre></blockquote>
+
+</p><p>
+You now have the hprof dump in <code>dump.hprof</code>.
+
+</p><p>
+
+
+<h3>"Cupcake" release (1.5)</h3>
+<p>
+Some steps were taken to make this simpler. Notably, the two output
+files are now combined for you, and a new API call was added that allows
+a program to write the dump at will to a specific file. If you're not
+using the API call, you still need to be on an emulator or running as root.
+(For some builds, you can use <code>adb root</code> to restart the adb
+daemon as root.)
+</p><p>
+The basic procedure is the same as for 1.0/1.1, but only one file will
+appear in <code>/data/misc</code> (no <code>-head</code>), and upon
+completion you will see a log message that says "hprof: heap dump completed".
+It looks like this in the log:
+
+<blockquote><pre>
+I/dalvikvm( 289): threadid=7: reacting to signal 10
+I/dalvikvm( 289): SIGUSR1 forcing GC and HPROF dump
+I/dalvikvm( 289): hprof: dumping VM heap to "/data/misc/heap-dump-tm1240861355-pid289.hprof-hptemp".
+I/dalvikvm( 289): hprof: dumping heap strings to "/data/misc/heap-dump-tm1240861355-pid289.hprof".
+I/dalvikvm( 289): hprof: heap dump completed, temp file removed
+</pre></blockquote>
+
+</p><p>
+Summary: as above, use <code>mkdir</code> and <code>chmod</code>
+to ensure the directory exists and is writable by your application.
+Send the <code>SIGUSR1</code> or use the API call to initiate a dump.
+Use <code>adb pull <dump-file></code> and <code>adb shell rm
+<dump-file></code> to retrieve the file and remove it from the
+device. The concatenation step is not needed.
+
+</p><p>
+The new API is in the <code>android.os.Debug</code> class:
+<blockquote><pre>
+public static void dumpHprofData(String fileName) throws IOException
+</pre></blockquote>
+When called, the VM will go through the same series of steps (GC and
+generate a .hprof file), but the output will be written to a file of
+your choice, e.g. <code>/sdcard/myapp.hprof</code>. Because you're
+initiating the action from within the app, and can write the file to
+removable storage or the app's private data area, you can do this on a
+device without root access.
+
+
+<h2>Examining the data</h2>
+<p>
+The data file format was augmented slightly from the common hprof format,
+and due to licensing restrictions the modified <code>hat</code> tool cannot
+be distributed. A conversion tool, <code>hprof-conv</code>, can be used
+to strip the Android-specific portions from the output. This tool was
+first included in 1.5, but will work with older versions of Android.
+</p><p>
+The converted output should work with any hprof data analyzer, including
+<code>jhat</code>, which is available for free in the Sun JDK, and
+Eclipse MAT.
+
+<!-- say something about how to track down common problems, interesting
+ things to look for, ...? -->
+
+</p><p>
+<address>Copyright © 2009 The Android Open Source Project</address>
+
+</body>
+</html>
diff --git a/docs/hello-world.html b/docs/hello-world.html
new file mode 100644
index 0000000..690c213
--- /dev/null
+++ b/docs/hello-world.html
@@ -0,0 +1,169 @@
+<html>
+<head>
+ <title>Basic Dalvik VM Invocation</title>
+</head>
+
+<body>
+<h1>Basic Dalvik VM Invocation</h1>
+
+<p>
+On an Android device, the Dalvik virtual machine usually executes embedded
+in the Android application framework. It's also possible to run it directly,
+just as you would a virtual machine on your desktop system.
+</p><p>
+After compiling your Java language sources, convert and combine the .class
+files into a DEX file, and push that to the device. Here's a simple example:
+
+</p><p><code>
+% <font color="green">echo 'class Foo {'\</font><br>
+> <font color="green">'public static void main(String[] args) {'\</font><br>
+> <font color="green">'System.out.println("Hello, world"); }}' > Foo.java</font><br>
+% <font color="green">javac Foo.java</font><br>
+% <font color="green">dx --dex --output=foo.jar Foo.class</font><br>
+% <font color="green">adb push foo.jar /sdcard</font><br>
+% <font color="green">adb shell dalvikvm -cp /sdcard/foo.jar Foo</font><br>
+Hello, world
+</code>
+</p><p>
+The <code>-cp</code> option sets the classpath. The initial directory
+for <code>adb shell</code> may not be what you expect it to be, so it's
+usually best to specify absolute pathnames.
+
+</p><p>
+The <code>dx</code> command accepts lists of individual class files,
+directories, or Jar archives. When the <code>--output</code> filename
+ends with <code>.jar</code>, <code>.zip</code>, or <code>.apk</code>,
+a file called <code>classes.dex</code> is created and stored inside the
+archive.
+</p><p>
+Run <code>adb shell dalvikvm -help</code> to see a list of command-line
+options.
+</p><p>
+
+
+
+<h2>Working with the desktop build</h2>
+
+<!-- largely lifted from
+http://groups.google.com/group/android-porting/browse_thread/thread/ab553116dbc960da/29167c58b3b49051#29167c58b3b49051
+-->
+
+<p>
+The Dalvik VM can also be used directly on the desktop. This is somewhat
+more complicated however, because you won't have certain things set up in
+your environment, and several native code libraries are required to support
+the core Dalvik libs.
+</p><p>
+Start with:
+
+<pre>
+ . build/envsetup.sh
+ lunch sim-eng
+</pre>
+
+You should see something like:
+
+<pre>
+ ============================================
+ TARGET_PRODUCT=sim
+ TARGET_BUILD_VARIANT=eng
+ TARGET_SIMULATOR=true
+ TARGET_BUILD_TYPE=debug
+ TARGET_ARCH=x86
+ HOST_ARCH=x86
+ HOST_OS=linux
+ HOST_BUILD_TYPE=release
+ BUILD_ID=
+ ============================================
+</pre>
+
+</p></p>
+This configures you to build for the desktop, linking against glibc.
+This mode is NOT recommended for anything but experimental use. It
+may go away in the future.
+</p></p>
+You may see <code>TARGET_BUILD_TYPE=release</code> or <code>=debug</code>
+or possibly nothing there at all. You may want to replace the
+<code>lunch</code> command with
+<code>choosecombo Simulator debug sim eng</code>.
+</p></p>
+Build the world (add a <code>-j4</code> if you have multiple cores):
+
+<pre>
+ make
+</pre>
+
+</p></p>
+When that completes, you have a working dalvikm on your desktop
+machine:
+
+<pre>
+ % dalvikvm
+ E/dalvikvm(19521): ERROR: must specify non-'.' bootclasspath
+ W/dalvikvm(19521): JNI_CreateJavaVM failed
+ Dalvik VM init failed (check log file)
+</pre>
+
+</p></p>
+To actually do something, you need to specify the bootstrap class path
+and give it a place to put DEX data that it uncompresses from jar
+files. You can do that with a script like this:
+
+<blockquote><pre>
+#!/bin/sh
+
+# base directory, at top of source tree; replace with absolute path
+base=`pwd`
+
+# configure root dir of interesting stuff
+root=$base/out/debug/host/linux-x86/product/sim/system
+export ANDROID_ROOT=$root
+
+# configure bootclasspath
+bootpath=$root/framework
+export BOOTCLASSPATH=$bootpath/core.jar:$bootpath/ext.jar:$bootpath/framework.jar:$bootpath/android.policy.jar:$bootpath/services.jar
+
+# this is where we create the dalvik-cache directory; make sure it exists
+export ANDROID_DATA=/tmp/dalvik_$USER
+mkdir -p $ANDROID_DATA/dalvik-cache
+
+exec dalvikvm $@
+</pre></blockquote>
+
+</p></p>
+The preparation with <code>dx</code> is the same as before:
+
+<pre>
+ % cat > Foo.java
+ class Foo { public static void main(String[] args) {
+ System.out.println("Hello, world");
+ } }
+ (ctrl-D)
+ % javac Foo.java
+ % dx --dex --output=foo.jar Foo.class
+ % ./rund -cp foo.jar Foo
+ Hello, world
+</pre>
+
+As above, you can get some info about valid arguments like this:
+
+<pre>
+ % ./rund -help
+</pre>
+
+</p></p>
+This also shows what options the VM was configured with. The sim "debug"
+build has all sorts of additional assertions and checks enabled,
+which slows the VM down, but since this is just for experiments it
+doesn't matter.
+
+</p></p>
+All of the above applies to x86 Linux. Anything else will likely
+require a porting effort. If libffi supports your system, the amount of
+work required should be minor.
+
+</p></p>
+<address>Copyright © 2009 The Android Open Source Project</address>
+
+</body>
+</html>
diff --git a/dx/README.txt b/dx/README.txt
index 5421e7b..6a20c82 100644
--- a/dx/README.txt
+++ b/dx/README.txt
@@ -1,2 +1,3 @@
Home of Dalvik eXchange, the thing that takes in class files and
-reformulates them for consumption in the VM.
+reformulates them for consumption in the VM. It also does a few other
+things; use "dx --help" to see a modicum of self-documentation.
diff --git a/dx/etc/dx b/dx/etc/dx
index dae5874..1fa9db9 100644
--- a/dx/etc/dx
+++ b/dx/etc/dx
@@ -69,9 +69,9 @@
done
if [ "$OSTYPE" = "cygwin" ] ; then
- jarpath=`cygpath -w "$libdir/$jarfile"`
+ jarpath=`cygpath -w "$libdir/$jarfile"`
else
- jarpath="$libdir/$jarfile"
+ jarpath="$libdir/$jarfile"
fi
exec java $javaOpts -jar "$jarpath" "$@"
diff --git a/dx/src/com/android/dx/Version.java b/dx/src/com/android/dx/Version.java
index 02dc7b2..4950d39 100644
--- a/dx/src/com/android/dx/Version.java
+++ b/dx/src/com/android/dx/Version.java
@@ -20,6 +20,6 @@
* Version number for dx.
*/
public class Version {
- /** non-null; version string */
- public static final String VERSION = "1.2";
+ /** {@code non-null;} version string */
+ public static final String VERSION = "1.3";
}
diff --git a/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java b/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java
index 12e1f74..acf5a9e 100644
--- a/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java
+++ b/dx/src/com/android/dx/cf/attrib/AttAnnotationDefault.java
@@ -19,24 +19,24 @@
import com.android.dx.rop.cst.Constant;
/**
- * Attribute class for <code>AnnotationDefault</code> attributes.
+ * Attribute class for {@code AnnotationDefault} attributes.
*/
public final class AttAnnotationDefault extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "AnnotationDefault";
- /** non-null; the annotation default value */
+ /** {@code non-null;} the annotation default value */
private final Constant value;
- /** >= 0; attribute data length in the original classfile (not
+ /** {@code >= 0;} attribute data length in the original classfile (not
* including the attribute header) */
private final int byteLength;
/**
* Constructs an instance.
*
- * @param value non-null; the annotation default value
- * @param byteLength >= 0; attribute data length in the original
+ * @param value {@code non-null;} the annotation default value
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public AttAnnotationDefault(Constant value, int byteLength) {
@@ -59,7 +59,7 @@
/**
* Gets the annotation default value.
*
- * @return non-null; the value
+ * @return {@code non-null;} the value
*/
public Constant getValue() {
return value;
diff --git a/dx/src/com/android/dx/cf/attrib/AttCode.java b/dx/src/com/android/dx/cf/attrib/AttCode.java
index f00da2f..89ba895 100644
--- a/dx/src/com/android/dx/cf/attrib/AttCode.java
+++ b/dx/src/com/android/dx/cf/attrib/AttCode.java
@@ -22,35 +22,35 @@
import com.android.dx.util.MutabilityException;
/**
- * Attribute class for standard <code>Code</code> attributes.
+ * Attribute class for standard {@code Code} attributes.
*/
public final class AttCode extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "Code";
- /** >= 0; the stack size */
+ /** {@code >= 0;} the stack size */
private final int maxStack;
- /** >= 0; the number of locals */
+ /** {@code >= 0;} the number of locals */
private final int maxLocals;
- /** non-null; array containing the bytecode per se */
+ /** {@code non-null;} array containing the bytecode per se */
private final BytecodeArray code;
- /** non-null; the exception table */
+ /** {@code non-null;} the exception table */
private final ByteCatchList catches;
- /** non-null; the associated list of attributes */
+ /** {@code non-null;} the associated list of attributes */
private final AttributeList attributes;
/**
* Constructs an instance.
*
- * @param maxStack >= 0; the stack size
- * @param maxLocals >= 0; the number of locals
- * @param code non-null; array containing the bytecode per se
- * @param catches non-null; the exception table
- * @param attributes non-null; the associated list of attributes
+ * @param maxStack {@code >= 0;} the stack size
+ * @param maxLocals {@code >= 0;} the number of locals
+ * @param code {@code non-null;} array containing the bytecode per se
+ * @param catches {@code non-null;} the exception table
+ * @param attributes {@code non-null;} the associated list of attributes
*/
public AttCode(int maxStack, int maxLocals, BytecodeArray code,
ByteCatchList catches, AttributeList attributes) {
@@ -101,7 +101,7 @@
/**
* Gets the maximum stack size.
*
- * @return >= 0; the maximum stack size
+ * @return {@code >= 0;} the maximum stack size
*/
public int getMaxStack() {
return maxStack;
@@ -110,7 +110,7 @@
/**
* Gets the number of locals.
*
- * @return >= 0; the number of locals
+ * @return {@code >= 0;} the number of locals
*/
public int getMaxLocals() {
return maxLocals;
@@ -119,7 +119,7 @@
/**
* Gets the bytecode array.
*
- * @return non-null; the bytecode array
+ * @return {@code non-null;} the bytecode array
*/
public BytecodeArray getCode() {
return code;
@@ -128,7 +128,7 @@
/**
* Gets the exception table.
*
- * @return non-null; the exception table
+ * @return {@code non-null;} the exception table
*/
public ByteCatchList getCatches() {
return catches;
@@ -137,7 +137,7 @@
/**
* Gets the associated attribute list.
*
- * @return non-null; the attribute list
+ * @return {@code non-null;} the attribute list
*/
public AttributeList getAttributes() {
return attributes;
diff --git a/dx/src/com/android/dx/cf/attrib/AttConstantValue.java b/dx/src/com/android/dx/cf/attrib/AttConstantValue.java
index a84da43..a7436f3 100644
--- a/dx/src/com/android/dx/cf/attrib/AttConstantValue.java
+++ b/dx/src/com/android/dx/cf/attrib/AttConstantValue.java
@@ -24,22 +24,22 @@
import com.android.dx.rop.cst.TypedConstant;
/**
- * Attribute class for standard <code>ConstantValue</code> attributes.
+ * Attribute class for standard {@code ConstantValue} attributes.
*/
public final class AttConstantValue extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "ConstantValue";
- /** non-null; the constant value */
+ /** {@code non-null;} the constant value */
private final TypedConstant constantValue;
/**
* Constructs an instance.
*
- * @param constantValue non-null; the constant value, which must
- * be an instance of one of: <code>CstString</code>,
- * <code>CstInteger</code>, <code>CstLong</code>,
- * <code>CstFloat</code>, or <code>CstDouble</code>
+ * @param constantValue {@code non-null;} the constant value, which must
+ * be an instance of one of: {@code CstString},
+ * {@code CstInteger}, {@code CstLong},
+ * {@code CstFloat}, or {@code CstDouble}
*/
public AttConstantValue(TypedConstant constantValue) {
super(ATTRIBUTE_NAME);
@@ -65,11 +65,11 @@
/**
* Gets the constant value of this instance. The returned value
- * is an instance of one of: <code>CstString</code>,
- * <code>CstInteger</code>, <code>CstLong</code>,
- * <code>CstFloat</code>, or <code>CstDouble</code>.
+ * is an instance of one of: {@code CstString},
+ * {@code CstInteger}, {@code CstLong},
+ * {@code CstFloat}, or {@code CstDouble}.
*
- * @return non-null; the constant value
+ * @return {@code non-null;} the constant value
*/
public TypedConstant getConstantValue() {
return constantValue;
diff --git a/dx/src/com/android/dx/cf/attrib/AttDeprecated.java b/dx/src/com/android/dx/cf/attrib/AttDeprecated.java
index cd1dd24..d440aae 100644
--- a/dx/src/com/android/dx/cf/attrib/AttDeprecated.java
+++ b/dx/src/com/android/dx/cf/attrib/AttDeprecated.java
@@ -17,10 +17,10 @@
package com.android.dx.cf.attrib;
/**
- * Attribute class for standard <code>Deprecated</code> attributes.
+ * Attribute class for standard {@code Deprecated} attributes.
*/
public final class AttDeprecated extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "Deprecated";
/**
diff --git a/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java b/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java
index 7cccad7..68a24d9 100644
--- a/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java
+++ b/dx/src/com/android/dx/cf/attrib/AttEnclosingMethod.java
@@ -20,24 +20,24 @@
import com.android.dx.rop.cst.CstType;
/**
- * Attribute class for standards-track <code>EnclosingMethod</code>
+ * Attribute class for standards-track {@code EnclosingMethod}
* attributes.
*/
public final class AttEnclosingMethod extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "EnclosingMethod";
- /** non-null; the innermost enclosing class */
+ /** {@code non-null;} the innermost enclosing class */
private final CstType type;
- /** null-ok; the name-and-type of the innermost enclosing method, if any */
+ /** {@code null-ok;} the name-and-type of the innermost enclosing method, if any */
private final CstNat method;
/**
* Constructs an instance.
*
- * @param type non-null; the innermost enclosing class
- * @param method null-ok; the name-and-type of the innermost enclosing
+ * @param type {@code non-null;} the innermost enclosing class
+ * @param method {@code null-ok;} the name-and-type of the innermost enclosing
* method, if any
*/
public AttEnclosingMethod(CstType type, CstNat method) {
@@ -59,7 +59,7 @@
/**
* Gets the innermost enclosing class.
*
- * @return non-null; the innermost enclosing class
+ * @return {@code non-null;} the innermost enclosing class
*/
public CstType getEnclosingClass() {
return type;
@@ -69,7 +69,7 @@
* Gets the name-and-type of the innermost enclosing method, if
* any.
*
- * @return null-ok; the name-and-type of the innermost enclosing
+ * @return {@code null-ok;} the name-and-type of the innermost enclosing
* method, if any
*/
public CstNat getMethod() {
diff --git a/dx/src/com/android/dx/cf/attrib/AttExceptions.java b/dx/src/com/android/dx/cf/attrib/AttExceptions.java
index 59e624e..c592047 100644
--- a/dx/src/com/android/dx/cf/attrib/AttExceptions.java
+++ b/dx/src/com/android/dx/cf/attrib/AttExceptions.java
@@ -20,20 +20,20 @@
import com.android.dx.util.MutabilityException;
/**
- * Attribute class for standard <code>Exceptions</code> attributes.
+ * Attribute class for standard {@code Exceptions} attributes.
*/
public final class AttExceptions extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "Exceptions";
- /** non-null; list of exception classes */
+ /** {@code non-null;} list of exception classes */
private final TypeList exceptions;
/**
* Constructs an instance.
*
- * @param exceptions non-null; list of classes, presumed but not
- * verified to be subclasses of <code>Throwable</code>
+ * @param exceptions {@code non-null;} list of classes, presumed but not
+ * verified to be subclasses of {@code Throwable}
*/
public AttExceptions(TypeList exceptions) {
super(ATTRIBUTE_NAME);
@@ -58,9 +58,9 @@
/**
* Gets the list of classes associated with this instance. In
* general, these classes are not pre-verified to be subclasses of
- * <code>Throwable</code>.
+ * {@code Throwable}.
*
- * @return non-null; the list of classes
+ * @return {@code non-null;} the list of classes
*/
public TypeList getExceptions() {
return exceptions;
diff --git a/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java b/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java
index df30539..bd6c7cd 100644
--- a/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java
+++ b/dx/src/com/android/dx/cf/attrib/AttInnerClasses.java
@@ -19,19 +19,19 @@
import com.android.dx.util.MutabilityException;
/**
- * Attribute class for standard <code>InnerClasses</code> attributes.
+ * Attribute class for standard {@code InnerClasses} attributes.
*/
public final class AttInnerClasses extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "InnerClasses";
- /** non-null; list of inner class entries */
+ /** {@code non-null;} list of inner class entries */
private final InnerClassList innerClasses;
/**
* Constructs an instance.
*
- * @param innerClasses non-null; list of inner class entries
+ * @param innerClasses {@code non-null;} list of inner class entries
*/
public AttInnerClasses(InnerClassList innerClasses) {
super(ATTRIBUTE_NAME);
@@ -56,7 +56,7 @@
/**
* Gets the list of "inner class" entries associated with this instance.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public InnerClassList getInnerClasses() {
return innerClasses;
diff --git a/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java b/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java
index c5e65e8..38980be 100644
--- a/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java
+++ b/dx/src/com/android/dx/cf/attrib/AttLineNumberTable.java
@@ -20,19 +20,19 @@
import com.android.dx.util.MutabilityException;
/**
- * Attribute class for standard <code>LineNumberTable</code> attributes.
+ * Attribute class for standard {@code LineNumberTable} attributes.
*/
public final class AttLineNumberTable extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "LineNumberTable";
- /** non-null; list of line number entries */
+ /** {@code non-null;} list of line number entries */
private final LineNumberList lineNumbers;
/**
* Constructs an instance.
*
- * @param lineNumbers non-null; list of line number entries
+ * @param lineNumbers {@code non-null;} list of line number entries
*/
public AttLineNumberTable(LineNumberList lineNumbers) {
super(ATTRIBUTE_NAME);
@@ -57,7 +57,7 @@
/**
* Gets the list of "line number" entries associated with this instance.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public LineNumberList getLineNumbers() {
return lineNumbers;
diff --git a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java
index 893f254..53ba64f 100644
--- a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java
+++ b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTable.java
@@ -19,16 +19,16 @@
import com.android.dx.cf.code.LocalVariableList;
/**
- * Attribute class for standard <code>LocalVariableTable</code> attributes.
+ * Attribute class for standard {@code LocalVariableTable} attributes.
*/
public final class AttLocalVariableTable extends BaseLocalVariables {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "LocalVariableTable";
/**
* Constructs an instance.
*
- * @param localVariables non-null; list of local variable entries
+ * @param localVariables {@code non-null;} list of local variable entries
*/
public AttLocalVariableTable(LocalVariableList localVariables) {
super(ATTRIBUTE_NAME, localVariables);
diff --git a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java
index 7037b74..49cdb0c 100644
--- a/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java
+++ b/dx/src/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java
@@ -19,16 +19,16 @@
import com.android.dx.cf.code.LocalVariableList;
/**
- * Attribute class for standard <code>LocalVariableTypeTable</code> attributes.
+ * Attribute class for standard {@code LocalVariableTypeTable} attributes.
*/
public final class AttLocalVariableTypeTable extends BaseLocalVariables {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "LocalVariableTypeTable";
/**
* Constructs an instance.
*
- * @param localVariables non-null; list of local variable entries
+ * @param localVariables {@code non-null;} list of local variable entries
*/
public AttLocalVariableTypeTable(LocalVariableList localVariables) {
super(ATTRIBUTE_NAME, localVariables);
diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java
index 583ab17..e83b76f 100644
--- a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleAnnotations.java
@@ -19,18 +19,18 @@
import com.android.dx.rop.annotation.Annotations;
/**
- * Attribute class for standard <code>RuntimeInvisibleAnnotations</code>
+ * Attribute class for standard {@code RuntimeInvisibleAnnotations}
* attributes.
*/
public final class AttRuntimeInvisibleAnnotations extends BaseAnnotations {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "RuntimeInvisibleAnnotations";
/**
* Constructs an instance.
*
- * @param annotations non-null; the list of annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param annotations {@code non-null;} the list of annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public AttRuntimeInvisibleAnnotations(Annotations annotations,
diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java
index 08865e1..7dfe206 100644
--- a/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeInvisibleParameterAnnotations.java
@@ -20,19 +20,19 @@
/**
* Attribute class for standard
- * <code>RuntimeInvisibleParameterAnnotations</code> attributes.
+ * {@code RuntimeInvisibleParameterAnnotations} attributes.
*/
public final class AttRuntimeInvisibleParameterAnnotations
extends BaseParameterAnnotations {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME =
"RuntimeInvisibleParameterAnnotations";
/**
* Constructs an instance.
*
- * @param parameterAnnotations non-null; the parameter annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param parameterAnnotations {@code non-null;} the parameter annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public AttRuntimeInvisibleParameterAnnotations(
diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java
index c61acb5..9de0588 100644
--- a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleAnnotations.java
@@ -19,18 +19,18 @@
import com.android.dx.rop.annotation.Annotations;
/**
- * Attribute class for standard <code>RuntimeVisibleAnnotations</code>
+ * Attribute class for standard {@code RuntimeVisibleAnnotations}
* attributes.
*/
public final class AttRuntimeVisibleAnnotations extends BaseAnnotations {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "RuntimeVisibleAnnotations";
/**
* Constructs an instance.
*
- * @param annotations non-null; the list of annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param annotations {@code non-null;} the list of annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public AttRuntimeVisibleAnnotations(Annotations annotations,
diff --git a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java
index dfe57b2..76607c0 100644
--- a/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/AttRuntimeVisibleParameterAnnotations.java
@@ -19,20 +19,20 @@
import com.android.dx.rop.annotation.AnnotationsList;
/**
- * Attribute class for standard <code>RuntimeVisibleParameterAnnotations</code>
+ * Attribute class for standard {@code RuntimeVisibleParameterAnnotations}
* attributes.
*/
public final class AttRuntimeVisibleParameterAnnotations
extends BaseParameterAnnotations {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME =
"RuntimeVisibleParameterAnnotations";
/**
* Constructs an instance.
*
- * @param annotations non-null; the parameter annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param annotations {@code non-null;} the parameter annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public AttRuntimeVisibleParameterAnnotations(
diff --git a/dx/src/com/android/dx/cf/attrib/AttSignature.java b/dx/src/com/android/dx/cf/attrib/AttSignature.java
index 97edbbd..b9cb97d 100644
--- a/dx/src/com/android/dx/cf/attrib/AttSignature.java
+++ b/dx/src/com/android/dx/cf/attrib/AttSignature.java
@@ -19,19 +19,19 @@
import com.android.dx.rop.cst.CstUtf8;
/**
- * Attribute class for standards-track <code>Signature</code> attributes.
+ * Attribute class for standards-track {@code Signature} attributes.
*/
public final class AttSignature extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "Signature";
- /** non-null; the signature string */
+ /** {@code non-null;} the signature string */
private final CstUtf8 signature;
/**
* Constructs an instance.
*
- * @param signature non-null; the signature string
+ * @param signature {@code non-null;} the signature string
*/
public AttSignature(CstUtf8 signature) {
super(ATTRIBUTE_NAME);
@@ -51,7 +51,7 @@
/**
* Gets the signature string.
*
- * @return non-null; the signature string
+ * @return {@code non-null;} the signature string
*/
public CstUtf8 getSignature() {
return signature;
diff --git a/dx/src/com/android/dx/cf/attrib/AttSourceFile.java b/dx/src/com/android/dx/cf/attrib/AttSourceFile.java
index f087217..941a2b0 100644
--- a/dx/src/com/android/dx/cf/attrib/AttSourceFile.java
+++ b/dx/src/com/android/dx/cf/attrib/AttSourceFile.java
@@ -19,19 +19,19 @@
import com.android.dx.rop.cst.CstUtf8;
/**
- * Attribute class for standard <code>SourceFile</code> attributes.
+ * Attribute class for standard {@code SourceFile} attributes.
*/
public final class AttSourceFile extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "SourceFile";
- /** non-null; name of the source file */
+ /** {@code non-null;} name of the source file */
private final CstUtf8 sourceFile;
/**
* Constructs an instance.
*
- * @param sourceFile non-null; the name of the source file
+ * @param sourceFile {@code non-null;} the name of the source file
*/
public AttSourceFile(CstUtf8 sourceFile) {
super(ATTRIBUTE_NAME);
@@ -51,7 +51,7 @@
/**
* Gets the source file name of this instance.
*
- * @return non-null; the source file
+ * @return {@code non-null;} the source file
*/
public CstUtf8 getSourceFile() {
return sourceFile;
diff --git a/dx/src/com/android/dx/cf/attrib/AttSynthetic.java b/dx/src/com/android/dx/cf/attrib/AttSynthetic.java
index daa9b0c..e3841eb 100644
--- a/dx/src/com/android/dx/cf/attrib/AttSynthetic.java
+++ b/dx/src/com/android/dx/cf/attrib/AttSynthetic.java
@@ -17,10 +17,10 @@
package com.android.dx.cf.attrib;
/**
- * Attribute class for standard <code>Synthetic</code> attributes.
+ * Attribute class for standard {@code Synthetic} attributes.
*/
public final class AttSynthetic extends BaseAttribute {
- /** non-null; attribute name for attributes of this type */
+ /** {@code non-null;} attribute name for attributes of this type */
public static final String ATTRIBUTE_NAME = "Synthetic";
/**
diff --git a/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java b/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java
index 0163e2c..4d9201e 100644
--- a/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/BaseAnnotations.java
@@ -23,19 +23,19 @@
* Base class for annotations attributes.
*/
public abstract class BaseAnnotations extends BaseAttribute {
- /** non-null; list of annotations */
+ /** {@code non-null;} list of annotations */
private final Annotations annotations;
- /** >= 0; attribute data length in the original classfile (not
+ /** {@code >= 0;} attribute data length in the original classfile (not
* including the attribute header) */
private final int byteLength;
/**
* Constructs an instance.
*
- * @param attributeName non-null; the name of the attribute
- * @param annotations non-null; the list of annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param attributeName {@code non-null;} the name of the attribute
+ * @param annotations {@code non-null;} the list of annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public BaseAnnotations(String attributeName, Annotations annotations,
@@ -64,7 +64,7 @@
/**
* Gets the list of annotations associated with this instance.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public final Annotations getAnnotations() {
return annotations;
diff --git a/dx/src/com/android/dx/cf/attrib/BaseAttribute.java b/dx/src/com/android/dx/cf/attrib/BaseAttribute.java
index ef1c6ac..c9c1b33 100644
--- a/dx/src/com/android/dx/cf/attrib/BaseAttribute.java
+++ b/dx/src/com/android/dx/cf/attrib/BaseAttribute.java
@@ -23,13 +23,13 @@
* the attribute name but leaves the rest up to subclasses.
*/
public abstract class BaseAttribute implements Attribute {
- /** non-null; attribute name */
+ /** {@code non-null;} attribute name */
private final String name;
/**
* Constructs an instance.
*
- * @param name non-null; attribute name
+ * @param name {@code non-null;} attribute name
*/
public BaseAttribute(String name) {
if (name == null) {
diff --git a/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java b/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java
index a39e724..5ba5889 100644
--- a/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java
+++ b/dx/src/com/android/dx/cf/attrib/BaseLocalVariables.java
@@ -20,18 +20,18 @@
import com.android.dx.util.MutabilityException;
/**
- * Base attribute class for standard <code>LocalVariableTable</code>
- * and <code>LocalVariableTypeTable</code> attributes.
+ * Base attribute class for standard {@code LocalVariableTable}
+ * and {@code LocalVariableTypeTable} attributes.
*/
public abstract class BaseLocalVariables extends BaseAttribute {
- /** non-null; list of local variable entries */
+ /** {@code non-null;} list of local variable entries */
private final LocalVariableList localVariables;
/**
* Constructs an instance.
*
- * @param name non-null; attribute name
- * @param localVariables non-null; list of local variable entries
+ * @param name {@code non-null;} attribute name
+ * @param localVariables {@code non-null;} list of local variable entries
*/
public BaseLocalVariables(String name,
LocalVariableList localVariables) {
@@ -57,7 +57,7 @@
/**
* Gets the list of "local variable" entries associated with this instance.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public final LocalVariableList getLocalVariables() {
return localVariables;
diff --git a/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java b/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java
index a927e3d..1b204b3 100644
--- a/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java
+++ b/dx/src/com/android/dx/cf/attrib/BaseParameterAnnotations.java
@@ -23,19 +23,19 @@
* Base class for parameter annotation list attributes.
*/
public abstract class BaseParameterAnnotations extends BaseAttribute {
- /** non-null; list of annotations */
+ /** {@code non-null;} list of annotations */
private final AnnotationsList parameterAnnotations;
- /** >= 0; attribute data length in the original classfile (not
+ /** {@code >= 0;} attribute data length in the original classfile (not
* including the attribute header) */
private final int byteLength;
/**
* Constructs an instance.
*
- * @param attributeName non-null; the name of the attribute
- * @param parameterAnnotations non-null; the annotations
- * @param byteLength >= 0; attribute data length in the original
+ * @param attributeName {@code non-null;} the name of the attribute
+ * @param parameterAnnotations {@code non-null;} the annotations
+ * @param byteLength {@code >= 0;} attribute data length in the original
* classfile (not including the attribute header)
*/
public BaseParameterAnnotations(String attributeName,
@@ -65,7 +65,7 @@
/**
* Gets the list of annotation lists associated with this instance.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public final AnnotationsList getParameterAnnotations() {
return parameterAnnotations;
diff --git a/dx/src/com/android/dx/cf/attrib/InnerClassList.java b/dx/src/com/android/dx/cf/attrib/InnerClassList.java
index 3585f1d..96e1b60 100644
--- a/dx/src/com/android/dx/cf/attrib/InnerClassList.java
+++ b/dx/src/com/android/dx/cf/attrib/InnerClassList.java
@@ -22,7 +22,7 @@
/**
* List of "inner class" entries, which are the contents of
- * <code>InnerClasses</code> attributes.
+ * {@code InnerClasses} attributes.
*/
public final class InnerClassList extends FixedSizeList {
/**
@@ -37,8 +37,8 @@
/**
* Gets the indicated item.
*
- * @param n >= 0; which item
- * @return null-ok; the indicated item
+ * @param n {@code >= 0;} which item
+ * @return {@code null-ok;} the indicated item
*/
public Item get(int n) {
return (Item) get0(n);
@@ -47,11 +47,11 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which class
- * @param innerClass non-null; class this item refers to
- * @param outerClass null-ok; outer class that this class is a
+ * @param n {@code >= 0, < size();} which class
+ * @param innerClass {@code non-null;} class this item refers to
+ * @param outerClass {@code null-ok;} outer class that this class is a
* member of, if any
- * @param innerName null-ok; original simple name of this class,
+ * @param innerName {@code null-ok;} original simple name of this class,
* if not anonymous
* @param accessFlags original declared access flags
*/
@@ -64,13 +64,13 @@
* Item in an inner classes list.
*/
public static class Item {
- /** non-null; class this item refers to */
+ /** {@code non-null;} class this item refers to */
private final CstType innerClass;
- /** null-ok; outer class that this class is a member of, if any */
+ /** {@code null-ok;} outer class that this class is a member of, if any */
private final CstType outerClass;
- /** null-ok; original simple name of this class, if not anonymous */
+ /** {@code null-ok;} original simple name of this class, if not anonymous */
private final CstUtf8 innerName;
/** original declared access flags */
@@ -79,10 +79,10 @@
/**
* Constructs an instance.
*
- * @param innerClass non-null; class this item refers to
- * @param outerClass null-ok; outer class that this class is a
+ * @param innerClass {@code non-null;} class this item refers to
+ * @param outerClass {@code null-ok;} outer class that this class is a
* member of, if any
- * @param innerName null-ok; original simple name of this
+ * @param innerName {@code null-ok;} original simple name of this
* class, if not anonymous
* @param accessFlags original declared access flags
*/
@@ -101,7 +101,7 @@
/**
* Gets the class this item refers to.
*
- * @return non-null; the class
+ * @return {@code non-null;} the class
*/
public CstType getInnerClass() {
return innerClass;
@@ -110,7 +110,7 @@
/**
* Gets the outer class that this item's class is a member of, if any.
*
- * @return null-ok; the class
+ * @return {@code null-ok;} the class
*/
public CstType getOuterClass() {
return outerClass;
@@ -119,7 +119,7 @@
/**
* Gets the original name of this item's class, if not anonymous.
*
- * @return null-ok; the name
+ * @return {@code null-ok;} the name
*/
public CstUtf8 getInnerName() {
return innerName;
diff --git a/dx/src/com/android/dx/cf/attrib/RawAttribute.java b/dx/src/com/android/dx/cf/attrib/RawAttribute.java
index b89926d..585e5c5 100644
--- a/dx/src/com/android/dx/cf/attrib/RawAttribute.java
+++ b/dx/src/com/android/dx/cf/attrib/RawAttribute.java
@@ -23,11 +23,11 @@
* Raw attribute, for holding onto attributes that are unrecognized.
*/
public final class RawAttribute extends BaseAttribute {
- /** non-null; attribute data */
+ /** {@code non-null;} attribute data */
private final ByteArray data;
/**
- * null-ok; constant pool to use for resolution of cpis in {@link
+ * {@code null-ok;} constant pool to use for resolution of cpis in {@link
* #data}
*/
private final ConstantPool pool;
@@ -35,9 +35,9 @@
/**
* Constructs an instance.
*
- * @param name non-null; attribute name
- * @param data non-null; attribute data
- * @param pool null-ok; constant pool to use for cpi resolution
+ * @param name {@code non-null;} attribute name
+ * @param data {@code non-null;} attribute data
+ * @param pool {@code null-ok;} constant pool to use for cpi resolution
*/
public RawAttribute(String name, ByteArray data, ConstantPool pool) {
super(name);
@@ -53,11 +53,11 @@
/**
* Constructs an instance from a sub-array of a {@link ByteArray}.
*
- * @param name non-null; attribute name
- * @param data non-null; array containing the attribute data
- * @param offset offset in <code>data</code> to the attribute data
+ * @param name {@code non-null;} attribute name
+ * @param data {@code non-null;} array containing the attribute data
+ * @param offset offset in {@code data} to the attribute data
* @param length length of the attribute data, in bytes
- * @param pool null-ok; constant pool to use for cpi resolution
+ * @param pool {@code null-ok;} constant pool to use for cpi resolution
*/
public RawAttribute(String name, ByteArray data, int offset,
int length, ConstantPool pool) {
@@ -67,7 +67,7 @@
/**
* Get the raw data of the attribute.
*
- * @return non-null; the data
+ * @return {@code non-null;} the data
*/
public ByteArray getData() {
return data;
@@ -83,7 +83,7 @@
* presumably came from the class file that this attribute came
* from.
*
- * @return null-ok; the constant pool
+ * @return {@code null-ok;} the constant pool
*/
public ConstantPool getPool() {
return pool;
diff --git a/dx/src/com/android/dx/cf/code/BaseMachine.java b/dx/src/com/android/dx/cf/code/BaseMachine.java
index 430e48b..b7e700d 100644
--- a/dx/src/com/android/dx/cf/code/BaseMachine.java
+++ b/dx/src/com/android/dx/cf/code/BaseMachine.java
@@ -33,44 +33,44 @@
* TypeBearer}.</p>
*/
public abstract class BaseMachine implements Machine {
- /* non-null; the prototype for the associated method */
+ /* {@code non-null;} the prototype for the associated method */
private final Prototype prototype;
- /** non-null; primary arguments */
+ /** {@code non-null;} primary arguments */
private TypeBearer[] args;
- /** >= 0; number of primary arguments */
+ /** {@code >= 0;} number of primary arguments */
private int argCount;
- /** null-ok; type of the operation, if salient */
+ /** {@code null-ok;} type of the operation, if salient */
private Type auxType;
- /** auxiliary <code>int</code> argument */
+ /** auxiliary {@code int} argument */
private int auxInt;
- /** null-ok; auxiliary constant argument */
+ /** {@code null-ok;} auxiliary constant argument */
private Constant auxCst;
/** auxiliary branch target argument */
private int auxTarget;
- /** null-ok; auxiliary switch cases argument */
+ /** {@code null-ok;} auxiliary switch cases argument */
private SwitchList auxCases;
- /** null-ok; auxiliary initial value list for newarray */
+ /** {@code null-ok;} auxiliary initial value list for newarray */
private ArrayList<Constant> auxInitValues;
- /** >= -1; last local accessed */
+ /** {@code >= -1;} last local accessed */
private int localIndex;
- /** null-ok; local target spec, if salient and calculated */
+ /** {@code null-ok;} local target spec, if salient and calculated */
private RegisterSpec localTarget;
- /** non-null; results */
+ /** {@code non-null;} results */
private TypeBearer[] results;
/**
- * >= -1; count of the results, or <code>-1</code> if no results
+ * {@code >= -1;} count of the results, or {@code -1} if no results
* have been set
*/
private int resultCount;
@@ -78,7 +78,7 @@
/**
* Constructs an instance.
*
- * @param prototype non-null; the prototype for the associated method
+ * @param prototype {@code non-null;} the prototype for the associated method
*/
public BaseMachine(Prototype prototype) {
if (prototype == null) {
@@ -254,7 +254,7 @@
/**
* Gets the number of primary arguments.
*
- * @return >= 0; the number of primary arguments
+ * @return {@code >= 0;} the number of primary arguments
*/
protected final int argCount() {
return argCount;
@@ -264,7 +264,7 @@
* Gets the width of the arguments (where a category-2 value counts as
* two).
*
- * @return >= 0; the argument width
+ * @return {@code >= 0;} the argument width
*/
protected final int argWidth() {
int result = 0;
@@ -277,10 +277,10 @@
}
/**
- * Gets the <code>n</code>th primary argument.
+ * Gets the {@code n}th primary argument.
*
- * @param n >= 0, < argCount(); which argument
- * @return non-null; the indicated argument
+ * @param n {@code >= 0, < argCount();} which argument
+ * @return {@code non-null;} the indicated argument
*/
protected final TypeBearer arg(int n) {
if (n >= argCount) {
@@ -298,14 +298,14 @@
/**
* Gets the type auxiliary argument.
*
- * @return null-ok; the salient type
+ * @return {@code null-ok;} the salient type
*/
protected final Type getAuxType() {
return auxType;
}
/**
- * Gets the <code>int</code> auxiliary argument.
+ * Gets the {@code int} auxiliary argument.
*
* @return the argument value
*/
@@ -316,7 +316,7 @@
/**
* Gets the constant auxiliary argument.
*
- * @return null-ok; the argument value
+ * @return {@code null-ok;} the argument value
*/
protected final Constant getAuxCst() {
return auxCst;
@@ -334,7 +334,7 @@
/**
* Gets the switch cases auxiliary argument.
*
- * @return null-ok; the argument value
+ * @return {@code null-ok;} the argument value
*/
protected final SwitchList getAuxCases() {
return auxCases;
@@ -343,7 +343,7 @@
/**
* Gets the init values auxiliary argument.
*
- * @return null-ok; the argument value
+ * @return {@code null-ok;} the argument value
*/
protected final ArrayList<Constant> getInitValues() {
return auxInitValues;
@@ -351,7 +351,7 @@
/**
* Gets the last local index accessed.
*
- * @return >= -1; the salient local index or <code>-1</code> if none
+ * @return {@code >= -1;} the salient local index or {@code -1} if none
* was set since the last time {@link #clearArgs} was called
*/
protected final int getLocalIndex() {
@@ -365,7 +365,7 @@
* should be the sole result set by a call to {@link #setResult} (or
* the combination {@link #clearResult} then {@link #addResult}.
*
- * @return null-ok; the salient register spec or <code>null</code> if no
+ * @return {@code null-ok;} the salient register spec or {@code null} if no
* local target was set since the last time {@link #clearArgs} was
* called
*/
@@ -417,7 +417,7 @@
* <p><b>Note:</b> If there is more than one result value, the
* others may be added by using {@link #addResult}.</p>
*
- * @param result non-null; result value
+ * @param result {@code non-null;} result value
*/
protected final void setResult(TypeBearer result) {
if (result == null) {
@@ -433,7 +433,7 @@
*
* @see #setResult
*
- * @param result non-null; result value
+ * @param result {@code non-null;} result value
*/
protected final void addResult(TypeBearer result) {
if (result == null) {
@@ -448,7 +448,7 @@
* Gets the count of results. This throws an exception if results were
* never set. (Explicitly clearing the results counts as setting them.)
*
- * @return >= 0; the count
+ * @return {@code >= 0;} the count
*/
protected final int resultCount() {
if (resultCount < 0) {
@@ -462,7 +462,7 @@
* Gets the width of the results (where a category-2 value counts as
* two).
*
- * @return >= 0; the result width
+ * @return {@code >= 0;} the result width
*/
protected final int resultWidth() {
int width = 0;
@@ -475,10 +475,10 @@
}
/**
- * Gets the <code>n</code>th result value.
+ * Gets the {@code n}th result value.
*
- * @param n >= 0, < resultCount(); which result
- * @return non-null; the indicated result value
+ * @param n {@code >= 0, < resultCount();} which result
+ * @return {@code non-null;} the indicated result value
*/
protected final TypeBearer result(int n) {
if (n >= resultCount) {
@@ -499,7 +499,7 @@
* result is stored to that target; otherwise any results are pushed
* onto the stack.
*
- * @param frame non-null; frame to operate on
+ * @param frame {@code non-null;} frame to operate on
*/
protected final void storeResults(Frame frame) {
if (resultCount < 0) {
@@ -529,8 +529,8 @@
* Throws an exception that indicates a mismatch in local variable
* types.
*
- * @param found non-null; the encountered type
- * @param local non-null; the local variable's claimed type
+ * @param found {@code non-null;} the encountered type
+ * @param local {@code non-null;} the local variable's claimed type
*/
public static void throwLocalMismatch(TypeBearer found,
TypeBearer local) {
diff --git a/dx/src/com/android/dx/cf/code/BasicBlocker.java b/dx/src/com/android/dx/cf/code/BasicBlocker.java
index 82e4a08..a3370d4 100644
--- a/dx/src/com/android/dx/cf/code/BasicBlocker.java
+++ b/dx/src/com/android/dx/cf/code/BasicBlocker.java
@@ -29,33 +29,33 @@
* Utility that identifies basic blocks in bytecode.
*/
public final class BasicBlocker implements BytecodeArray.Visitor {
- /** non-null; method being converted */
+ /** {@code non-null;} method being converted */
private final ConcreteMethod method;
- /** non-null; work set; bits indicate offsets in need of examination */
+ /** {@code non-null;} work set; bits indicate offsets in need of examination */
private final int[] workSet;
/**
- * non-null; live set; bits indicate potentially-live opcodes; contrawise,
+ * {@code non-null;} live set; bits indicate potentially-live opcodes; contrawise,
* a bit that isn't on is either in the middle of an instruction or is
* a definitely-dead opcode
*/
private final int[] liveSet;
/**
- * non-null; block start set; bits indicate the starts of basic blocks,
+ * {@code non-null;} block start set; bits indicate the starts of basic blocks,
* including the opcodes that start blocks of definitely-dead code
*/
private final int[] blockSet;
/**
- * non-null, sparse; for each instruction offset to a branch of
+ * {@code non-null, sparse;} for each instruction offset to a branch of
* some sort, the list of targets for that instruction
*/
private final IntList[] targetLists;
/**
- * non-null, sparse; for each instruction offset to a throwing
+ * {@code non-null, sparse;} for each instruction offset to a throwing
* instruction, the list of exception handlers for that instruction
*/
private final ByteCatchList[] catchLists;
@@ -68,8 +68,8 @@
* returning a list of them. The returned list notably omits any
* definitely-dead code that is identified in the process.
*
- * @param method non-null; method to convert
- * @return non-null; list of basic blocks
+ * @param method {@code non-null;} method to convert
+ * @return {@code non-null;} list of basic blocks
*/
public static ByteBlockList identifyBlocks(ConcreteMethod method) {
BasicBlocker bb = new BasicBlocker(method);
@@ -82,7 +82,7 @@
* Constructs an instance. This class is not publicly instantiable; use
* {@link #identifyBlocks}.
*
- * @param method non-null; method to convert
+ * @param method {@code non-null;} method to convert
*/
private BasicBlocker(ConcreteMethod method) {
if (method == null) {
@@ -262,7 +262,7 @@
/**
* Extracts the list of basic blocks from the bit sets.
*
- * @return non-null; the list of basic blocks
+ * @return {@code non-null;} the list of basic blocks
*/
private ByteBlockList getBlockList() {
ByteCatchList catches = method.getCatches();
@@ -366,7 +366,7 @@
* isn't yet known to be possibly-live.
*
* @param offset offset to the instruction in question
- * @param blockStart <code>true</code> iff this instruction starts a
+ * @param blockStart {@code true} iff this instruction starts a
* basic block
*/
private void addWorkIfNecessary(int offset, boolean blockStart) {
@@ -384,7 +384,7 @@
*
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param nextIsLive <code>true</code> iff the instruction after
+ * @param nextIsLive {@code true} iff the instruction after
* the indicated one is possibly-live (because this one isn't an
* unconditional branch, a return, or a switch)
*/
@@ -417,7 +417,7 @@
*
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param nextIsLive <code>true</code> iff the instruction after
+ * @param nextIsLive {@code true} iff the instruction after
* the indicated one is possibly-live (because this one isn't an
* unconditional throw)
*/
diff --git a/dx/src/com/android/dx/cf/code/ByteBlock.java b/dx/src/com/android/dx/cf/code/ByteBlock.java
index 065c522..40b91c3 100644
--- a/dx/src/com/android/dx/cf/code/ByteBlock.java
+++ b/dx/src/com/android/dx/cf/code/ByteBlock.java
@@ -24,32 +24,32 @@
* Representation of a basic block in a bytecode array.
*/
public final class ByteBlock implements LabeledItem {
- /** >= 0; label for this block */
+ /** {@code >= 0;} label for this block */
private final int label;
- /** >= 0; bytecode offset (inclusive) of the start of the block */
+ /** {@code >= 0;} bytecode offset (inclusive) of the start of the block */
private final int start;
- /** > start; bytecode offset (exclusive) of the end of the block */
+ /** {@code > start;} bytecode offset (exclusive) of the end of the block */
private final int end;
- /** non-null; list of successors that this block may branch to */
+ /** {@code non-null;} list of successors that this block may branch to */
private final IntList successors;
- /** non-null; list of exceptions caught and their handler targets */
+ /** {@code non-null;} list of exceptions caught and their handler targets */
private final ByteCatchList catches;
/**
* Constructs an instance.
*
- * @param label >= 0; target label for this block
- * @param start >= 0; bytecode offset (inclusive) of the start
+ * @param label {@code >= 0;} target label for this block
+ * @param start {@code >= 0;} bytecode offset (inclusive) of the start
* of the block
- * @param end > start; bytecode offset (exclusive) of the end
+ * @param end {@code > start;} bytecode offset (exclusive) of the end
* of the block
- * @param successors non-null; list of successors that this block may
+ * @param successors {@code non-null;} list of successors that this block may
* branch to
- * @param catches non-null; list of exceptions caught and their
+ * @param catches {@code non-null;} list of exceptions caught and their
* handler targets
*/
public ByteBlock(int label, int start, int end, IntList successors,
@@ -100,7 +100,7 @@
/**
* Gets the label of this block.
*
- * @return >= 0; the label
+ * @return {@code >= 0;} the label
*/
public int getLabel() {
return label;
@@ -109,7 +109,7 @@
/**
* Gets the bytecode offset (inclusive) of the start of this block.
*
- * @return >= 0; the start offset
+ * @return {@code >= 0;} the start offset
*/
public int getStart() {
return start;
@@ -118,7 +118,7 @@
/**
* Gets the bytecode offset (exclusive) of the end of this block.
*
- * @return > getStart(); the end offset
+ * @return {@code > getStart();} the end offset
*/
public int getEnd() {
return end;
@@ -128,7 +128,7 @@
* Gets the list of successors that this block may branch to
* non-exceptionally.
*
- * @return non-null; the successor list
+ * @return {@code non-null;} the successor list
*/
public IntList getSuccessors() {
return successors;
@@ -137,7 +137,7 @@
/**
* Gets the list of exceptions caught and their handler targets.
*
- * @return non-null; the catch list
+ * @return {@code non-null;} the catch list
*/
public ByteCatchList getCatches() {
return catches;
diff --git a/dx/src/com/android/dx/cf/code/ByteBlockList.java b/dx/src/com/android/dx/cf/code/ByteBlockList.java
index 9d27b7f..412dfc3 100644
--- a/dx/src/com/android/dx/cf/code/ByteBlockList.java
+++ b/dx/src/com/android/dx/cf/code/ByteBlockList.java
@@ -28,7 +28,7 @@
/**
* Constructs an instance.
*
- * @param size >= 0; the number of elements to be in the list
+ * @param size {@code >= 0;} the number of elements to be in the list
*/
public ByteBlockList(int size) {
super(size);
@@ -37,10 +37,10 @@
/**
* Gets the indicated element. It is an error to call this with the
* index for an element which was never set; if you do that, this
- * will throw <code>NullPointerException</code>.
+ * will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which element
- * @return non-null; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code non-null;} the indicated element
*/
public ByteBlock get(int n) {
return (ByteBlock) get0(n);
@@ -50,7 +50,7 @@
* Gets the block with the given label.
*
* @param label the label to look for
- * @return non-null; the block with the given label
+ * @return {@code non-null;} the block with the given label
*/
public ByteBlock labelToBlock(int label) {
int idx = indexOfLabel(label);
@@ -66,8 +66,8 @@
/**
* Sets the element at the given index.
*
- * @param n >= 0, < size(); which element
- * @param bb null-ok; the value to store
+ * @param n {@code >= 0, < size();} which element
+ * @param bb {@code null-ok;} the value to store
*/
public void set(int n, ByteBlock bb) {
super.set(n, bb);
diff --git a/dx/src/com/android/dx/cf/code/ByteCatchList.java b/dx/src/com/android/dx/cf/code/ByteCatchList.java
index 375831e..aab2087 100644
--- a/dx/src/com/android/dx/cf/code/ByteCatchList.java
+++ b/dx/src/com/android/dx/cf/code/ByteCatchList.java
@@ -24,10 +24,10 @@
/**
* List of catch entries, that is, the elements of an "exception table,"
- * which is part of a standard <code>Code</code> attribute.
+ * which is part of a standard {@code Code} attribute.
*/
public final class ByteCatchList extends FixedSizeList {
- /** non-null; convenient zero-entry instance */
+ /** {@code non-null;} convenient zero-entry instance */
public static final ByteCatchList EMPTY = new ByteCatchList(0);
/**
@@ -41,10 +41,10 @@
/**
* Gets the total length of this structure in bytes, when included in
- * a <code>Code</code> attribute. The returned value includes the
- * two bytes for <code>exception_table_length</code>.
+ * a {@code Code} attribute. The returned value includes the
+ * two bytes for {@code exception_table_length}.
*
- * @return >= 2; the total length, in bytes
+ * @return {@code >= 2;} the total length, in bytes
*/
public int byteLength() {
return 2 + size() * 8;
@@ -53,8 +53,8 @@
/**
* Gets the indicated item.
*
- * @param n >= 0; which item
- * @return null-ok; the indicated item
+ * @param n {@code >= 0;} which item
+ * @return {@code null-ok;} the indicated item
*/
public Item get(int n) {
return (Item) get0(n);
@@ -63,8 +63,8 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which entry to set
- * @param item non-null; the item
+ * @param n {@code >= 0, < size();} which entry to set
+ * @param item {@code non-null;} the item
*/
public void set(int n, Item item) {
if (item == null) {
@@ -77,13 +77,13 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which entry to set
- * @param startPc >= 0; the start pc (inclusive) of the handler's range
- * @param endPc >= startPc; the end pc (exclusive) of the
+ * @param n {@code >= 0, < size();} which entry to set
+ * @param startPc {@code >= 0;} the start pc (inclusive) of the handler's range
+ * @param endPc {@code >= startPc;} the end pc (exclusive) of the
* handler's range
- * @param handlerPc >= 0; the pc of the exception handler
- * @param exceptionClass null-ok; the exception class or
- * <code>null</code> to catch all exceptions with this handler
+ * @param handlerPc {@code >= 0;} the pc of the exception handler
+ * @param exceptionClass {@code null-ok;} the exception class or
+ * {@code null} to catch all exceptions with this handler
*/
public void set(int n, int startPc, int endPc, int handlerPc,
CstType exceptionClass) {
@@ -95,8 +95,8 @@
* automatically made immutable.
*
* @param pc which address
- * @return non-null; list of exception handlers active at
- * <code>pc</code>
+ * @return {@code non-null;} list of exception handlers active at
+ * {@code pc}
*/
public ByteCatchList listFor(int pc) {
int sz = size();
@@ -128,12 +128,12 @@
* Helper method for {@link #listFor}, which tells whether a match
* is <i>not</i> found for the exception type of the given item in
* the given array. A match is considered to be either an exact type
- * match or the class <code>Object</code> which represents a catch-all.
+ * match or the class {@code Object} which represents a catch-all.
*
- * @param item non-null; item with the exception type to look for
- * @param arr non-null; array to search in
- * @param count non-null; maximum number of elements in the array to check
- * @return <code>true</code> iff the exception type is <i>not</i> found
+ * @param item {@code non-null;} item with the exception type to look for
+ * @param arr {@code non-null;} array to search in
+ * @param count {@code non-null;} maximum number of elements in the array to check
+ * @return {@code true} iff the exception type is <i>not</i> found
*/
private static boolean typeNotFound(Item item, Item[] arr, int count) {
CstType type = item.getExceptionClass();
@@ -151,13 +151,13 @@
/**
* Returns a target list corresponding to this instance. The result
* is a list of all the exception handler addresses, with the given
- * <code>noException</code> address appended if appropriate. The
+ * {@code noException} address appended if appropriate. The
* result is automatically made immutable.
*
- * @param noException >= -1; the no-exception address to append, or
- * <code>-1</code> not to append anything
- * @return non-null; list of exception targets, with
- * <code>noException</code> appended if necessary
+ * @param noException {@code >= -1;} the no-exception address to append, or
+ * {@code -1} not to append anything
+ * @return {@code non-null;} list of exception targets, with
+ * {@code noException} appended if necessary
*/
public IntList toTargetList(int noException) {
if (noException < -1) {
@@ -199,7 +199,7 @@
/**
* Returns a rop-style catches list equivalent to this one.
*
- * @return non-null; the converted instance
+ * @return {@code non-null;} the converted instance
*/
public TypeList toRopCatchList() {
int sz = size();
@@ -221,29 +221,29 @@
* Item in an exception handler list.
*/
public static class Item {
- /** >= 0; the start pc (inclusive) of the handler's range */
+ /** {@code >= 0;} the start pc (inclusive) of the handler's range */
private final int startPc;
- /** >= startPc; the end pc (exclusive) of the handler's range */
+ /** {@code >= startPc;} the end pc (exclusive) of the handler's range */
private final int endPc;
- /** >= 0; the pc of the exception handler */
+ /** {@code >= 0;} the pc of the exception handler */
private final int handlerPc;
- /** null-ok; the exception class or <code>null</code> to catch all
+ /** {@code null-ok;} the exception class or {@code null} to catch all
* exceptions with this handler */
private final CstType exceptionClass;
/**
* Constructs an instance.
*
- * @param startPc >= 0; the start pc (inclusive) of the
+ * @param startPc {@code >= 0;} the start pc (inclusive) of the
* handler's range
- * @param endPc >= startPc; the end pc (exclusive) of the
+ * @param endPc {@code >= startPc;} the end pc (exclusive) of the
* handler's range
- * @param handlerPc >= 0; the pc of the exception handler
- * @param exceptionClass null-ok; the exception class or
- * <code>null</code> to catch all exceptions with this handler
+ * @param handlerPc {@code >= 0;} the pc of the exception handler
+ * @param exceptionClass {@code null-ok;} the exception class or
+ * {@code null} to catch all exceptions with this handler
*/
public Item(int startPc, int endPc, int handlerPc,
CstType exceptionClass) {
@@ -268,7 +268,7 @@
/**
* Gets the start pc (inclusive) of the handler's range.
*
- * @return >= 0; the start pc (inclusive) of the handler's range.
+ * @return {@code >= 0;} the start pc (inclusive) of the handler's range.
*/
public int getStartPc() {
return startPc;
@@ -277,7 +277,7 @@
/**
* Gets the end pc (exclusive) of the handler's range.
*
- * @return >= startPc; the end pc (exclusive) of the
+ * @return {@code >= startPc;} the end pc (exclusive) of the
* handler's range.
*/
public int getEndPc() {
@@ -287,7 +287,7 @@
/**
* Gets the pc of the exception handler.
*
- * @return >= 0; the pc of the exception handler
+ * @return {@code >= 0;} the pc of the exception handler
*/
public int getHandlerPc() {
return handlerPc;
@@ -296,7 +296,7 @@
/**
* Gets the class of exception handled.
*
- * @return non-null; the exception class; {@link CstType#OBJECT}
+ * @return {@code non-null;} the exception class; {@link CstType#OBJECT}
* if this entry handles all possible exceptions
*/
public CstType getExceptionClass() {
@@ -308,7 +308,7 @@
* Returns whether the given address is in the range of this item.
*
* @param pc the address
- * @return <code>true</code> iff this item covers <code>pc</code>
+ * @return {@code true} iff this item covers {@code pc}
*/
public boolean covers(int pc) {
return (pc >= startPc) && (pc < endPc);
diff --git a/dx/src/com/android/dx/cf/code/ByteOps.java b/dx/src/com/android/dx/cf/code/ByteOps.java
index 4c420f6..ea7b514 100644
--- a/dx/src/com/android/dx/cf/code/ByteOps.java
+++ b/dx/src/com/android/dx/cf/code/ByteOps.java
@@ -242,114 +242,114 @@
/** invalid */
public static final int FMT_INVALID = 0;
- /** "-": <code>op</code> */
+ /** "-": {@code op} */
public static final int FMT_NO_ARGS = 1;
- /** "0": <code>op</code>; implies <code>max_locals >= 1</code> */
+ /** "0": {@code op}; implies {@code max_locals >= 1} */
public static final int FMT_NO_ARGS_LOCALS_1 = 2;
- /** "1": <code>op</code>; implies <code>max_locals >= 2</code> */
+ /** "1": {@code op}; implies {@code max_locals >= 2} */
public static final int FMT_NO_ARGS_LOCALS_2 = 3;
- /** "2": <code>op</code>; implies <code>max_locals >= 3</code> */
+ /** "2": {@code op}; implies {@code max_locals >= 3} */
public static final int FMT_NO_ARGS_LOCALS_3 = 4;
- /** "3": <code>op</code>; implies <code>max_locals >= 4</code> */
+ /** "3": {@code op}; implies {@code max_locals >= 4} */
public static final int FMT_NO_ARGS_LOCALS_4 = 5;
- /** "4": <code>op</code>; implies <code>max_locals >= 5</code> */
+ /** "4": {@code op}; implies {@code max_locals >= 5} */
public static final int FMT_NO_ARGS_LOCALS_5 = 6;
- /** "b": <code>op target target</code> */
+ /** "b": {@code op target target} */
public static final int FMT_BRANCH = 7;
- /** "c": <code>op target target target target</code> */
+ /** "c": {@code op target target target target} */
public static final int FMT_WIDE_BRANCH = 8;
- /** "p": <code>op #cpi #cpi</code>; constant restricted as specified */
+ /** "p": {@code op #cpi #cpi}; constant restricted as specified */
public static final int FMT_CPI = 9;
/**
- * "l": <code>op local</code>; category-1 local; implies
- * <code>max_locals</code> is at least two more than the given
+ * "l": {@code op local}; category-1 local; implies
+ * {@code max_locals} is at least two more than the given
* local number
*/
public static final int FMT_LOCAL_1 = 10;
/**
- * "m": <code>op local</code>; category-2 local; implies
- * <code>max_locals</code> is at least two more than the given
+ * "m": {@code op local}; category-2 local; implies
+ * {@code max_locals} is at least two more than the given
* local number
*/
public static final int FMT_LOCAL_2 = 11;
/**
- * "y": <code>op #byte</code> (<code>bipush</code> and
- * <code>newarray</code>)
+ * "y": {@code op #byte} ({@code bipush} and
+ * {@code newarray})
*/
public static final int FMT_LITERAL_BYTE = 12;
- /** "I": <code>invokeinterface cpi cpi count 0</code> */
+ /** "I": {@code invokeinterface cpi cpi count 0} */
public static final int FMT_INVOKEINTERFACE = 13;
- /** "L": <code>ldc #cpi</code>; constant restricted as specified */
+ /** "L": {@code ldc #cpi}; constant restricted as specified */
public static final int FMT_LDC = 14;
- /** "S": <code>sipush #byte #byte</code> */
+ /** "S": {@code sipush #byte #byte} */
public static final int FMT_SIPUSH = 15;
- /** "T": <code>tableswitch ...</code> */
+ /** "T": {@code tableswitch ...} */
public static final int FMT_TABLESWITCH = 16;
- /** "U": <code>lookupswitch ...</code> */
+ /** "U": {@code lookupswitch ...} */
public static final int FMT_LOOKUPSWITCH = 17;
- /** "M": <code>multianewarray cpi cpi dims</code> */
+ /** "M": {@code multianewarray cpi cpi dims} */
public static final int FMT_MULTIANEWARRAY = 18;
- /** "W": <code>wide ...</code> */
+ /** "W": {@code wide ...} */
public static final int FMT_WIDE = 19;
/** mask for the bits representing the opcode format */
public static final int FMT_MASK = 0x1f;
- /** "I": flag bit for valid cp type for <code>Integer</code> */
+ /** "I": flag bit for valid cp type for {@code Integer} */
public static final int CPOK_Integer = 0x20;
- /** "F": flag bit for valid cp type for <code>Float</code> */
+ /** "F": flag bit for valid cp type for {@code Float} */
public static final int CPOK_Float = 0x40;
- /** "J": flag bit for valid cp type for <code>Long</code> */
+ /** "J": flag bit for valid cp type for {@code Long} */
public static final int CPOK_Long = 0x80;
- /** "D": flag bit for valid cp type for <code>Double</code> */
+ /** "D": flag bit for valid cp type for {@code Double} */
public static final int CPOK_Double = 0x100;
- /** "c": flag bit for valid cp type for <code>Class</code> */
+ /** "c": flag bit for valid cp type for {@code Class} */
public static final int CPOK_Class = 0x200;
- /** "s": flag bit for valid cp type for <code>String</code> */
+ /** "s": flag bit for valid cp type for {@code String} */
public static final int CPOK_String = 0x400;
- /** "f": flag bit for valid cp type for <code>Fieldref</code> */
+ /** "f": flag bit for valid cp type for {@code Fieldref} */
public static final int CPOK_Fieldref = 0x800;
- /** "m": flag bit for valid cp type for <code>Methodref</code> */
+ /** "m": flag bit for valid cp type for {@code Methodref} */
public static final int CPOK_Methodref = 0x1000;
- /** "i": flag bit for valid cp type for <code>InterfaceMethodref</code> */
+ /** "i": flag bit for valid cp type for {@code InterfaceMethodref} */
public static final int CPOK_InterfaceMethodref = 0x2000;
/**
- * non-null; map from opcodes to format or'ed with allowed constant
+ * {@code non-null;} map from opcodes to format or'ed with allowed constant
* pool types
*/
private static final int[] OPCODE_INFO = new int[256];
- /** non-null; map from opcodes to their names */
+ /** {@code non-null;} map from opcodes to their names */
private static final String[] OPCODE_NAMES = new String[256];
- /** non-null; bigass string describing all the opcodes */
+ /** {@code non-null;} bigass string describing all the opcodes */
private static final String OPCODE_DETAILS =
"00 - nop;" +
"01 - aconst_null;" +
@@ -623,8 +623,8 @@
/**
* Gets the name of the given opcode.
*
- * @param opcode >= 0, <= 255; the opcode
- * @return non-null; its name
+ * @param opcode {@code >= 0, <= 255;} the opcode
+ * @return {@code non-null;} its name
*/
public static String opName(int opcode) {
String result = OPCODE_NAMES[opcode];
@@ -640,7 +640,7 @@
/**
* Gets the format and allowed cp types of the given opcode.
*
- * @param opcode >= 0, <= 255; the opcode
+ * @param opcode {@code >= 0, <= 255;} the opcode
* @return its format and allowed cp types
*/
public static int opInfo(int opcode) {
diff --git a/dx/src/com/android/dx/cf/code/BytecodeArray.java b/dx/src/com/android/dx/cf/code/BytecodeArray.java
index 71ba029..60f0cee 100644
--- a/dx/src/com/android/dx/cf/code/BytecodeArray.java
+++ b/dx/src/com/android/dx/cf/code/BytecodeArray.java
@@ -32,23 +32,23 @@
import java.util.ArrayList;
/**
- * Bytecode array, which is part of a standard <code>Code</code> attribute.
+ * Bytecode array, which is part of a standard {@code Code} attribute.
*/
public final class BytecodeArray {
/** convenient no-op implementation of {@link Visitor} */
public static final Visitor EMPTY_VISITOR = new BaseVisitor();
- /** non-null; underlying bytes */
+ /** {@code non-null;} underlying bytes */
private final ByteArray bytes;
- /** non-null; constant pool to use when resolving constant pool indices */
+ /** {@code non-null;} constant pool to use when resolving constant pool indices */
private final ConstantPool pool;
/**
* Constructs an instance.
*
- * @param bytes non-null; underlying bytes
- * @param pool non-null; constant pool to use when resolving constant
+ * @param bytes {@code non-null;} underlying bytes
+ * @param pool {@code non-null;} constant pool to use when resolving constant
* pool indices
*/
public BytecodeArray(ByteArray bytes, ConstantPool pool) {
@@ -67,7 +67,7 @@
/**
* Gets the underlying byte array.
*
- * @return non-null; the byte array
+ * @return {@code non-null;} the byte array
*/
public ByteArray getBytes() {
return bytes;
@@ -76,7 +76,7 @@
/**
* Gets the size of the bytecode array, per se.
*
- * @return >= 0; the length of the bytecode array
+ * @return {@code >= 0;} the length of the bytecode array
*/
public int size() {
return bytes.size();
@@ -84,10 +84,10 @@
/**
* Gets the total length of this structure in bytes, when included in
- * a <code>Code</code> attribute. The returned value includes the
- * array size plus four bytes for <code>code_length</code>.
+ * a {@code Code} attribute. The returned value includes the
+ * array size plus four bytes for {@code code_length}.
*
- * @return >= 4; the total length, in bytes
+ * @return {@code >= 4;} the total length, in bytes
*/
public int byteLength() {
return 4 + bytes.size();
@@ -96,7 +96,7 @@
/**
* Parses each instruction in the array, in order.
*
- * @param visitor null-ok; visitor to call back to for each instruction
+ * @param visitor {@code null-ok;} visitor to call back to for each instruction
*/
public void forEach(Visitor visitor) {
int sz = bytes.size();
@@ -116,7 +116,7 @@
* result is a bit set with the offset of each opcode-per-se flipped on.
*
* @see Bits
- * @return non-null; appropriately constructed bit set
+ * @return {@code non-null;} appropriately constructed bit set
*/
public int[] getInstructionOffsets() {
int sz = bytes.size();
@@ -139,8 +139,8 @@
* work set is empty. It is expected that the visitor will regularly
* set new bits in the work set during the process.
*
- * @param workSet non-null; the work set to process
- * @param visitor non-null; visitor to call back to for each instruction
+ * @param workSet {@code non-null;} the work set to process
+ * @param visitor {@code non-null;} visitor to call back to for each instruction
*/
public void processWorkSet(int[] workSet, Visitor visitor) {
if (visitor == null) {
@@ -170,42 +170,42 @@
*
* <ul>
* <li>The opcodes to push literal constants of primitive types all become
- * <code>ldc</code>.
- * E.g., <code>fconst_0</code>, <code>sipush</code>, and
- * <code>lconst_0</code> qualify for this treatment.</li>
- * <li><code>aconst_null</code> becomes <code>ldc</code> of a
+ * {@code ldc}.
+ * E.g., {@code fconst_0}, {@code sipush}, and
+ * {@code lconst_0} qualify for this treatment.</li>
+ * <li>{@code aconst_null} becomes {@code ldc} of a
* "known null."</li>
* <li>Shorthand local variable accessors become the corresponding
- * longhand. E.g. <code>aload_2</code> becomes <code>aload</code>.</li>
- * <li><code>goto_w</code> and <code>jsr_w</code> become <code>goto</code>
- * and <code>jsr</code> (respectively).</li>
- * <li><code>ldc_w</code> becomes <code>ldc</code>.</li>
- * <li><code>tableswitch</code> becomes <code>lookupswitch</code>.
+ * longhand. E.g. {@code aload_2} becomes {@code aload}.</li>
+ * <li>{@code goto_w} and {@code jsr_w} become {@code goto}
+ * and {@code jsr} (respectively).</li>
+ * <li>{@code ldc_w} becomes {@code ldc}.</li>
+ * <li>{@code tableswitch} becomes {@code lookupswitch}.
* <li>Arithmetic, array, and value-returning ops are collapsed
- * to the <code>int</code> variant opcode, with the <code>type</code>
+ * to the {@code int} variant opcode, with the {@code type}
* argument set to indicate the actual type. E.g.,
- * <code>fadd</code> becomes <code>iadd</code>, but
- * <code>type</code> is passed as <code>Type.FLOAT</code> in that
- * case. Similarly, <code>areturn</code> becomes
- * <code>ireturn</code>. (However, <code>return</code> remains
+ * {@code fadd} becomes {@code iadd}, but
+ * {@code type} is passed as {@code Type.FLOAT} in that
+ * case. Similarly, {@code areturn} becomes
+ * {@code ireturn}. (However, {@code return} remains
* unchanged.</li>
- * <li>Local variable access ops are collapsed to the <code>int</code>
- * variant opcode, with the <code>type</code> argument set to indicate
- * the actual type. E.g., <code>aload</code> becomes <code>iload</code>,
- * but <code>type</code> is passed as <code>Type.OBJECT</code> in
+ * <li>Local variable access ops are collapsed to the {@code int}
+ * variant opcode, with the {@code type} argument set to indicate
+ * the actual type. E.g., {@code aload} becomes {@code iload},
+ * but {@code type} is passed as {@code Type.OBJECT} in
* that case.</li>
- * <li>Numeric conversion ops (<code>i2l</code>, etc.) are left alone
- * to avoid too much confustion, but their <code>type</code> is
- * the pushed type. E.g., <code>i2b</code> gets type
- * <code>Type.INT</code>, and <code>f2d</code> gets type
- * <code>Type.DOUBLE</code>. Other unaltered opcodes also get
- * their pushed type. E.g., <code>arraylength</code> gets type
- * <code>Type.INT</code>.</li>
+ * <li>Numeric conversion ops ({@code i2l}, etc.) are left alone
+ * to avoid too much confustion, but their {@code type} is
+ * the pushed type. E.g., {@code i2b} gets type
+ * {@code Type.INT}, and {@code f2d} gets type
+ * {@code Type.DOUBLE}. Other unaltered opcodes also get
+ * their pushed type. E.g., {@code arraylength} gets type
+ * {@code Type.INT}.</li>
* </ul>
*
- * @param offset >= 0, < bytes.size(); offset to the start of the
+ * @param offset {@code >= 0, < bytes.size();} offset to the start of the
* instruction
- * @param visitor null-ok; visitor to call back to
+ * @param visitor {@code null-ok;} visitor to call back to
* @return the length of the instruction, in bytes
*/
public int parseInstruction(int offset, Visitor visitor) {
@@ -797,10 +797,10 @@
}
/**
- * Helper to deal with <code>tableswitch</code>.
+ * Helper to deal with {@code tableswitch}.
*
- * @param offset the offset to the <code>tableswitch</code> opcode itself
- * @param visitor non-null; visitor to use
+ * @param offset the offset to the {@code tableswitch} opcode itself
+ * @param visitor {@code non-null;} visitor to use
* @return instruction length, in bytes
*/
private int parseTableswitch(int offset, Visitor visitor) {
@@ -840,10 +840,10 @@
}
/**
- * Helper to deal with <code>lookupswitch</code>.
+ * Helper to deal with {@code lookupswitch}.
*
- * @param offset the offset to the <code>lookupswitch</code> opcode itself
- * @param visitor non-null; visitor to use
+ * @param offset the offset to the {@code lookupswitch} opcode itself
+ * @param visitor {@code non-null;} visitor to use
* @return instruction length, in bytes
*/
private int parseLookupswitch(int offset, Visitor visitor) {
@@ -878,10 +878,10 @@
}
/**
- * Helper to deal with <code>newarray</code>.
+ * Helper to deal with {@code newarray}.
*
- * @param offset the offset to the <code>newarray</code> opcode itself
- * @param visitor non-null; visitor to use
+ * @param offset the offset to the {@code newarray} opcode itself
+ * @param visitor {@code non-null;} visitor to use
* @return instruction length, in bytes
*/
private int parseNewarray(int offset, Visitor visitor) {
@@ -1061,10 +1061,10 @@
/**
- * Helper to deal with <code>wide</code>.
+ * Helper to deal with {@code wide}.
*
- * @param offset the offset to the <code>wide</code> opcode itself
- * @param visitor non-null; visitor to use
+ * @param offset the offset to the {@code wide} opcode itself
+ * @param visitor {@code non-null;} visitor to use
* @return instruction length, in bytes
*/
private int parseWide(int offset, Visitor visitor) {
@@ -1159,7 +1159,7 @@
* @param opcode the opcode
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param type non-null; type the instruction operates on
+ * @param type {@code non-null;} type the instruction operates on
*/
public void visitNoArgs(int opcode, int offset, int length,
Type type);
@@ -1171,9 +1171,9 @@
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
* @param idx the local variable index
- * @param type non-null; the type of the accessed value
+ * @param type {@code non-null;} the type of the accessed value
* @param value additional literal integer argument, if salient (i.e.,
- * for <code>iinc</code>)
+ * for {@code iinc})
*/
public void visitLocal(int opcode, int offset, int length,
int idx, Type type, int value);
@@ -1182,23 +1182,23 @@
* Visits an instruction which has a (possibly synthetic)
* constant argument, and possibly also an
* additional literal integer argument. In the case of
- * <code>multianewarray</code>, the argument is the count of
- * dimensions. In the case of <code>invokeinterface</code>,
+ * {@code multianewarray}, the argument is the count of
+ * dimensions. In the case of {@code invokeinterface},
* the argument is the parameter count or'ed with the
* should-be-zero value left-shifted by 8. In the case of entries
- * of type <code>int</code>, the <code>value</code> field always
+ * of type {@code int}, the {@code value} field always
* holds the raw value (for convenience of clients).
*
* <p><b>Note:</b> In order to avoid giving it a barely-useful
- * visitor all its own, <code>newarray</code> also uses this
- * form, passing <code>value</code> as the array type code and
- * <code>cst</code> as a {@link CstType} instance
+ * visitor all its own, {@code newarray} also uses this
+ * form, passing {@code value} as the array type code and
+ * {@code cst} as a {@link CstType} instance
* corresponding to the array type.</p>
*
* @param opcode the opcode
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param cst non-null; the constant
+ * @param cst {@code non-null;} the constant
* @param value additional literal integer argument, if salient
* (ignore if not)
*/
@@ -1222,7 +1222,7 @@
* @param opcode the opcode
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param cases non-null; list of (value, target) pairs, plus the
+ * @param cases {@code non-null;} list of (value, target) pairs, plus the
* default target
* @param padding the bytes found in the padding area (if any),
* packed
@@ -1235,8 +1235,8 @@
*
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param cst non-null; the type of the array
- * @param initVals non-null; list of bytecode offsets for init values
+ * @param cst {@code non-null;} the type of the array
+ * @param initVals {@code non-null;} list of bytecode offsets for init values
*/
public void visitNewarray(int offset, int length, CstType type,
ArrayList<Constant> initVals);
diff --git a/dx/src/com/android/dx/cf/code/ConcreteMethod.java b/dx/src/com/android/dx/cf/code/ConcreteMethod.java
index 47f698d..70b6b45 100644
--- a/dx/src/com/android/dx/cf/code/ConcreteMethod.java
+++ b/dx/src/com/android/dx/cf/code/ConcreteMethod.java
@@ -35,38 +35,38 @@
* Container for all the giblets that make up a concrete Java bytecode method.
* It implements {@link Method}, so it provides all the original access
* (by delegation), but it also constructs and keeps useful versions of
- * stuff extracted from the method's <code>Code</code> attribute.
+ * stuff extracted from the method's {@code Code} attribute.
*/
public final class ConcreteMethod implements Method {
- /** non-null; method being wrapped */
+ /** {@code non-null;} method being wrapped */
private final Method method;
/**
- * null-ok; the class's <code>SourceFile</code> attribute value,
+ * {@code null-ok;} the class's {@code SourceFile} attribute value,
* if any
*/
private final CstUtf8 sourceFile;
/**
* whether the class that this method is part of is defined with
- * <code>ACC_SUPER</code>
+ * {@code ACC_SUPER}
*/
private final boolean accSuper;
- /** non-null; the code attribute */
+ /** {@code non-null;} the code attribute */
private final AttCode attCode;
- /** non-null; line number list */
+ /** {@code non-null;} line number list */
private final LineNumberList lineNumbers;
- /** non-null; local variable list */
+ /** {@code non-null;} local variable list */
private final LocalVariableList localVariables;
/**
* Constructs an instance.
*
- * @param method non-null; the method to be based on
- * @param cf non-null; the class file that contains this method
+ * @param method {@code non-null;} the method to be based on
+ * @param cf {@code non-null;} the class file that contains this method
* @param keepLines whether to keep the line number information
* (if any)
* @param keepLocals whether to keep the local variable
@@ -178,9 +178,9 @@
/**
* Gets whether the class that this method is part of is defined with
- * <code>ACC_SUPER</code>.
+ * {@code ACC_SUPER}.
*
- * @return the <code>ACC_SUPER</code> value
+ * @return the {@code ACC_SUPER} value
*/
public boolean getAccSuper() {
return accSuper;
@@ -189,7 +189,7 @@
/**
* Gets the maximum stack size.
*
- * @return >= 0; the maximum stack size
+ * @return {@code >= 0;} the maximum stack size
*/
public int getMaxStack() {
return attCode.getMaxStack();
@@ -198,7 +198,7 @@
/**
* Gets the number of locals.
*
- * @return >= 0; the number of locals
+ * @return {@code >= 0;} the number of locals
*/
public int getMaxLocals() {
return attCode.getMaxLocals();
@@ -207,7 +207,7 @@
/**
* Gets the bytecode array.
*
- * @return non-null; the bytecode array
+ * @return {@code non-null;} the bytecode array
*/
public BytecodeArray getCode() {
return attCode.getCode();
@@ -216,7 +216,7 @@
/**
* Gets the exception table.
*
- * @return non-null; the exception table
+ * @return {@code non-null;} the exception table
*/
public ByteCatchList getCatches() {
return attCode.getCatches();
@@ -225,7 +225,7 @@
/**
* Gets the line number list.
*
- * @return non-null; the line number list
+ * @return {@code non-null;} the line number list
*/
public LineNumberList getLineNumbers() {
return lineNumbers;
@@ -234,7 +234,7 @@
/**
* Gets the local variable list.
*
- * @return non-null; the local variable list
+ * @return {@code non-null;} the local variable list
*/
public LocalVariableList getLocalVariables() {
return localVariables;
@@ -244,8 +244,8 @@
* Returns a {@link SourcePosition} instance corresponding to the
* given bytecode offset.
*
- * @param offset >= 0; the bytecode offset
- * @return non-null; an appropriate instance
+ * @param offset {@code >= 0;} the bytecode offset
+ * @return {@code non-null;} an appropriate instance
*/
public SourcePosition makeSourcePosistion(int offset) {
return new SourcePosition(sourceFile, offset,
diff --git a/dx/src/com/android/dx/cf/code/ExecutionStack.java b/dx/src/com/android/dx/cf/code/ExecutionStack.java
index 1a2b565..15a9e6c 100644
--- a/dx/src/com/android/dx/cf/code/ExecutionStack.java
+++ b/dx/src/com/android/dx/cf/code/ExecutionStack.java
@@ -30,11 +30,11 @@
* TypeBearer}.</p>
*/
public final class ExecutionStack extends MutabilityControl {
- /** non-null; array of stack contents */
+ /** {@code non-null;} array of stack contents */
private final TypeBearer[] stack;
/**
- * >= 0; stack pointer (points one past the end) / current stack
+ * {@code >= 0;} stack pointer (points one past the end) / current stack
* size
*/
private int stackPtr;
@@ -42,7 +42,7 @@
/**
* Constructs an instance.
*
- * @param maxStack >= 0; the maximum size of the stack for this
+ * @param maxStack {@code >= 0;} the maximum size of the stack for this
* instance
*/
public ExecutionStack(int maxStack) {
@@ -54,7 +54,7 @@
/**
* Makes and returns a mutable copy of this instance.
*
- * @return non-null; the copy
+ * @return {@code non-null;} the copy
*/
public ExecutionStack copy() {
ExecutionStack result = new ExecutionStack(stack.length);
@@ -69,7 +69,7 @@
* Annotates (adds context to) the given exception with information
* about this instance.
*
- * @param ex non-null; the exception to annotate
+ * @param ex {@code non-null;} the exception to annotate
*/
public void annotate(ExceptionWithContext ex) {
int limit = stackPtr - 1;
@@ -86,7 +86,7 @@
* Replaces all the occurrences of the given uninitialized type in
* this stack with its initialized equivalent.
*
- * @param type non-null; type to replace
+ * @param type {@code non-null;} type to replace
*/
public void makeInitialized(Type type) {
if (stackPtr == 0) {
@@ -108,7 +108,7 @@
/**
* Gets the maximum stack size for this instance.
*
- * @return >= 0; the max stack size
+ * @return {@code >= 0;} the max stack size
*/
public int getMaxStack() {
return stack.length;
@@ -117,7 +117,7 @@
/**
* Gets the current stack size.
*
- * @return >= 0, < getMaxStack(); the current stack size
+ * @return {@code >= 0, < getMaxStack();} the current stack size
*/
public int size() {
return stackPtr;
@@ -139,7 +139,7 @@
/**
* Pushes a value of the given type onto the stack.
*
- * @param type non-null; type of the value
+ * @param type {@code non-null;} type of the value
* @throws SimException thrown if there is insufficient room on the
* stack for the value
*/
@@ -171,14 +171,14 @@
}
/**
- * Peeks at the <code>n</code>th element down from the top of the stack.
- * <code>n == 0</code> means to peek at the top of the stack. Note that
- * this will return <code>null</code> if the indicated element is the
+ * Peeks at the {@code n}th element down from the top of the stack.
+ * {@code n == 0} means to peek at the top of the stack. Note that
+ * this will return {@code null} if the indicated element is the
* deeper half of a category-2 value.
*
- * @param n >= 0; which element to peek at
- * @return null-ok; the type of value stored at that element
- * @throws SimException thrown if <code>n >= size()</code>
+ * @param n {@code >= 0;} which element to peek at
+ * @return {@code null-ok;} the type of value stored at that element
+ * @throws SimException thrown if {@code n >= size()}
*/
public TypeBearer peek(int n) {
if (n < 0) {
@@ -193,10 +193,10 @@
}
/**
- * Peeks at the <code>n</code>th element down from the top of the
+ * Peeks at the {@code n}th element down from the top of the
* stack, returning the type per se, as opposed to the
* <i>type-bearer</i>. This method is just a convenient shorthand
- * for <code>peek(n).getType()</code>.
+ * for {@code peek(n).getType()}.
*
* @see #peek
*/
@@ -207,7 +207,7 @@
/**
* Pops the top element off of the stack.
*
- * @return non-null; the type formerly on the top of the stack
+ * @return {@code non-null;} the type formerly on the top of the stack
* @throws SimException thrown if the stack is empty
*/
public TypeBearer pop() {
@@ -227,10 +227,10 @@
* the following restriction on its behavior: You may only replace
* values with other values of the same category.
*
- * @param n >= 0; which element to change, where <code>0</code> is
+ * @param n {@code >= 0;} which element to change, where {@code 0} is
* the top element of the stack
- * @param type non-null; type of the new value
- * @throws SimException thrown if <code>n >= size()</code> or
+ * @param type {@code non-null;} type of the new value
+ * @throws SimException thrown if {@code n >= size()} or
* the action is otherwise prohibited
*/
public void change(int n, TypeBearer type) {
@@ -262,8 +262,8 @@
* returned. See {@link Merger#mergeStack(ExecutionStack,ExecutionStack)
* Merger.mergeStack()}
*
- * @param other non-null; a stack to merge with
- * @return non-null; the result of the merge
+ * @param other {@code non-null;} a stack to merge with
+ * @return {@code non-null;} the result of the merge
*/
public ExecutionStack merge(ExecutionStack other) {
try {
@@ -279,11 +279,11 @@
/**
* Gets the string form for a stack element. This is the same as
- * <code>toString()</code> except that <code>null</code> is converted
- * to <code>"<invalid>"</code>.
+ * {@code toString()} except that {@code null} is converted
+ * to {@code "<invalid>"}.
*
- * @param type null-ok; the stack element
- * @return non-null; the string form
+ * @param type {@code null-ok;} the stack element
+ * @return {@code non-null;} the string form
*/
private static String stackElementString(TypeBearer type) {
if (type == null) {
@@ -296,7 +296,7 @@
/**
* Throws a properly-formatted exception.
*
- * @param msg non-null; useful message
+ * @param msg {@code non-null;} useful message
* @return never (keeps compiler happy)
*/
private static TypeBearer throwSimException(String msg) {
diff --git a/dx/src/com/android/dx/cf/code/Frame.java b/dx/src/com/android/dx/cf/code/Frame.java
index a74d142..f345335 100644
--- a/dx/src/com/android/dx/cf/code/Frame.java
+++ b/dx/src/com/android/dx/cf/code/Frame.java
@@ -29,20 +29,20 @@
* results" area.
*/
public final class Frame {
- /** non-null; the locals */
+ /** {@code non-null;} the locals */
private final LocalsArray locals;
- /** non-null; the stack */
+ /** {@code non-null;} the stack */
private final ExecutionStack stack;
- /** null-ok; stack of labels of subroutines that this block is nested in */
+ /** {@code null-ok;} stack of labels of subroutines that this block is nested in */
private final IntList subroutines;
/**
* Constructs an instance.
*
- * @param locals non-null; the locals array to use
- * @param stack non-null; the execution stack to use
+ * @param locals {@code non-null;} the locals array to use
+ * @param stack {@code non-null;} the execution stack to use
*/
private Frame(LocalsArray locals, ExecutionStack stack) {
this(locals, stack, IntList.EMPTY);
@@ -51,9 +51,9 @@
/**
* Constructs an instance.
*
- * @param locals non-null; the locals array to use
- * @param stack non-null; the execution stack to use
- * @param subroutines non-null; list of subroutine start labels for
+ * @param locals {@code non-null;} the locals array to use
+ * @param stack {@code non-null;} the execution stack to use
+ * @param subroutines {@code non-null;} list of subroutine start labels for
* subroutines this frame is nested in
*/
private Frame(LocalsArray locals,
@@ -75,12 +75,12 @@
/**
* Constructs an instance. The locals array initially consists of
- * all-uninitialized values (represented as <code>null</code>s) and
+ * all-uninitialized values (represented as {@code null}s) and
* the stack starts out empty.
*
- * @param maxLocals >= 0; the maximum number of locals this instance
+ * @param maxLocals {@code >= 0;} the maximum number of locals this instance
* can refer to
- * @param maxStack >= 0; the maximum size of the stack for this
+ * @param maxStack {@code >= 0;} the maximum size of the stack for this
* instance
*/
public Frame(int maxLocals, int maxStack) {
@@ -92,7 +92,7 @@
* contains copies of the locals and stack (that is, it doesn't
* share them with the original).
*
- * @return non-null; the copy
+ * @return {@code non-null;} the copy
*/
public Frame copy() {
return new Frame(locals.copy(), stack.copy(), subroutines);
@@ -111,7 +111,7 @@
* Replaces all the occurrences of the given uninitialized type in
* this frame with its initialized equivalent.
*
- * @param type non-null; type to replace
+ * @param type {@code non-null;} type to replace
*/
public void makeInitialized(Type type) {
locals.makeInitialized(type);
@@ -121,7 +121,7 @@
/**
* Gets the locals array for this instance.
*
- * @return non-null; the locals array
+ * @return {@code non-null;} the locals array
*/
public LocalsArray getLocals() {
return locals;
@@ -130,7 +130,7 @@
/**
* Gets the execution stack for this instance.
*
- * @return non-null; the execution stack
+ * @return {@code non-null;} the execution stack
*/
public ExecutionStack getStack() {
return stack;
@@ -143,7 +143,7 @@
* list is ordered such that the deepest nesting (the actual subroutine
* this block is in) is the last label in the list.
*
- * @return non-null; list as noted above
+ * @return {@code non-null;} list as noted above
*/
public IntList getSubroutines() {
return subroutines;
@@ -171,10 +171,10 @@
* be used when returning from a subroutine. The stack state of all
* subroutine invocations is identical, but the locals state may differ.
*
- * @param startLabel >=0; The label of the returning subroutine's
+ * @param startLabel {@code >=0;} The label of the returning subroutine's
* start block
- * @param subLabel >=0; A calling label of a subroutine
- * @return null-ok; an appropriatly-constructed instance, or null
+ * @param subLabel {@code >=0;} A calling label of a subroutine
+ * @return {@code null-ok;} an appropriatly-constructed instance, or null
* if label is not in the set
*/
public Frame subFrameForLabel(int startLabel, int subLabel) {
@@ -206,8 +206,8 @@
* Merges two frames. If the merged result is the same as this frame,
* then this instance is returned.
*
- * @param other non-null; another frame
- * @return non-null; the result of merging the two frames
+ * @param other {@code non-null;} another frame
+ * @return {@code non-null;} the result of merging the two frames
*/
public Frame mergeWith(Frame other) {
LocalsArray resultLocals;
@@ -237,7 +237,7 @@
*
* @param otherSubroutines label list of subroutine start blocks, from
* least-nested to most-nested.
- * @return non-null; merged subroutine nest list as described above
+ * @return {@code non-null;} merged subroutine nest list as described above
*/
private IntList mergeSubroutineLists(IntList otherSubroutines) {
if (subroutines.equals(otherSubroutines)) {
@@ -265,10 +265,10 @@
* need to be trimmed of all OneLocalsArray elements that relevent to
* the subroutine that is returning.
*
- * @param locals non-null; LocalsArray from before a merge
- * @param subroutines non-null; a label list of subroutine start blocks
+ * @param locals {@code non-null;} LocalsArray from before a merge
+ * @param subroutines {@code non-null;} a label list of subroutine start blocks
* representing the subroutine nesting of the block being merged into.
- * @return non-null; locals set appropriate for merge
+ * @return {@code non-null;} locals set appropriate for merge
*/
private static LocalsArray adjustLocalsForSubroutines(
LocalsArray locals, IntList subroutines) {
@@ -301,13 +301,13 @@
/**
* Merges this frame with the frame of a subroutine caller at
- * <code>predLabel</code>. Only called on the frame at the first
+ * {@code predLabel}. Only called on the frame at the first
* block of a subroutine.
*
- * @param other non-null; another frame
+ * @param other {@code non-null;} another frame
* @param subLabel label of subroutine start block
* @param predLabel label of calling block
- * @return non-null; the result of merging the two frames
+ * @return {@code non-null;} the result of merging the two frames
*/
public Frame mergeWithSubroutineCaller(Frame other, int subLabel,
int predLabel) {
@@ -374,7 +374,7 @@
* subroutine calls return.
*
* @param subLabel label of subroutine start block
- * @param callerLabel >=0 label of the caller block where this frame
+ * @param callerLabel {@code >=0;} label of the caller block where this frame
* came from.
* @return a new instance to begin a called subroutine.
*/
@@ -406,7 +406,7 @@
* Annotates (adds context to) the given exception with information
* about this frame.
*
- * @param ex non-null; the exception to annotate
+ * @param ex {@code non-null;} the exception to annotate
*/
public void annotate(ExceptionWithContext ex) {
locals.annotate(ex);
diff --git a/dx/src/com/android/dx/cf/code/LineNumberList.java b/dx/src/com/android/dx/cf/code/LineNumberList.java
index 35875b0..7af3f4e 100644
--- a/dx/src/com/android/dx/cf/code/LineNumberList.java
+++ b/dx/src/com/android/dx/cf/code/LineNumberList.java
@@ -20,19 +20,19 @@
/**
* List of "line number" entries, which are the contents of
- * <code>LineNumberTable</code> attributes.
+ * {@code LineNumberTable} attributes.
*/
public final class LineNumberList extends FixedSizeList {
- /** non-null; zero-size instance */
+ /** {@code non-null;} zero-size instance */
public static final LineNumberList EMPTY = new LineNumberList(0);
/**
* Returns an instance which is the concatenation of the two given
* instances.
*
- * @param list1 non-null; first instance
- * @param list2 non-null; second instance
- * @return non-null; combined instance
+ * @param list1 {@code non-null;} first instance
+ * @param list2 {@code non-null;} second instance
+ * @return {@code non-null;} combined instance
*/
public static LineNumberList concat(LineNumberList list1,
LineNumberList list2) {
@@ -68,8 +68,8 @@
/**
* Gets the indicated item.
*
- * @param n >= 0; which item
- * @return null-ok; the indicated item
+ * @param n {@code >= 0;} which item
+ * @return {@code null-ok;} the indicated item
*/
public Item get(int n) {
return (Item) get0(n);
@@ -78,8 +78,8 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which element
- * @param item non-null; the item
+ * @param n {@code >= 0, < size();} which element
+ * @param item {@code non-null;} the item
*/
public void set(int n, Item item) {
if (item == null) {
@@ -92,9 +92,9 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which element
- * @param startPc >= 0; start pc of this item
- * @param lineNumber >= 0; corresponding line number
+ * @param n {@code >= 0, < size();} which element
+ * @param startPc {@code >= 0;} start pc of this item
+ * @param lineNumber {@code >= 0;} corresponding line number
*/
public void set(int n, int startPc, int lineNumber) {
set0(n, new Item(startPc, lineNumber));
@@ -103,8 +103,8 @@
/**
* Gets the line number associated with the given address.
*
- * @param pc >= 0; the address to look up
- * @return >= -1; the associated line number, or <code>-1</code> if
+ * @param pc {@code >= 0;} the address to look up
+ * @return {@code >= -1;} the associated line number, or {@code -1} if
* none is known
*/
public int pcToLine(int pc) {
@@ -138,17 +138,17 @@
* Item in a line number table.
*/
public static class Item {
- /** >= 0; start pc of this item */
+ /** {@code >= 0;} start pc of this item */
private final int startPc;
- /** >= 0; corresponding line number */
+ /** {@code >= 0;} corresponding line number */
private final int lineNumber;
/**
* Constructs an instance.
*
- * @param startPc >= 0; start pc of this item
- * @param lineNumber >= 0; corresponding line number
+ * @param startPc {@code >= 0;} start pc of this item
+ * @param lineNumber {@code >= 0;} corresponding line number
*/
public Item(int startPc, int lineNumber) {
if (startPc < 0) {
diff --git a/dx/src/com/android/dx/cf/code/LocalVariableList.java b/dx/src/com/android/dx/cf/code/LocalVariableList.java
index 1087603..9f19528 100644
--- a/dx/src/com/android/dx/cf/code/LocalVariableList.java
+++ b/dx/src/com/android/dx/cf/code/LocalVariableList.java
@@ -23,20 +23,20 @@
/**
* List of "local variable" entries, which are the contents of
- * <code>LocalVariableTable</code> and <code>LocalVariableTypeTable</code>
+ * {@code LocalVariableTable} and {@code LocalVariableTypeTable}
* attributes, as well as combinations of the two.
*/
public final class LocalVariableList extends FixedSizeList {
- /** non-null; zero-size instance */
+ /** {@code non-null;} zero-size instance */
public static final LocalVariableList EMPTY = new LocalVariableList(0);
/**
* Returns an instance which is the concatenation of the two given
* instances. The result is immutable.
*
- * @param list1 non-null; first instance
- * @param list2 non-null; second instance
- * @return non-null; combined instance
+ * @param list1 {@code non-null;} first instance
+ * @param list2 {@code non-null;} second instance
+ * @return {@code non-null;} combined instance
*/
public static LocalVariableList concat(LocalVariableList list1,
LocalVariableList list2) {
@@ -70,9 +70,9 @@
* element in the signature list gets augmented with the
* corresponding signature. The result is immutable.
*
- * @param descriptorList non-null; list with descriptors
- * @param signatureList non-null; list with signatures
- * @return non-null; the merged result
+ * @param descriptorList {@code non-null;} list with descriptors
+ * @param signatureList {@code non-null;} list with signatures
+ * @return {@code non-null;} the merged result
*/
public static LocalVariableList mergeDescriptorsAndSignatures(
LocalVariableList descriptorList,
@@ -107,8 +107,8 @@
/**
* Gets the indicated item.
*
- * @param n >= 0; which item
- * @return null-ok; the indicated item
+ * @param n {@code >= 0;} which item
+ * @return {@code null-ok;} the indicated item
*/
public Item get(int n) {
return (Item) get0(n);
@@ -117,8 +117,8 @@
/**
* Sets the item at the given index.
*
- * @param n >= 0, < size(); which element
- * @param item non-null; the item
+ * @param n {@code >= 0, < size();} which element
+ * @param item {@code non-null;} the item
*/
public void set(int n, Item item) {
if (item == null) {
@@ -131,17 +131,17 @@
/**
* Sets the item at the given index.
*
- * <p><b>Note:</b> At least one of <code>descriptor</code> or
- * <code>signature</code> must be passed as non-null.</p>
+ * <p><b>Note:</b> At least one of {@code descriptor} or
+ * {@code signature} must be passed as non-null.</p>
*
- * @param n >= 0, < size(); which element
- * @param startPc >= 0; the start pc of this variable's scope
- * @param length >= 0; the length (in bytecodes) of this variable's
+ * @param n {@code >= 0, < size();} which element
+ * @param startPc {@code >= 0;} the start pc of this variable's scope
+ * @param length {@code >= 0;} the length (in bytecodes) of this variable's
* scope
- * @param name non-null; the variable's name
- * @param descriptor null-ok; the variable's type descriptor
- * @param signature null-ok; the variable's type signature
- * @param index >= 0; the variable's local index
+ * @param name {@code non-null;} the variable's name
+ * @param descriptor {@code null-ok;} the variable's type descriptor
+ * @param signature {@code null-ok;} the variable's type signature
+ * @param index {@code >= 0;} the variable's local index
*/
public void set(int n, int startPc, int length, CstUtf8 name,
CstUtf8 descriptor, CstUtf8 signature, int index) {
@@ -153,9 +153,9 @@
* the given {@link com.android.dx.cf.code.LocalVariableList.Item}
* in all respects but the type descriptor and signature, if any.
*
- * @param item non-null; local variable information to match
- * @return null-ok; the corresponding local variable information stored
- * in this instance, or <code>null</code> if there is no matching
+ * @param item {@code non-null;} local variable information to match
+ * @return {@code null-ok;} the corresponding local variable information stored
+ * in this instance, or {@code null} if there is no matching
* information
*/
public Item itemToLocal(Item item) {
@@ -178,10 +178,10 @@
* variable's start point is listed as the address of the instruction
* <i>just past</i> the one that sets the variable.
*
- * @param pc >= 0; the address to look up
- * @param index >= 0; the local variable index
- * @return null-ok; the associated local variable information, or
- * <code>null</code> if none is known
+ * @param pc {@code >= 0;} the address to look up
+ * @param index {@code >= 0;} the local variable index
+ * @return {@code null-ok;} the associated local variable information, or
+ * {@code null} if none is known
*/
public Item pcAndIndexToLocal(int pc, int index) {
int sz = size();
@@ -201,37 +201,37 @@
* Item in a local variable table.
*/
public static class Item {
- /** >= 0; the start pc of this variable's scope */
+ /** {@code >= 0;} the start pc of this variable's scope */
private final int startPc;
- /** >= 0; the length (in bytecodes) of this variable's scope */
+ /** {@code >= 0;} the length (in bytecodes) of this variable's scope */
private final int length;
- /** non-null; the variable's name */
+ /** {@code non-null;} the variable's name */
private final CstUtf8 name;
- /** null-ok; the variable's type descriptor */
+ /** {@code null-ok;} the variable's type descriptor */
private final CstUtf8 descriptor;
- /** null-ok; the variable's type signature */
+ /** {@code null-ok;} the variable's type signature */
private final CstUtf8 signature;
- /** >= 0; the variable's local index */
+ /** {@code >= 0;} the variable's local index */
private final int index;
/**
* Constructs an instance.
*
- * <p><b>Note:</b> At least one of <code>descriptor</code> or
- * <code>signature</code> must be passed as non-null.</p>
+ * <p><b>Note:</b> At least one of {@code descriptor} or
+ * {@code signature} must be passed as non-null.</p>
*
- * @param startPc >= 0; the start pc of this variable's scope
- * @param length >= 0; the length (in bytecodes) of this variable's
+ * @param startPc {@code >= 0;} the start pc of this variable's scope
+ * @param length {@code >= 0;} the length (in bytecodes) of this variable's
* scope
- * @param name non-null; the variable's name
- * @param descriptor null-ok; the variable's type descriptor
- * @param signature null-ok; the variable's type signature
- * @param index >= 0; the variable's local index
+ * @param name {@code non-null;} the variable's name
+ * @param descriptor {@code null-ok;} the variable's type descriptor
+ * @param signature {@code null-ok;} the variable's type signature
+ * @param index {@code >= 0;} the variable's local index
*/
public Item(int startPc, int length, CstUtf8 name,
CstUtf8 descriptor, CstUtf8 signature, int index) {
@@ -267,7 +267,7 @@
/**
* Gets the start pc of this variable's scope.
*
- * @return >= 0; the start pc of this variable's scope
+ * @return {@code >= 0;} the start pc of this variable's scope
*/
public int getStartPc() {
return startPc;
@@ -276,7 +276,7 @@
/**
* Gets the length (in bytecodes) of this variable's scope.
*
- * @return >= 0; the length (in bytecodes) of this variable's scope
+ * @return {@code >= 0;} the length (in bytecodes) of this variable's scope
*/
public int getLength() {
return length;
@@ -285,7 +285,7 @@
/**
* Gets the variable's type descriptor.
*
- * @return null-ok; the variable's type descriptor
+ * @return {@code null-ok;} the variable's type descriptor
*/
public CstUtf8 getDescriptor() {
return descriptor;
@@ -294,7 +294,7 @@
/**
* Gets the variable's LocalItem, a (name, signature) tuple
*
- * @return null-ok; the variable's type descriptor
+ * @return {@code null-ok;} the variable's type descriptor
*/
public LocalItem getLocalItem() {
return LocalItem.make(name, signature);
@@ -304,7 +304,7 @@
* Gets the variable's type signature. Private because if you need this,
* you want getLocalItem() instead.
*
- * @return null-ok; the variable's type signature
+ * @return {@code null-ok;} the variable's type signature
*/
private CstUtf8 getSignature() {
return signature;
@@ -313,7 +313,7 @@
/**
* Gets the variable's local index.
*
- * @return >= 0; the variable's local index
+ * @return {@code >= 0;} the variable's local index
*/
public int getIndex() {
return index;
@@ -321,9 +321,9 @@
/**
* Gets the variable's type descriptor. This is a convenient shorthand
- * for <code>Type.intern(getDescriptor().getString())</code>.
+ * for {@code Type.intern(getDescriptor().getString())}.
*
- * @return non-null; the variable's type
+ * @return {@code non-null;} the variable's type
*/
public Type getType() {
return Type.intern(descriptor.getString());
@@ -333,8 +333,8 @@
* Constructs and returns an instance which is identical to this
* one, except that the signature is changed to the given value.
*
- * @param newSignature non-null; the new signature
- * @return non-null; an appropriately-constructed instance
+ * @param newSignature {@code non-null;} the new signature
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Item withSignature(CstUtf8 newSignature) {
return new Item(startPc, length, name, descriptor, newSignature,
@@ -345,10 +345,10 @@
* Gets whether this instance matches (describes) the given
* address and index.
*
- * @param pc >= 0; the address in question
- * @param index >= 0; the local variable index in question
- * @return <code>true</code> iff this instance matches <code>pc</code>
- * and <code>index</code>
+ * @param pc {@code >= 0;} the address in question
+ * @param index {@code >= 0;} the local variable index in question
+ * @return {@code true} iff this instance matches {@code pc}
+ * and {@code index}
*/
public boolean matchesPcAndIndex(int pc, int index) {
return (index == this.index) &&
@@ -361,8 +361,8 @@
* other instance exactly in all fields except type descriptor and
* type signature.
*
- * @param other non-null; the instance to compare to
- * @return <code>true</code> iff this instance matches
+ * @param other {@code non-null;} the instance to compare to
+ * @return {@code true} iff this instance matches
*/
public boolean matchesAllButType(Item other) {
return (startPc == other.startPc)
diff --git a/dx/src/com/android/dx/cf/code/LocalsArray.java b/dx/src/com/android/dx/cf/code/LocalsArray.java
index 1c324ca..b2c2689 100644
--- a/dx/src/com/android/dx/cf/code/LocalsArray.java
+++ b/dx/src/com/android/dx/cf/code/LocalsArray.java
@@ -36,7 +36,7 @@
/**
* Constructs an instance, explicitly indicating the mutability.
*
- * @param mutable <code>true</code> if this instance is mutable
+ * @param mutable {@code true} if this instance is mutable
*/
protected LocalsArray(boolean mutable) {
super(mutable);
@@ -45,7 +45,7 @@
/**
* Makes and returns a mutable copy of this instance.
*
- * @return non-null; the copy
+ * @return {@code non-null;} the copy
*/
public abstract LocalsArray copy();
@@ -53,7 +53,7 @@
* Annotates (adds context to) the given exception with information
* about this instance.
*
- * @param ex non-null; the exception to annotate
+ * @param ex {@code non-null;} the exception to annotate
*/
public abstract void annotate(ExceptionWithContext ex);
@@ -61,7 +61,7 @@
* Replaces all the occurrences of the given uninitialized type in
* this array with its initialized equivalent.
*
- * @param type non-null; type to replace
+ * @param type {@code non-null;} type to replace
*/
public abstract void makeInitialized(Type type);
@@ -71,16 +71,17 @@
* @return the max locals
*/
public abstract int getMaxLocals();
+
/**
* Sets the type stored at the given local index. If the given type
* is category-2, then (a) the index must be at least two less than
- * <code>getMaxLocals()</code> and (b) the next index gets invalidated
+ * {@link #getMaxLocals} and (b) the next index gets invalidated
* by the operation. In case of either category, if the <i>previous</i>
* local contains a category-2 value, then it too is invalidated by
* this operation.
*
- * @param idx >= 0, < getMaxLocals(); which local
- * @param type non-null; new type for the local at <code>idx</code>
+ * @param idx {@code >= 0, < getMaxLocals();} which local
+ * @param type {@code non-null;} new type for the local at {@code idx}
*/
public abstract void set(int idx, TypeBearer type);
@@ -88,25 +89,25 @@
* Sets the type for the local indicated by the given register spec
* to that register spec (which includes type and optional name
* information). This is identical to calling
- * <code>set(spec.getReg(), spec)</code>.
+ * {@code set(spec.getReg(), spec)}.
*
- * @param spec non-null; register spec to use as the basis for the update
+ * @param spec {@code non-null;} register spec to use as the basis for the update
*/
public abstract void set(RegisterSpec spec);
/**
* Invalidates the local at the given index.
*
- * @param idx >= 0, < getMaxLocals(); which local
+ * @param idx {@code >= 0, < getMaxLocals();} which local
*/
public abstract void invalidate(int idx);
/**
- * Gets the type stored at the given local index, or <code>null</code>
+ * Gets the type stored at the given local index, or {@code null}
* if the given local is uninitialized / invalid.
*
- * @param idx >= 0, < getMaxLocals(); which local
- * @return null-ok; the type of value stored in that local
+ * @param idx {@code >= 0, < getMaxLocals();} which local
+ * @return {@code null-ok;} the type of value stored in that local
*/
public abstract TypeBearer getOrNull(int idx);
@@ -115,9 +116,9 @@
* the given local contains a valid type (though it is allowed to
* be an uninitialized instance).
*
- * @param idx >= 0, < getMaxLocals(); which local
- * @return non-null; the type of value stored in that local
- * @throws SimException thrown if <code>idx</code> is valid, but
+ * @param idx {@code >= 0, < getMaxLocals();} which local
+ * @return {@code non-null;} the type of value stored in that local
+ * @throws SimException thrown if {@code idx} is valid, but
* the contents are invalid
*/
public abstract TypeBearer get(int idx);
@@ -126,9 +127,9 @@
* Gets the type stored at the given local index, which is expected
* to be an initialized category-1 value.
*
- * @param idx >= 0, < getMaxLocals(); which local
- * @return non-null; the type of value stored in that local
- * @throws SimException thrown if <code>idx</code> is valid, but
+ * @param idx {@code >= 0, < getMaxLocals();} which local
+ * @return {@code non-null;} the type of value stored in that local
+ * @throws SimException thrown if {@code idx} is valid, but
* one of the following holds: (a) the local is invalid; (b) the local
* contains an uninitialized instance; (c) the local contains a
* category-2 value
@@ -139,39 +140,39 @@
* Gets the type stored at the given local index, which is expected
* to be a category-2 value.
*
- * @param idx >= 0, < getMaxLocals(); which local
- * @return non-null; the type of value stored in that local
- * @throws SimException thrown if <code>idx</code> is valid, but
+ * @param idx {@code >= 0, < getMaxLocals();} which local
+ * @return {@code non-null;} the type of value stored in that local
+ * @throws SimException thrown if {@code idx} is valid, but
* one of the following holds: (a) the local is invalid; (b) the local
* contains a category-1 value
*/
public abstract TypeBearer getCategory2(int idx);
/**
- * Merges this instance with <code>other</code>. If the merged result is
+ * Merges this instance with {@code other}. If the merged result is
* the same as this instance, then this is returned (not a copy).
*
- * @param other non-null; another LocalsArray
- * @return non-null; the merge result, a new instance or this
+ * @param other {@code non-null;} another LocalsArray
+ * @return {@code non-null;} the merge result, a new instance or this
*/
public abstract LocalsArray merge(LocalsArray other);
/**
- * Merges this instance with a <code>LocalsSet</code> from a subroutine
+ * Merges this instance with a {@code LocalsSet} from a subroutine
* caller. To be used when merging in the first block of a subroutine.
*
- * @param other other non-null; another LocalsArray. The final locals
+ * @param other {@code other non-null;} another LocalsArray. The final locals
* state of a subroutine caller.
* @param predLabel the label of the subroutine caller block.
- * @return non-null; the merge result, a new instance or this
+ * @return {@code non-null;} the merge result, a new instance or this
*/
public abstract LocalsArraySet mergeWithSubroutineCaller
(LocalsArray other, int predLabel);
/**
* Gets the locals set appropriate for the current execution context.
- * That is, if this is a <code>OneLocalsArray</code> instance, then return
- * <code>this</code>, otherwise return <code>LocalsArraySet</code>'s
+ * That is, if this is a {@code OneLocalsArray} instance, then return
+ * {@code this}, otherwise return {@code LocalsArraySet}'s
* primary.
*
* @return locals for this execution context.
diff --git a/dx/src/com/android/dx/cf/code/LocalsArraySet.java b/dx/src/com/android/dx/cf/code/LocalsArraySet.java
index 9e24da9..7161176 100644
--- a/dx/src/com/android/dx/cf/code/LocalsArraySet.java
+++ b/dx/src/com/android/dx/cf/code/LocalsArraySet.java
@@ -51,9 +51,9 @@
/**
* Constructs an instance. The locals array initially consists of
- * all-uninitialized values (represented as <code>null</code>s).
+ * all-uninitialized values (represented as {@code null}s).
*
- * @param maxLocals >= 0; the maximum number of locals this instance
+ * @param maxLocals {@code >= 0;} the maximum number of locals this instance
* can refer to
*/
public LocalsArraySet(int maxLocals) {
@@ -65,8 +65,8 @@
/**
* Constructs an instance with the specified primary and secondaries set.
*
- * @param primary non-null; primary locals to use
- * @param secondaries non-null; secondaries set, indexed by subroutine
+ * @param primary {@code non-null;} primary locals to use
+ * @param secondaries {@code non-null;} secondaries set, indexed by subroutine
* caller label.
*/
public LocalsArraySet(OneLocalsArray primary,
@@ -80,7 +80,7 @@
/**
* Constructs an instance which is a copy of another.
*
- * @param toCopy non-null; instance to copy.
+ * @param toCopy {@code non-null;} instance to copy.
*/
private LocalsArraySet(LocalsArraySet toCopy) {
super(toCopy.getMaxLocals() > 0);
@@ -250,10 +250,10 @@
}
/**
- * Merges this set with another <code>LocalsArraySet</code> instance.
+ * Merges this set with another {@code LocalsArraySet} instance.
*
- * @param other non-null; to merge
- * @return non-null; this instance if merge was a no-op, or
+ * @param other {@code non-null;} to merge
+ * @return {@code non-null;} this instance if merge was a no-op, or
* new merged instance.
*/
private LocalsArraySet mergeWithSet(LocalsArraySet other) {
@@ -301,10 +301,10 @@
}
/**
- * Merges this set with a <code>OneLocalsArray</code> instance.
+ * Merges this set with a {@code OneLocalsArray} instance.
*
- * @param other non-null; to merge
- * @return non-null; this instance if merge was a no-op, or
+ * @param other {@code non-null;} to merge
+ * @return {@code non-null;} this instance if merge was a no-op, or
* new merged instance.
*/
private LocalsArraySet mergeWithOne(OneLocalsArray other) {
@@ -365,11 +365,11 @@
}
/**
- * Gets the <code>LocalsArray</code> instance for a specified subroutine
+ * Gets the {@code LocalsArray} instance for a specified subroutine
* caller label, or null if label has no locals associated with it.
*
- * @param label >=0 subroutine caller label
- * @return null-ok; locals if available.
+ * @param label {@code >= 0;} subroutine caller label
+ * @return {@code null-ok;} locals if available.
*/
private LocalsArray getSecondaryForLabel(int label) {
if (label >= secondaries.size()) {
@@ -445,8 +445,8 @@
* Returns a LocalsArray instance representing the locals state that should
* be used when returning to a subroutine caller.
*
- * @param subLabel >= 0; A calling label of a subroutine
- * @return null-ok; an instance for this subroutine, or null if subroutine
+ * @param subLabel {@code >= 0;} A calling label of a subroutine
+ * @return {@code null-ok;} an instance for this subroutine, or null if subroutine
* is not in this set.
*/
public LocalsArray subArrayForLabel(int subLabel) {
diff --git a/dx/src/com/android/dx/cf/code/Machine.java b/dx/src/com/android/dx/cf/code/Machine.java
index 517a10d..aff50b2 100644
--- a/dx/src/com/android/dx/cf/code/Machine.java
+++ b/dx/src/com/android/dx/cf/code/Machine.java
@@ -32,9 +32,9 @@
/**
* Gets the effective prototype of the method that this instance is
* being used for. The <i>effective</i> prototype includes an initial
- * <code>this</code> argument for instance methods.
+ * {@code this} argument for instance methods.
*
- * @return non-null; the method prototype
+ * @return {@code non-null;} the method prototype
*/
public Prototype getPrototype();
@@ -48,21 +48,21 @@
* and store them in the arguments area, indicating that there are now
* that many arguments. Also, clear the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param count >= 0; number of values to pop
+ * @param frame {@code non-null;} frame to operate on
+ * @param count {@code >= 0;} number of values to pop
*/
public void popArgs(Frame frame, int count);
/**
* Pops values from the stack of the types indicated by the given
- * <code>Prototype</code> (popped in reverse of the argument
+ * {@code Prototype} (popped in reverse of the argument
* order, so the first prototype argument type is for the deepest
* element of the stack), and store them in the arguments area,
* indicating that there are now that many arguments. Also, clear
* the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param prototype non-null; prototype indicating arguments to pop
+ * @param frame {@code non-null;} frame to operate on
+ * @param prototype {@code non-null;} prototype indicating arguments to pop
*/
public void popArgs(Frame frame, Prototype prototype);
@@ -71,8 +71,8 @@
* in the arguments area, indicating that there are now that many
* arguments. Also, clear the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param type non-null; type of the argument
+ * @param frame {@code non-null;} frame to operate on
+ * @param type {@code non-null;} type of the argument
*/
public void popArgs(Frame frame, Type type);
@@ -83,9 +83,9 @@
* area, indicating that there are now that many arguments. Also,
* clear the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param type1 non-null; type of the first argument
- * @param type2 non-null; type of the second argument
+ * @param frame {@code non-null;} frame to operate on
+ * @param type1 {@code non-null;} type of the first argument
+ * @param type2 {@code non-null;} type of the second argument
*/
public void popArgs(Frame frame, Type type1, Type type2);
@@ -96,10 +96,10 @@
* area, indicating that there are now that many arguments. Also,
* clear the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param type1 non-null; type of the first argument
- * @param type2 non-null; type of the second argument
- * @param type3 non-null; type of the third argument
+ * @param frame {@code non-null;} frame to operate on
+ * @param type1 {@code non-null;} type of the first argument
+ * @param type2 {@code non-null;} type of the second argument
+ * @param type3 {@code non-null;} type of the third argument
*/
public void popArgs(Frame frame, Type type1, Type type2, Type type3);
@@ -107,8 +107,8 @@
* Loads the local variable with the given index as the sole argument in
* the arguments area. Also, clear the auxiliary arguments.
*
- * @param frame non-null; frame to operate on
- * @param idx >= 0; the local variable index
+ * @param frame {@code non-null;} frame to operate on
+ * @param idx {@code >= 0;} the local variable index
*/
public void localArg(Frame frame, int idx);
@@ -116,28 +116,28 @@
* Indicates that the salient type of this operation is as
* given. This differentiates between, for example, the various
* arithmetic opcodes, which, by the time they hit a
- * <code>Machine</code> are collapsed to the <code>int</code>
+ * {@code Machine} are collapsed to the {@code int}
* variant. (See {@link BytecodeArray#parseInstruction} for
* details.)
*
- * @param type non-null; the salient type of the upcoming operation
+ * @param type {@code non-null;} the salient type of the upcoming operation
*/
public void auxType(Type type);
/**
* Indicates that there is an auxiliary (inline, not stack)
- * argument of type <code>int</code>, with the given value.
+ * argument of type {@code int}, with the given value.
*
* <p><b>Note:</b> Perhaps unintuitively, the stack manipulation
- * ops (e.g., <code>dup</code> and <code>swap</code>) use this to
+ * ops (e.g., {@code dup} and {@code swap}) use this to
* indicate the result stack pattern with a straightforward hex
* encoding of the push order starting with least-significant
* nibbles getting pushed first). For example, an all-category-1
- * <code>dup2_x1</code> sets this to <code>0x12312</code>, and the
+ * {@code dup2_x1} sets this to {@code 0x12312}, and the
* other form of that op sets this to
- * <code>0x121</code>.</p>
+ * {@code 0x121}.</p>
*
- * <p><b>Also Note:</b> For <code>switch*</code> instructions, this is
+ * <p><b>Also Note:</b> For {@code switch*} instructions, this is
* used to indicate the padding value (which is only useful for
* verification).</p>
*
@@ -149,10 +149,10 @@
* Indicates that there is an auxiliary (inline, not stack) object
* argument, with the value based on the given constant.
*
- * <p><b>Note:</b> Some opcodes use both <code>int</code> and
+ * <p><b>Note:</b> Some opcodes use both {@code int} and
* constant auxiliary arguments.</p>
*
- * @param cst non-null; the constant containing / referencing
+ * @param cst {@code non-null;} the constant containing / referencing
* the value
*/
public void auxCstArg(Constant cst);
@@ -167,12 +167,12 @@
/**
* Indicates that there is an auxiliary (inline, not stack) argument
- * consisting of a <code>switch*</code> table.
+ * consisting of a {@code switch*} table.
*
* <p><b>Note:</b> This is generally used in conjunction with
* {@link #auxIntArg} (which holds the padding).</p>
*
- * @param cases non-null; the list of key-target pairs, plus the default
+ * @param cases {@code non-null;} the list of key-target pairs, plus the default
* target
*/
public void auxSwitchArg(SwitchList cases);
@@ -181,7 +181,7 @@
* Indicates that there is an auxiliary (inline, not stack) argument
* consisting of a list of initial values for a newly created array.
*
- * @param initValues non-null; the list of constant values to initialize
+ * @param initValues {@code non-null;} the list of constant values to initialize
* the array
*/
public void auxInitValues(ArrayList<Constant> initValues);
@@ -189,9 +189,9 @@
/**
* Indicates that the target of this operation is the given local.
*
- * @param idx >= 0; the local variable index
- * @param type non-null; the type of the local
- * @param local null-ok; the name and signature of the local, if known
+ * @param idx {@code >= 0;} the local variable index
+ * @param type {@code non-null;} the type of the local
+ * @param local {@code null-ok;} the name and signature of the local, if known
*/
public void localTarget(int idx, Type type, LocalItem local);
@@ -199,10 +199,10 @@
* "Runs" the indicated opcode in an appropriate way, using the arguments
* area as appropriate, and modifying the given frame in response.
*
- * @param frame non-null; frame to operate on
- * @param offset >= 0; byte offset in the method to the opcode being
+ * @param frame {@code non-null;} frame to operate on
+ * @param offset {@code >= 0;} byte offset in the method to the opcode being
* run
- * @param opcode >= 0; the opcode to run
+ * @param opcode {@code >= 0;} the opcode to run
*/
public void run(Frame frame, int offset, int opcode);
}
diff --git a/dx/src/com/android/dx/cf/code/Merger.java b/dx/src/com/android/dx/cf/code/Merger.java
index adeaab2..8da9a18 100644
--- a/dx/src/com/android/dx/cf/code/Merger.java
+++ b/dx/src/com/android/dx/cf/code/Merger.java
@@ -35,9 +35,9 @@
* Merges two locals arrays. If the merged result is the same as the first
* argument, then return the first argument (not a copy).
*
- * @param locals1 non-null; a locals array
- * @param locals2 non-null; another locals array
- * @return non-null; the result of merging the two locals arrays
+ * @param locals1 {@code non-null;} a locals array
+ * @param locals2 {@code non-null;} another locals array
+ * @return {@code non-null;} the result of merging the two locals arrays
*/
public static OneLocalsArray mergeLocals(OneLocalsArray locals1,
OneLocalsArray locals2) {
@@ -87,9 +87,9 @@
* Merges two stacks. If the merged result is the same as the first
* argument, then return the first argument (not a copy).
*
- * @param stack1 non-null; a stack
- * @param stack2 non-null; another stack
- * @return non-null; the result of merging the two stacks
+ * @param stack1 {@code non-null;} a stack
+ * @param stack2 {@code non-null;} another stack
+ * @return {@code non-null;} the result of merging the two stacks
*/
public static ExecutionStack mergeStack(ExecutionStack stack1,
ExecutionStack stack2) {
@@ -144,9 +144,9 @@
/**
* Merges two frame types.
*
- * @param ft1 non-null; a frame type
- * @param ft2 non-null; another frame type
- * @return non-null; the result of merging the two types
+ * @param ft1 {@code non-null;} a frame type
+ * @param ft2 {@code non-null;} another frame type
+ * @return {@code non-null;} the result of merging the two types
*/
public static TypeBearer mergeType(TypeBearer ft1, TypeBearer ft2) {
if ((ft1 == null) || ft1.equals(ft2)) {
@@ -209,12 +209,12 @@
* the given subtype. This takes into account primitiveness,
* int-likeness, known-nullness, and array dimensions, but does
* not assume anything about class hierarchy other than that the
- * type <code>Object</code> is the supertype of all reference
+ * type {@code Object} is the supertype of all reference
* types and all arrays are assignable to
- * <code>Serializable</code> and <code>Cloneable</code>.
+ * {@code Serializable} and {@code Cloneable}.
*
- * @param supertypeBearer non-null; the supertype
- * @param subtypeBearer non-null; the subtype
+ * @param supertypeBearer {@code non-null;} the supertype
+ * @param subtypeBearer {@code non-null;} the subtype
*/
public static boolean isPossiblyAssignableFrom(TypeBearer supertypeBearer,
TypeBearer subtypeBearer) {
diff --git a/dx/src/com/android/dx/cf/code/OneLocalsArray.java b/dx/src/com/android/dx/cf/code/OneLocalsArray.java
index 3a590a1..cafd177 100644
--- a/dx/src/com/android/dx/cf/code/OneLocalsArray.java
+++ b/dx/src/com/android/dx/cf/code/OneLocalsArray.java
@@ -31,14 +31,14 @@
* com.android.dx.rop.type.TypeBearer}.</p>
*/
public class OneLocalsArray extends LocalsArray {
- /** non-null; actual array */
+ /** {@code non-null;} actual array */
private final TypeBearer[] locals;
/**
* Constructs an instance. The locals array initially consists of
- * all-uninitialized values (represented as <code>null</code>s).
+ * all-uninitialized values (represented as {@code null}s).
*
- * @param maxLocals >= 0; the maximum number of locals this instance
+ * @param maxLocals {@code >= 0;} the maximum number of locals this instance
* can refer to
*/
public OneLocalsArray(int maxLocals) {
@@ -237,7 +237,7 @@
* Throws a properly-formatted exception.
*
* @param idx the salient local index
- * @param msg non-null; useful message
+ * @param msg {@code non-null;} useful message
* @return never (keeps compiler happy)
*/
private static TypeBearer throwSimException(int idx, String msg) {
diff --git a/dx/src/com/android/dx/cf/code/ReturnAddress.java b/dx/src/com/android/dx/cf/code/ReturnAddress.java
index c69253c..47c6071 100644
--- a/dx/src/com/android/dx/cf/code/ReturnAddress.java
+++ b/dx/src/com/android/dx/cf/code/ReturnAddress.java
@@ -28,13 +28,13 @@
* what instances of this class hang onto.
*/
public final class ReturnAddress implements TypeBearer {
- /** >= 0; the start address of the subroutine being returned from */
+ /** {@code >= 0;} the start address of the subroutine being returned from */
private final int subroutineAddress;
/**
* Constructs an instance.
*
- * @param subroutineAddress >= 0; the start address of the
+ * @param subroutineAddress {@code >= 0;} the start address of the
* subroutine being returned from
*/
public ReturnAddress(int subroutineAddress) {
@@ -100,7 +100,7 @@
/**
* Gets the subroutine address.
*
- * @return >= 0; the subroutine address
+ * @return {@code >= 0;} the subroutine address
*/
public int getSubroutineAddress() {
return subroutineAddress;
diff --git a/dx/src/com/android/dx/cf/code/Ropper.java b/dx/src/com/android/dx/cf/code/Ropper.java
index f3eecab..6ddfb7e 100644
--- a/dx/src/com/android/dx/cf/code/Ropper.java
+++ b/dx/src/com/android/dx/cf/code/Ropper.java
@@ -66,10 +66,10 @@
/** number of special label offsets */
private static final int SPECIAL_LABEL_COUNT = 7;
- /** non-null; method being converted */
+ /** {@code non-null;} method being converted */
private final ConcreteMethod method;
- /** non-null; original block list */
+ /** {@code non-null;} original block list */
private final ByteBlockList blocks;
/** max locals of the method */
@@ -78,30 +78,30 @@
/** max label (exclusive) of any original bytecode block */
private final int maxLabel;
- /** non-null; simulation machine to use */
+ /** {@code non-null;} simulation machine to use */
private final RopperMachine machine;
- /** non-null; simulator to use */
+ /** {@code non-null;} simulator to use */
private final Simulator sim;
/**
- * non-null; sparse array mapping block labels to initial frame contents,
+ * {@code non-null;} sparse array mapping block labels to initial frame contents,
* if known
*/
private final Frame[] startFrames;
- /** non-null; output block list in-progress */
+ /** {@code non-null;} output block list in-progress */
private final ArrayList<BasicBlock> result;
/**
- * non-null; list of subroutine-nest labels
+ * {@code non-null;} list of subroutine-nest labels
* (See {@link Frame#getSubroutines} associated with each result block.
* Parallel to {@link Ropper#result}.
*/
private final ArrayList<IntList> resultSubroutines;
/**
- * non-null; for each block (by label) that is used as an exception
+ * {@code non-null;} for each block (by label) that is used as an exception
* handler, the type of exception it catches
*/
private final Type[] catchTypes;
@@ -112,10 +112,10 @@
*/
private boolean synchNeedsExceptionHandler;
- /** non-null; list of subroutines indexed by label of start address */
+ /** {@code non-null;} list of subroutines indexed by label of start address */
private final Subroutine subroutines[];
- /** true if <code>subroutines</code> is non-empty */
+ /** true if {@code subroutines} is non-empty */
private boolean hasSubroutines;
/**
@@ -155,7 +155,7 @@
}
/**
- * @return >= 0; the label of the subroutine's start block.
+ * @return {@code >= 0;} the label of the subroutine's start block.
*/
int getStartBlock() {
return startBlock;
@@ -212,11 +212,11 @@
/**
* Merges the specified frame into this subroutine's successors,
- * setting <code>workSet</code> as appropriate. To be called with
+ * setting {@code workSet} as appropriate. To be called with
* the frame of a subroutine ret block.
*
- * @param frame non-null; frame from ret block to merge
- * @param workSet non-null; workset to update
+ * @param frame {@code non-null;} frame from ret block to merge
+ * @param workSet {@code non-null;} workset to update
*/
void mergeToSuccessors(Frame frame, int[] workSet) {
int sz = callerBlocks.size();
@@ -242,9 +242,9 @@
/**
* Converts a {@link ConcreteMethod} to a {@link RopMethod}.
*
- * @param method non-null; method to convert
- * @param advice non-null; translation advice to use
- * @return non-null; the converted instance
+ * @param method {@code non-null;} method to convert
+ * @param advice {@code non-null;} translation advice to use
+ * @return {@code non-null;} the converted instance
*/
public static RopMethod convert(ConcreteMethod method,
TranslationAdvice advice) {
@@ -263,8 +263,8 @@
* Constructs an instance. This class is not publicly instantiable; use
* {@link #convert}.
*
- * @param method non-null; method to convert
- * @param advice non-null; translation advice to use
+ * @param method {@code non-null;} method to convert
+ * @param advice {@code non-null;} translation advice to use
*/
private Ropper(ConcreteMethod method, TranslationAdvice advice) {
if (method == null) {
@@ -307,7 +307,7 @@
* Gets the first (lowest) register number to use as the temporary
* area when unwinding stack manipulation ops.
*
- * @return >= 0; the first register to use
+ * @return {@code >= 0;} the first register to use
*/
/*package*/ int getFirstTempStackReg() {
/*
@@ -326,8 +326,8 @@
* Gets the label for the exception handler setup block corresponding
* to the given label.
*
- * @param label >= 0; the original label
- * @return >= 0; the corresponding exception handler setup label
+ * @param label {@code >= 0;} the original label
+ * @return {@code >= 0;} the corresponding exception handler setup label
*/
private int getExceptionSetupLabel(int label) {
return maxLabel + label;
@@ -337,8 +337,8 @@
* Gets the label for the given special-purpose block. The given label
* should be one of the static constants defined by this class.
*
- * @param label < 0; the special label constant
- * @return >= 0; the actual label value to use
+ * @param label {@code < 0;} the special label constant
+ * @return {@code >= 0;} the actual label value to use
*/
private int getSpecialLabel(int label) {
/*
@@ -356,7 +356,7 @@
/**
* Gets the minimum label for unreserved use.
*
- * @return >= 0; the minimum label
+ * @return {@code >= 0;} the minimum label
*/
private int getMinimumUnreservedLabel() {
/*
@@ -370,7 +370,7 @@
/**
* Gets an arbitrary unreserved and available label.
*
- * @return >= 0; the label
+ * @return {@code >= 0;} the label
*/
private int getAvailableLabel() {
int candidate = getMinimumUnreservedLabel();
@@ -409,7 +409,7 @@
* Gets the total number of registers used for "normal" purposes (i.e.,
* for the straightforward translation from the original Java).
*
- * @return >= 0; the total number of registers used
+ * @return {@code >= 0;} the total number of registers used
*/
private int getNormalRegCount() {
return maxLocals + method.getMaxStack();
@@ -419,7 +419,7 @@
* Gets the register spec to use to hold the object to synchronize on,
* for a synchronized method.
*
- * @return non-null; the register spec
+ * @return {@code non-null;} the register spec
*/
private RegisterSpec getSynchReg() {
/*
@@ -433,11 +433,11 @@
/**
* Searches {@link #result} for a block with the given label. Return its
- * index if found, or return <code>-1</code> if there is no such block.
+ * index if found, or return {@code -1} if there is no such block.
*
* @param label the label to look for
- * @return >= -1; the index for the block with the given label or
- * <code>-1</code> if there is no such block
+ * @return {@code >= -1;} the index for the block with the given label or
+ * {@code -1} if there is no such block
*/
private int labelToResultIndex(int label) {
int sz = result.size();
@@ -456,7 +456,7 @@
* found, or throw an exception if there is no such block.
*
* @param label the label to look for
- * @return non-null; the block with the given label
+ * @return {@code non-null;} the block with the given label
*/
private BasicBlock labelToBlock(int label) {
int idx = labelToResultIndex(label);
@@ -472,8 +472,8 @@
/**
* Adds a block to the output result.
*
- * @param block non-null; the block to add
- * @param subroutines non-null; subroutine label list as described in
+ * @param block {@code non-null;} the block to add
+ * @param subroutines {@code non-null;} subroutine label list as described in
* {@link Frame#getSubroutines}
*/
private void addBlock(BasicBlock block, IntList subroutines) {
@@ -491,11 +491,11 @@
* replacement, then any extra blocks that got added with the
* original get removed as a result of calling this method.
*
- * @param block non-null; the block to add or replace
- * @param subroutines non-null; subroutine label list as described in
+ * @param block {@code non-null;} the block to add or replace
+ * @param subroutines {@code non-null;} subroutine label list as described in
* {@link Frame#getSubroutines}
- * @return <code>true</code> if the block was replaced or
- * <code>false</code> if it was added for the first time
+ * @return {@code true} if the block was replaced or
+ * {@code false} if it was added for the first time
*/
private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) {
if (block == null) {
@@ -529,11 +529,11 @@
* Adds or replaces a block in the output result. Do not delete
* any successors.
*
- * @param block non-null; the block to add or replace
- * @param subroutines non-null; subroutine label list as described in
+ * @param block {@code non-null;} the block to add or replace
+ * @param subroutines {@code non-null;} subroutine label list as described in
* {@link Frame#getSubroutines}
- * @return <code>true</code> if the block was replaced or
- * <code>false</code> if it was added for the first time
+ * @return {@code true} if the block was replaced or
+ * {@code false} if it was added for the first time
*/
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
IntList subroutines) {
@@ -564,7 +564,7 @@
* successors of it whose labels indicate that they are not in the
* normally-translated range.
*
- * @param idx non-null; block to remove (etc.)
+ * @param idx {@code non-null;} block to remove (etc.)
*/
private void removeBlockAndSpecialSuccessors(int idx) {
int minLabel = getMinimumUnreservedLabel();
@@ -591,7 +591,7 @@
/**
* Extracts the resulting {@link RopMethod} from the instance.
*
- * @return non-null; the method object
+ * @return {@code non-null;} the method object
*/
private RopMethod getRopMethod() {
@@ -663,9 +663,9 @@
/**
* Processes the given block.
*
- * @param block non-null; block to process
- * @param frame non-null; start frame for the block
- * @param workSet non-null; bits representing work to do, which this
+ * @param block {@code non-null;} block to process
+ * @param frame {@code non-null;} start frame for the block
+ * @param workSet {@code non-null;} bits representing work to do, which this
* method may add to
*/
private void processBlock(ByteBlock block, Frame frame, int[] workSet) {
@@ -950,14 +950,14 @@
* Helper for {@link #processBlock}, which merges frames and
* adds to the work set, as necessary.
*
- * @param label >= 0; label to work on
- * @param pred predecessor label. Must be >= 0 when
- * <code>label</code> is a subroutine start block and calledSubroutine
+ * @param label {@code >= 0;} label to work on
+ * @param pred predecessor label; must be {@code >= 0} when
+ * {@code label} is a subroutine start block and calledSubroutine
* is non-null. Otherwise, may be -1.
- * @param calledSubroutine null-ok; a Subroutine instance if
- * <code>label</code> is the first block in a subroutine.
- * @param frame non-null; new frame for the labelled block
- * @param workSet non-null; bits representing work to do, which this
+ * @param calledSubroutine {@code null-ok;} a Subroutine instance if
+ * {@code label} is the first block in a subroutine.
+ * @param frame {@code non-null;} new frame for the labelled block
+ * @param workSet {@code non-null;} bits representing work to do, which this
* method may add to
*/
private void mergeAndWorkAsNecessary(int label, int pred,
@@ -1078,7 +1078,7 @@
/**
* Constructs and adds the return block, if necessary. The return
- * block merely contains an appropriate <code>return</code>
+ * block merely contains an appropriate {@code return}
* instruction.
*/
private void addReturnBlock() {
@@ -1217,7 +1217,7 @@
/**
* Checks to see if the basic block is a subroutine caller block.
*
- * @param bb non-null; the basic block in question
+ * @param bb {@code non-null;} the basic block in question
* @return true if this block calls a subroutine
*/
private boolean isSubroutineCaller(BasicBlock bb) {
@@ -1340,7 +1340,7 @@
/**
* Inlines a subroutine. Start by calling
- * <code>inlineSubroutineCalledFrom</code>.
+ * {@code inlineSubroutineCalledFrom}.
*/
private class SubroutineInliner {
/**
@@ -1502,8 +1502,8 @@
* Checks to see if a specified label is involved in a specified
* subroutine.
*
- * @param label >=0 a basic block label
- * @param subroutineStart >=0 a subroutine as identified by the
+ * @param label {@code >= 0;} a basic block label
+ * @param subroutineStart {@code >= 0;} a subroutine as identified by the
* label of its start block.
* @return true if the block is dominated by the subroutine call.
*/
@@ -1554,10 +1554,10 @@
}
/**
- * Finds a <code>Subroutine<code> that is returned from by a ret in
+ * Finds a {@code Subroutine} that is returned from by a ret in
* a given block.
* @param label A block that originally contained a ret instruction
- * @return null-ok; Subroutine or null if none was found.
+ * @return {@code null-ok;} Subroutine or null if none was found.
*/
private Subroutine subroutineFromRetBlock(int label) {
for (int i = subroutines.length - 1 ; i >= 0 ; i--) {
diff --git a/dx/src/com/android/dx/cf/code/RopperMachine.java b/dx/src/com/android/dx/cf/code/RopperMachine.java
index 6d05b38..dd7fcd4 100644
--- a/dx/src/com/android/dx/cf/code/RopperMachine.java
+++ b/dx/src/com/android/dx/cf/code/RopperMachine.java
@@ -47,13 +47,13 @@
* Machine implementation for use by {@link Ropper}.
*/
/*package*/ final class RopperMachine extends ValueAwareMachine {
- /** non-null; array reflection class */
+ /** {@code non-null;} array reflection class */
private static final CstType ARRAY_REFLECT_TYPE =
new CstType(Type.internClassName("java/lang/reflect/Array"));
/**
- * non-null; method constant for use in converting
- * <code>multianewarray</code> instructions
+ * {@code non-null;} method constant for use in converting
+ * {@code multianewarray} instructions
*/
private static final CstMethodRef MULTIANEWARRAY_METHOD =
new CstMethodRef(ARRAY_REFLECT_TYPE,
@@ -61,34 +61,34 @@
new CstUtf8("(Ljava/lang/Class;[I)" +
"Ljava/lang/Object;")));
- /** non-null; {@link Ropper} controlling this instance */
+ /** {@code non-null;} {@link Ropper} controlling this instance */
private final Ropper ropper;
- /** non-null; method being converted */
+ /** {@code non-null;} method being converted */
private final ConcreteMethod method;
- /** non-null; translation advice */
+ /** {@code non-null;} translation advice */
private final TranslationAdvice advice;
/** max locals of the method */
private final int maxLocals;
- /** non-null; instructions for the rop basic block in-progress */
+ /** {@code non-null;} instructions for the rop basic block in-progress */
private final ArrayList<Insn> insns;
- /** non-null; catches for the block currently being processed */
+ /** {@code non-null;} catches for the block currently being processed */
private TypeList catches;
/** whether the catches have been used in an instruction */
private boolean catchesUsed;
- /** whether the block contains a <code>return</code> */
+ /** whether the block contains a {@code return} */
private boolean returns;
/** primary successor index */
private int primarySuccessorIndex;
- /** >= 0; number of extra basic blocks required */
+ /** {@code >= 0;} number of extra basic blocks required */
private int extraBlockCount;
/** true if last processed block ends with a jsr or jsr_W*/
@@ -105,13 +105,13 @@
private ReturnAddress returnAddress;
/**
- * null-ok; the appropriate <code>return</code> op or <code>null</code>
+ * {@code null-ok;} the appropriate {@code return} op or {@code null}
* if it is not yet known
*/
private Rop returnOp;
/**
- * null-ok; the source position for the return block or <code>null</code>
+ * {@code null-ok;} the source position for the return block or {@code null}
* if it is not yet known
*/
private SourcePosition returnPosition;
@@ -119,9 +119,9 @@
/**
* Constructs an instance.
*
- * @param ropper non-null; ropper controlling this instance
- * @param method non-null; method being converted
- * @param advice non-null; translation advice to use
+ * @param ropper {@code non-null;} ropper controlling this instance
+ * @param method {@code non-null;} method being converted
+ * @param advice {@code non-null;} translation advice to use
*/
public RopperMachine(Ropper ropper, ConcreteMethod method,
TranslationAdvice advice) {
@@ -154,7 +154,7 @@
* Gets the instructions array. It is shared and gets modified by
* subsequent calls to this instance.
*
- * @return non-null; the instructions array
+ * @return {@code non-null;} the instructions array
*/
public ArrayList<Insn> getInsns() {
return insns;
@@ -163,7 +163,7 @@
/**
* Gets the return opcode encountered, if any.
*
- * @return null-ok; the return opcode
+ * @return {@code null-ok;} the return opcode
*/
public Rop getReturnOp() {
return returnOp;
@@ -172,7 +172,7 @@
/**
* Gets the return position, if known.
*
- * @return null-ok; the return position
+ * @return {@code null-ok;} the return position
*/
public SourcePosition getReturnPosition() {
return returnPosition;
@@ -182,7 +182,7 @@
* Gets ready to start working on a new block. This will clear the
* {@link #insns} list, set {@link #catches}, reset whether it has
* been used, reset whether the block contains a
- * <code>return</code>, and reset {@link #primarySuccessorIndex}.
+ * {@code return}, and reset {@link #primarySuccessorIndex}.
*/
public void startBlock(TypeList catches) {
this.catches = catches;
@@ -201,7 +201,7 @@
* Gets whether {@link #catches} was used. This indicates that the
* last instruction in the block is one of the ones that can throw.
*
- * @return whether <code>catches</code> has been used
+ * @return whether {@code catches} has been used
*/
public boolean wereCatchesUsed() {
return catchesUsed;
@@ -209,7 +209,7 @@
/**
* Gets whether the block just processed ended with a
- * <code>return</code>.
+ * {@code return}.
*
* @return whether the block returns
*/
@@ -220,12 +220,12 @@
/**
* Gets the primary successor index. This is the index into the
* successors list where the primary may be found or
- * <code>-1</code> if there are successors but no primary
+ * {@code -1} if there are successors but no primary
* successor. This may return something other than
- * <code>-1</code> in the case of an instruction with no
+ * {@code -1} in the case of an instruction with no
* successors at all (primary or otherwise).
*
- * @return >= -1; the primary successor index
+ * @return {@code >= -1;} the primary successor index
*/
public int getPrimarySuccessorIndex() {
return primarySuccessorIndex;
@@ -236,7 +236,7 @@
* block currently being translated. Each extra block should consist
* of one instruction from the end of the original block.
*
- * @return >= 0; the number of extra blocks needed
+ * @return {@code >= 0;} the number of extra blocks needed
*/
public int getExtraBlockCount() {
return extraBlockCount;
@@ -259,16 +259,17 @@
}
/**
- * @return true if a RET has ben encountered since the last call to
- * startBlock()
+ * @return {@code true} if a {@code ret} has ben encountered since
+ * the last call to {@code startBlock()}
*/
public boolean hasRet() {
return returnAddress != null;
}
/**
- * @return null-ok; return address of a ret instruction if encountered
- * since last call to startBlock(). null if no ret instruction encountered.
+ * @return {@code null-ok;} return address of a {@code ret}
+ * instruction if encountered since last call to startBlock().
+ * {@code null} if no ret instruction encountered.
*/
public ReturnAddress getReturnAddress() {
return returnAddress;
@@ -444,7 +445,7 @@
catches, MULTIANEWARRAY_METHOD);
insns.add(insn);
- // Add a move-result
+ // Add a move-result.
rop = Rops.opMoveResult(MULTIANEWARRAY_METHOD.getPrototype()
.getReturnType());
insn = new PlainInsn(rop, pos, objectReg, RegisterSpecList.EMPTY);
@@ -457,7 +458,6 @@
opcode = ByteOps.CHECKCAST;
sources = RegisterSpecList.make(objectReg);
-
} else if (opcode == ByteOps.JSR) {
// JSR has no Rop instruction
hasJsr = true;
@@ -474,12 +474,14 @@
}
ropOpcode = jopToRopOpcode(opcode, cst);
-
rop = Rops.ropFor(ropOpcode, destType, sources, cst);
Insn moveResult = null;
if (dest != null && rop.isCallLike()) {
- // We're going to want to have a move-result in the next basic block
+ /*
+ * We're going to want to have a move-result in the next
+ * basic block.
+ */
extraBlockCount++;
moveResult = new PlainInsn(
@@ -488,8 +490,10 @@
dest = null;
} else if (dest != null && rop.canThrow()) {
- // We're going to want to have a move-result-pseudo
- // in the next basic block
+ /*
+ * We're going to want to have a move-result-pseudo in the
+ * next basic block.
+ */
extraBlockCount++;
moveResult = new PlainInsn(
@@ -599,11 +603,12 @@
}
/*
- * If initValues is non-null, it means that the parser has seen a group
- * of compatible constant initialization bytecodes that are applied to
- * the current newarray. The action we take here is to convert these
- * initialization bytecodes into a single fill-array-data ROP which lays
- * out all the constant values in a table.
+ * If initValues is non-null, it means that the parser has
+ * seen a group of compatible constant initialization
+ * bytecodes that are applied to the current newarray. The
+ * action we take here is to convert these initialization
+ * bytecodes into a single fill-array-data ROP which lays out
+ * all the constant values in a table.
*/
if (initValues != null) {
extraBlockCount++;
@@ -619,9 +624,9 @@
* instruction.
*
* @param opcode the opcode being translated
- * @param stackPointer >= 0; the stack pointer after the instruction's
- * arguments have been popped
- * @return non-null; the sources
+ * @param stackPointer {@code >= 0;} the stack pointer after the
+ * instruction's arguments have been popped
+ * @return {@code non-null;} the sources
*/
private RegisterSpecList getSources(int opcode, int stackPointer) {
int count = argCount();
@@ -692,8 +697,8 @@
/**
* Sets or updates the information about the return block.
*
- * @param op non-null; the opcode to use
- * @param pos non-null; the position to use
+ * @param op {@code non-null;} the opcode to use
+ * @param pos {@code non-null;} the position to use
*/
private void updateReturnOp(Rop op, SourcePosition pos) {
if (op == null) {
@@ -723,9 +728,9 @@
/**
* Gets the register opcode for the given Java opcode.
*
- * @param jop >= 0; the Java opcode
- * @param cst null-ok; the constant argument, if any
- * @return >= 0; the corresponding register opcode
+ * @param jop {@code >= 0;} the Java opcode
+ * @param cst {@code null-ok;} the constant argument, if any
+ * @return {@code >= 0;} the corresponding register opcode
*/
private int jopToRopOpcode(int jop, Constant cst) {
switch (jop) {
diff --git a/dx/src/com/android/dx/cf/code/Simulator.java b/dx/src/com/android/dx/cf/code/Simulator.java
index 3c90ee5..408e126 100644
--- a/dx/src/com/android/dx/cf/code/Simulator.java
+++ b/dx/src/com/android/dx/cf/code/Simulator.java
@@ -35,34 +35,37 @@
/**
* Class which knows how to simulate the effects of executing bytecode.
- *
+ *
* <p><b>Note:</b> This class is not thread-safe. If multiple threads
* need to use a single instance, they must synchronize access explicitly
* between themselves.</p>
*/
public class Simulator {
- /** non-null; canned error message for local variable table mismatches */
- private static final String LOCAL_MISMATCH_ERROR =
+ /**
+ * {@code non-null;} canned error message for local variable
+ * table mismatches
+ */
+ private static final String LOCAL_MISMATCH_ERROR =
"This is symptomatic of .class transformation tools that ignore " +
"local variable information.";
- /** non-null; machine to use when simulating */
+ /** {@code non-null;} machine to use when simulating */
private final Machine machine;
- /** non-null; array of bytecode */
+ /** {@code non-null;} array of bytecode */
private final BytecodeArray code;
- /** non-null; local variable information */
+ /** {@code non-null;} local variable information */
private final LocalVariableList localVariables;
- /** non-null; visitor instance to use */
+ /** {@code non-null;} visitor instance to use */
private final SimVisitor visitor;
/**
* Constructs an instance.
*
- * @param machine non-null; machine to use when simulating
- * @param method non-null; method data to use
+ * @param machine {@code non-null;} machine to use when simulating
+ * @param method {@code non-null;} method data to use
*/
public Simulator(Machine machine, ConcreteMethod method) {
if (machine == null) {
@@ -83,8 +86,8 @@
* Simulates the effect of executing the given basic block. This modifies
* the passed-in frame to represent the end result.
*
- * @param bb non-null; the basic block
- * @param frame non-null; frame to operate on
+ * @param bb {@code non-null;} the basic block
+ * @param frame {@code non-null;} frame to operate on
*/
public void simulate(ByteBlock bb, Frame frame) {
int end = bb.getEnd();
@@ -107,8 +110,8 @@
* Simulates the effect of the instruction at the given offset, by
* making appropriate calls on the given frame.
*
- * @param offset >= 0; offset of the instruction to simulate
- * @param frame non-null; frame to operate on
+ * @param offset {@code >= 0;} offset of the instruction to simulate
+ * @param frame {@code non-null;} frame to operate on
* @return the length of the instruction, in bytes
*/
public int simulate(int offset, Frame frame) {
@@ -130,13 +133,13 @@
*/
private class SimVisitor implements BytecodeArray.Visitor {
/**
- * non-null; machine instance to use (just to avoid excessive
- * cross-object field access)
+ * {@code non-null;} machine instance to use (just to avoid excessive
+ * cross-object field access)
*/
private final Machine machine;
/**
- * null-ok; frame to use; set with each call to
+ * {@code null-ok;} frame to use; set with each call to
* {@link Simulator#simulate}
*/
private Frame frame;
@@ -155,7 +158,7 @@
/**
* Sets the frame to act on.
*
- * @param frame non-null; the frame
+ * @param frame {@code non-null;} the frame
*/
public void setFrame(Frame frame) {
if (frame == null) {
@@ -255,25 +258,21 @@
/*
* Change the type (which is to be pushed) to
* reflect the actual component type of the array
- * being popped.
+ * being popped, unless it turns out to be a
+ * known-null, in which case we just use the type
+ * implied by the original instruction.
*/
- Type requireType = type.getArrayType();
- type = frame.getStack().peekType(1);
- if (type == Type.KNOWN_NULL) {
- /*
- * The type is a known-null: Just treat the
- * popped type as whatever is expected. In
- * reality, unless this frame is revisited
- * (due to a branch merge), execution will
- * result in the throwing of a
- * NullPointerException, but claiming the
- * expected type at here should be good enough
- * for the purposes at this level.
- */
- type = requireType;
+ Type foundArrayType = frame.getStack().peekType(1);
+ Type requireArrayType;
+
+ if (foundArrayType != Type.KNOWN_NULL) {
+ requireArrayType = foundArrayType;
+ type = foundArrayType.getComponentType();
+ } else {
+ requireArrayType = type.getArrayType();
}
- type = type.getComponentType();
- machine.popArgs(frame, requireType, Type.INT);
+
+ machine.popArgs(frame, requireArrayType, Type.INT);
break;
}
case ByteOps.IADD:
@@ -292,7 +291,7 @@
case ByteOps.IUSHR: {
machine.popArgs(frame, type, Type.INT);
break;
- }
+ }
case ByteOps.LCMP: {
machine.popArgs(frame, Type.LONG, Type.LONG);
break;
@@ -308,8 +307,28 @@
break;
}
case ByteOps.IASTORE: {
- Type arrayType = type.getArrayType();
- machine.popArgs(frame, arrayType, Type.INT, type);
+ /*
+ * Change the type (which is the type of the
+ * element) to reflect the actual component type
+ * of the array being popped, unless it turns out
+ * to be a known-null, in which case we just use
+ * the type implied by the original instruction.
+ * The category 1 vs. 2 thing here is that, if the
+ * element type is category 2, we have to skip over
+ * one extra stack slot to find the array.
+ */
+ Type foundArrayType =
+ frame.getStack().peekType(type.isCategory1() ? 2 : 3);
+ Type requireArrayType;
+
+ if (foundArrayType != Type.KNOWN_NULL) {
+ requireArrayType = foundArrayType;
+ type = foundArrayType.getComponentType();
+ } else {
+ requireArrayType = type.getArrayType();
+ }
+
+ machine.popArgs(frame, requireArrayType, Type.INT, type);
break;
}
case ByteOps.POP2:
@@ -456,7 +475,7 @@
* Checks whether the prototype is compatible with returning the
* given type, and throws if not.
*
- * @param encountered non-null; the encountered return type
+ * @param encountered {@code non-null;} the encountered return type
*/
private void checkReturnType(Type encountered) {
Type returnType = machine.getPrototype().getReturnType();
diff --git a/dx/src/com/android/dx/cf/code/SwitchList.java b/dx/src/com/android/dx/cf/code/SwitchList.java
index dc04137..fdd1596 100644
--- a/dx/src/com/android/dx/cf/code/SwitchList.java
+++ b/dx/src/com/android/dx/cf/code/SwitchList.java
@@ -21,15 +21,15 @@
/**
* List of (value, target) mappings representing the choices of a
- * <code>tableswitch</code> or <code>lookupswitch</code> instruction. It
+ * {@code tableswitch} or {@code lookupswitch} instruction. It
* also holds the default target for the switch.
*/
public final class SwitchList extends MutabilityControl {
- /** non-null; list of test values */
+ /** {@code non-null;} list of test values */
private final IntList values;
/**
- * non-null; list of targets corresponding to the test values; there
+ * {@code non-null;} list of targets corresponding to the test values; there
* is always one extra element in the target list, to hold the
* default target
*/
@@ -41,7 +41,7 @@
/**
* Constructs an instance.
*
- * @param size >= 0; the number of elements to be in the table
+ * @param size {@code >= 0;} the number of elements to be in the table
*/
public SwitchList(int size) {
super(true);
@@ -61,7 +61,7 @@
/**
* Gets the size of the list.
*
- * @return >= 0; the list size
+ * @return {@code >= 0;} the list size
*/
public int size() {
return size;
@@ -70,7 +70,7 @@
/**
* Gets the indicated test value.
*
- * @param n >= 0;, < size(); which index
+ * @param n {@code >= 0;}, < size(); which index
* @return the test value
*/
public int getValue(int n) {
@@ -78,11 +78,11 @@
}
/**
- * Gets the indicated target. Asking for the target at <code>size()</code>
+ * Gets the indicated target. Asking for the target at {@code size()}
* returns the default target.
*
- * @param n >= 0, <= size(); which index
- * @return >= 0; the target
+ * @param n {@code >= 0, <= size();} which index
+ * @return {@code >= 0;} the target
*/
public int getTarget(int n) {
return targets.get(n);
@@ -90,9 +90,9 @@
/**
* Gets the default target. This is just a shorthand for
- * <code>getTarget(size())</code>.
+ * {@code getTarget(size())}.
*
- * @return >= 0; the default target
+ * @return {@code >= 0;} the default target
*/
public int getDefaultTarget() {
return targets.get(size);
@@ -102,7 +102,7 @@
* Gets the list of all targets. This includes one extra element at the
* end of the list, which holds the default target.
*
- * @return non-null; the target list
+ * @return {@code non-null;} the target list
*/
public IntList getTargets() {
return targets;
@@ -111,7 +111,7 @@
/**
* Gets the list of all case values.
*
- * @return non-null; the case value list
+ * @return {@code non-null;} the case value list
*/
public IntList getValues() {
return values;
@@ -121,7 +121,7 @@
* Sets the default target. It is only valid to call this method
* when all the non-default elements have been set.
*
- * @param target >= 0; the absolute (not relative) default target
+ * @param target {@code >= 0;} the absolute (not relative) default target
* address
*/
public void setDefaultTarget(int target) {
@@ -142,7 +142,7 @@
* Adds the given item.
*
* @param value the test value
- * @param target >= 0; the absolute (not relative) target address
+ * @param target {@code >= 0;} the absolute (not relative) target address
*/
public void add(int value, int target) {
throwIfImmutable();
diff --git a/dx/src/com/android/dx/cf/code/ValueAwareMachine.java b/dx/src/com/android/dx/cf/code/ValueAwareMachine.java
index 4062c3b..43aab8a 100644
--- a/dx/src/com/android/dx/cf/code/ValueAwareMachine.java
+++ b/dx/src/com/android/dx/cf/code/ValueAwareMachine.java
@@ -30,7 +30,8 @@
/**
* Constructs an instance.
*
- * @param prototype non-null; the prototype for the associated method
+ * @param prototype {@code non-null;} the prototype for the associated
+ * method
*/
public ValueAwareMachine(Prototype prototype) {
super(prototype);
diff --git a/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java b/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java
index 953981c..7cd9c9b 100644
--- a/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java
+++ b/dx/src/com/android/dx/cf/cst/ConstantPoolParser.java
@@ -41,29 +41,29 @@
* Parser for a constant pool embedded in a class file.
*/
public final class ConstantPoolParser {
- /** non-null; the bytes of the constant pool */
+ /** {@code non-null;} the bytes of the constant pool */
private final ByteArray bytes;
- /** non-null; actual parsed constant pool contents */
+ /** {@code non-null;} actual parsed constant pool contents */
private final StdConstantPool pool;
- /** non-null; byte offsets to each cst */
+ /** {@code non-null;} byte offsets to each cst */
private final int[] offsets;
/**
* -1 || >= 10; the end offset of this constant pool in the
- * <code>byte[]</code> which it came from or <code>-1</code> if not
+ * {@code byte[]} which it came from or {@code -1} if not
* yet parsed
*/
private int endOffset;
- /** null-ok; parse observer, if any */
+ /** {@code null-ok;} parse observer, if any */
private ParseObserver observer;
/**
* Constructs an instance.
*
- * @param bytes non-null; the bytes of the file
+ * @param bytes {@code non-null;} the bytes of the file
*/
public ConstantPoolParser(ByteArray bytes) {
int size = bytes.getUnsignedShort(8); // constant_pool_count
@@ -77,17 +77,17 @@
/**
* Sets the parse observer for this instance.
*
- * @param observer null-ok; the observer
+ * @param observer {@code null-ok;} the observer
*/
public void setObserver(ParseObserver observer) {
this.observer = observer;
}
/**
- * Gets the end offset of this constant pool in the <code>byte[]</code>
+ * Gets the end offset of this constant pool in the {@code byte[]}
* which it came from.
*
- * @return >= 10; the end offset
+ * @return {@code >= 10;} the end offset
*/
public int getEndOffset() {
parseIfNecessary();
@@ -97,7 +97,7 @@
/**
* Gets the actual constant pool.
*
- * @return non-null; the constant pool
+ * @return {@code non-null;} the constant pool
*/
public StdConstantPool getPool() {
parseIfNecessary();
@@ -215,7 +215,7 @@
* depends on.
*
* @param idx which constant
- * @return non-null; the parsed constant
+ * @return {@code non-null;} the parsed constant
*/
private Constant parse0(int idx) {
Constant cst = pool.getOrNull(idx);
@@ -316,7 +316,7 @@
* Parses a utf8 constant.
*
* @param at offset to the start of the constant (where the tag byte is)
- * @return non-null; the parsed value
+ * @return {@code non-null;} the parsed value
*/
private CstUtf8 parseUtf8(int at) {
int length = bytes.getUnsignedShort(at + 1);
diff --git a/dx/src/com/android/dx/cf/cst/ConstantTags.java b/dx/src/com/android/dx/cf/cst/ConstantTags.java
index 64bc8d8..9febbdf 100644
--- a/dx/src/com/android/dx/cf/cst/ConstantTags.java
+++ b/dx/src/com/android/dx/cf/cst/ConstantTags.java
@@ -20,36 +20,36 @@
* Tags for constant pool constants.
*/
public interface ConstantTags {
- /** tag for a <code>CONSTANT_Utf8_info</code> */
+ /** tag for a {@code CONSTANT_Utf8_info} */
int CONSTANT_Utf8 = 1;
- /** tag for a <code>CONSTANT_Integer_info</code> */
+ /** tag for a {@code CONSTANT_Integer_info} */
int CONSTANT_Integer = 3;
- /** tag for a <code>CONSTANT_Float_info</code> */
+ /** tag for a {@code CONSTANT_Float_info} */
int CONSTANT_Float = 4;
- /** tag for a <code>CONSTANT_Long_info</code> */
+ /** tag for a {@code CONSTANT_Long_info} */
int CONSTANT_Long = 5;
- /** tag for a <code>CONSTANT_Double_info</code> */
+ /** tag for a {@code CONSTANT_Double_info} */
int CONSTANT_Double = 6;
- /** tag for a <code>CONSTANT_Class_info</code> */
+ /** tag for a {@code CONSTANT_Class_info} */
int CONSTANT_Class = 7;
- /** tag for a <code>CONSTANT_String_info</code> */
+ /** tag for a {@code CONSTANT_String_info} */
int CONSTANT_String = 8;
- /** tag for a <code>CONSTANT_Fieldref_info</code> */
+ /** tag for a {@code CONSTANT_Fieldref_info} */
int CONSTANT_Fieldref = 9;
- /** tag for a <code>CONSTANT_Methodref_info</code> */
+ /** tag for a {@code CONSTANT_Methodref_info} */
int CONSTANT_Methodref = 10;
- /** tag for a <code>CONSTANT_InterfaceMethodref_info</code> */
+ /** tag for a {@code CONSTANT_InterfaceMethodref_info} */
int CONSTANT_InterfaceMethodref = 11;
- /** tag for a <code>CONSTANT_NameAndType_info</code> */
+ /** tag for a {@code CONSTANT_NameAndType_info} */
int CONSTANT_NameAndType = 12;
}
diff --git a/dx/src/com/android/dx/cf/direct/AnnotationParser.java b/dx/src/com/android/dx/cf/direct/AnnotationParser.java
index 5d80086..88e4cd2 100644
--- a/dx/src/com/android/dx/cf/direct/AnnotationParser.java
+++ b/dx/src/com/android/dx/cf/direct/AnnotationParser.java
@@ -51,23 +51,23 @@
* Parser for annotations.
*/
public final class AnnotationParser {
- /** non-null; class file being parsed */
+ /** {@code non-null;} class file being parsed */
private final DirectClassFile cf;
- /** non-null; constant pool to use */
+ /** {@code non-null;} constant pool to use */
private final ConstantPool pool;
- /** non-null; bytes of the attribute data */
+ /** {@code non-null;} bytes of the attribute data */
private final ByteArray bytes;
- /** null-ok; parse observer, if any */
+ /** {@code null-ok;} parse observer, if any */
private final ParseObserver observer;
- /** non-null; input stream to parse from */
+ /** {@code non-null;} input stream to parse from */
private final ByteArray.MyDataInputStream input;
/**
- * non-null; cursor for use when informing the observer of what
+ * {@code non-null;} cursor for use when informing the observer of what
* was parsed
*/
private int parseCursor;
@@ -75,10 +75,10 @@
/**
* Constructs an instance.
*
- * @param cf non-null; class file to parse from
- * @param offset >= 0; offset into the class file data to parse at
- * @param length >= 0; number of bytes left in the attribute data
- * @param observer null-ok; parse observer to notify, if any
+ * @param cf {@code non-null;} class file to parse from
+ * @param offset {@code >= 0;} offset into the class file data to parse at
+ * @param length {@code >= 0;} number of bytes left in the attribute data
+ * @param observer {@code null-ok;} parse observer to notify, if any
*/
public AnnotationParser(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -95,9 +95,9 @@
}
/**
- * Parses an annotation value (<code>element_value</code>) attribute.
+ * Parses an annotation value ({@code element_value}) attribute.
*
- * @return non-null; the parsed constant value
+ * @return {@code non-null;} the parsed constant value
*/
public Constant parseValueAttribute() {
Constant result;
@@ -119,8 +119,8 @@
/**
* Parses a parameter annotation attribute.
*
- * @param visibility non-null; visibility of the parsed annotations
- * @return non-null; the parsed list of lists of annotations
+ * @param visibility {@code non-null;} visibility of the parsed annotations
+ * @return {@code non-null;} the parsed list of lists of annotations
*/
public AnnotationsList parseParameterAttribute(
AnnotationVisibility visibility) {
@@ -143,8 +143,8 @@
/**
* Parses an annotation attribute, per se.
*
- * @param visibility non-null; visibility of the parsed annotations
- * @return non-null; the list of annotations read from the attribute
+ * @param visibility {@code non-null;} visibility of the parsed annotations
+ * @return {@code non-null;} the list of annotations read from the attribute
* data
*/
public Annotations parseAnnotationAttribute(
@@ -168,8 +168,8 @@
/**
* Parses a list of annotation lists.
*
- * @param visibility non-null; visibility of the parsed annotations
- * @return non-null; the list of annotation lists read from the attribute
+ * @param visibility {@code non-null;} visibility of the parsed annotations
+ * @return {@code non-null;} the list of annotation lists read from the attribute
* data
*/
private AnnotationsList parseAnnotationsList(
@@ -203,8 +203,8 @@
/**
* Parses an annotation list.
*
- * @param visibility non-null; visibility of the parsed annotations
- * @return non-null; the list of annotations read from the attribute
+ * @param visibility {@code non-null;} visibility of the parsed annotations
+ * @return {@code non-null;} the list of annotations read from the attribute
* data
*/
private Annotations parseAnnotations(AnnotationVisibility visibility)
@@ -238,8 +238,8 @@
/**
* Parses a single annotation.
*
- * @param visibility non-null; visibility of the parsed annotation
- * @return non-null; the parsed annotation
+ * @param visibility {@code non-null;} visibility of the parsed annotation
+ * @return {@code non-null;} the parsed annotation
*/
private Annotation parseAnnotation(AnnotationVisibility visibility)
throws IOException {
@@ -278,7 +278,7 @@
/**
* Parses a {@link NameValuePair}.
*
- * @return non-null; the parsed element
+ * @return {@code non-null;} the parsed element
*/
private NameValuePair parseElement() throws IOException {
requireLength(5);
@@ -304,7 +304,7 @@
/**
* Parses an annotation value.
*
- * @return non-null; the parsed value
+ * @return {@code non-null;} the parsed value
*/
private Constant parseValue() throws IOException {
int tag = input.readUnsignedByte();
@@ -421,7 +421,7 @@
* Helper for {@link #parseValue}, which parses a constant reference
* and returns the referred-to constant value.
*
- * @return non-null; the parsed value
+ * @return {@code non-null;} the parsed value
*/
private Constant parseConstant() throws IOException {
int constValueIndex = input.readUnsignedShort();
@@ -454,8 +454,8 @@
* only be used (for efficiency sake) if the parse is known to be
* observed.
*
- * @param length >= 0; number of bytes parsed
- * @param message non-null; associated message
+ * @param length {@code >= 0;} number of bytes parsed
+ * @param message {@code non-null;} associated message
*/
private void parsed(int length, String message) {
observer.parsed(bytes, parseCursor, length, message);
@@ -464,7 +464,7 @@
/**
* Convenience wrapper that simply calls through to
- * <code>observer.changeIndent()</code>.
+ * {@code observer.changeIndent()}.
*
* @param indent the amount to change the indent by
*/
diff --git a/dx/src/com/android/dx/cf/direct/AttributeFactory.java b/dx/src/com/android/dx/cf/direct/AttributeFactory.java
index 420d741..d00a859 100644
--- a/dx/src/com/android/dx/cf/direct/AttributeFactory.java
+++ b/dx/src/com/android/dx/cf/direct/AttributeFactory.java
@@ -58,13 +58,13 @@
* the name, and then does all the setup to call on to {@link #parse0},
* which does the actual construction.
*
- * @param cf non-null; class file to parse from
- * @param context context to parse in; one of the <code>CTX_*</code>
+ * @param cf {@code non-null;} class file to parse from
+ * @param context context to parse in; one of the {@code CTX_*}
* constants
- * @param offset offset into <code>dcf</code>'s <code>bytes</code>
+ * @param offset offset into {@code dcf}'s {@code bytes}
* to start parsing at
- * @param observer null-ok; parse observer to report to, if any
- * @return non-null; an appropriately-constructed {@link Attribute}
+ * @param observer {@code null-ok;} parse observer to report to, if any
+ * @return {@code non-null;} an appropriately-constructed {@link Attribute}
*/
public final Attribute parse(DirectClassFile cf, int context, int offset,
ParseObserver observer) {
@@ -108,15 +108,15 @@
* an instance of {@link RawAttribute}. Subclasses are expected to
* override this to do something better in most cases.
*
- * @param cf non-null; class file to parse from
- * @param context context to parse in; one of the <code>CTX_*</code>
+ * @param cf {@code non-null;} class file to parse from
+ * @param context context to parse in; one of the {@code CTX_*}
* constants
- * @param name non-null; the attribute name
- * @param offset offset into <code>bytes</code> to start parsing at; this
+ * @param name {@code non-null;} the attribute name
+ * @param offset offset into {@code bytes} to start parsing at; this
* is the offset to the start of attribute data, not to the header
* @param length the length of the attribute data
- * @param observer null-ok; parse observer to report to, if any
- * @return non-null; an appropriately-constructed {@link Attribute}
+ * @param observer {@code null-ok;} parse observer to report to, if any
+ * @return {@code non-null;} an appropriately-constructed {@link Attribute}
*/
protected Attribute parse0(DirectClassFile cf, int context, String name,
int offset, int length,
diff --git a/dx/src/com/android/dx/cf/direct/AttributeListParser.java b/dx/src/com/android/dx/cf/direct/AttributeListParser.java
index 7652265..2715e6a 100644
--- a/dx/src/com/android/dx/cf/direct/AttributeListParser.java
+++ b/dx/src/com/android/dx/cf/direct/AttributeListParser.java
@@ -27,7 +27,7 @@
* Parser for lists of attributes.
*/
final /*package*/ class AttributeListParser {
- /** non-null; the class file to parse from */
+ /** {@code non-null;} the class file to parse from */
private final DirectClassFile cf;
/** attribute parsing context */
@@ -36,26 +36,26 @@
/** offset in the byte array of the classfile to the start of the list */
private final int offset;
- /** non-null; attribute factory to use */
+ /** {@code non-null;} attribute factory to use */
private final AttributeFactory attributeFactory;
- /** non-null; list of parsed attributes */
+ /** {@code non-null;} list of parsed attributes */
private final StdAttributeList list;
- /** >= -1; the end offset of this list in the byte array of the
- * classfile, or <code>-1</code> if not yet parsed */
+ /** {@code >= -1;} the end offset of this list in the byte array of the
+ * classfile, or {@code -1} if not yet parsed */
private int endOffset;
- /** null-ok; parse observer, if any */
+ /** {@code null-ok;} parse observer, if any */
private ParseObserver observer;
/**
* Constructs an instance.
*
- * @param cf non-null; class file to parse from
+ * @param cf {@code non-null;} class file to parse from
* @param context attribute parsing context (see {@link AttributeFactory})
- * @param offset offset in <code>bytes</code> to the start of the list
- * @param attributeFactory non-null; attribute factory to use
+ * @param offset offset in {@code bytes} to the start of the list
+ * @param attributeFactory {@code non-null;} attribute factory to use
*/
public AttributeListParser(DirectClassFile cf, int context, int offset,
AttributeFactory attributeFactory) {
@@ -80,17 +80,17 @@
/**
* Sets the parse observer for this instance.
*
- * @param observer null-ok; the observer
+ * @param observer {@code null-ok;} the observer
*/
public void setObserver(ParseObserver observer) {
this.observer = observer;
}
/**
- * Gets the end offset of this constant pool in the <code>byte[]</code>
+ * Gets the end offset of this constant pool in the {@code byte[]}
* which it came from.
*
- * @return >= 0; the end offset
+ * @return {@code >= 0;} the end offset
*/
public int getEndOffset() {
parseIfNecessary();
@@ -100,7 +100,7 @@
/**
* Gets the parsed list.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public StdAttributeList getList() {
parseIfNecessary();
diff --git a/dx/src/com/android/dx/cf/direct/ClassPathOpener.java b/dx/src/com/android/dx/cf/direct/ClassPathOpener.java
index d302349..fd5546f 100644
--- a/dx/src/com/android/dx/cf/direct/ClassPathOpener.java
+++ b/dx/src/com/android/dx/cf/direct/ClassPathOpener.java
@@ -36,9 +36,9 @@
*/
public class ClassPathOpener {
- /** non-null; pathname to start with */
+ /** {@code non-null;} pathname to start with */
private final String pathname;
- /** non-null; callback interface */
+ /** {@code non-null;} callback interface */
private final Consumer consumer;
/**
* If true, sort such that classes appear before their inner
@@ -48,20 +48,20 @@
private final boolean sort;
/**
- * Callback interface for <code>ClassOpener</code>.
+ * Callback interface for {@code ClassOpener}.
*/
public interface Consumer {
/**
* Provides the file name and byte array for a class path element.
*
- * @param name non-null; filename of element. May not be a valid
+ * @param name {@code non-null;} filename of element. May not be a valid
* filesystem path.
*
- * @param bytes non-null; file data
+ * @param bytes {@code non-null;} file data
* @return true on success. Result is or'd with all other results
- * from <code>processFileBytes</code> and returned to the caller
- * of <code>process()</code>.
+ * from {@code processFileBytes} and returned to the caller
+ * of {@code process()}.
*/
boolean processFileBytes(String name, byte[] bytes);
@@ -69,14 +69,14 @@
* Informs consumer that an exception occurred while processing
* this path element. Processing will continue if possible.
*
- * @param ex non-null; exception
+ * @param ex {@code non-null;} exception
*/
void onException(Exception ex);
/**
* Informs consumer that processing of an archive file has begun.
*
- * @param file non-null; archive file being processed
+ * @param file {@code non-null;} archive file being processed
*/
void onProcessArchiveStart(File file);
}
@@ -84,11 +84,11 @@
/**
* Constructs an instance.
*
- * @param pathname non-null; path element to process
+ * @param pathname {@code non-null;} path element to process
* @param sort if true, sort such that classes appear before their inner
* classes and "package-info" occurs before all other classes in that
* package.
- * @param consumer non-null; callback interface
+ * @param consumer {@code non-null;} callback interface
*/
public ClassPathOpener(String pathname, boolean sort, Consumer consumer) {
this.pathname = pathname;
@@ -100,7 +100,7 @@
* Processes a path element.
*
* @return the OR of all return values
- * from <code>Consumer.processFileBytes()</code>.
+ * from {@code Consumer.processFileBytes()}.
*/
public boolean process() {
File file = new File(pathname);
@@ -111,7 +111,7 @@
/**
* Processes one file.
*
- * @param file non-null; the file to process
+ * @param file {@code non-null;} the file to process
* @param topLevel whether this is a top-level file (that is,
* specified directly on the commandline)
* @return whether any processing actually happened
@@ -142,9 +142,9 @@
* Sorts java class names such that outer classes preceed their inner
* classes and "package-info" preceeds all other classes in its package.
*
- * @param a non-null; first class name
- * @param b non-null; second class name
- * @return <code>compareTo()</code>-style result
+ * @param a {@code non-null;} first class name
+ * @param b {@code non-null;} second class name
+ * @return {@code compareTo()}-style result
*/
private static int compareClassNames(String a, String b) {
// Ensure inner classes sort second
@@ -164,7 +164,7 @@
/**
* Processes a directory recursively.
*
- * @param dir non-null; file representing the directory
+ * @param dir {@code non-null;} file representing the directory
* @param topLevel whether this is a top-level directory (that is,
* specified directly on the commandline)
* @return whether any processing actually happened
@@ -194,10 +194,10 @@
}
/**
- * Processes the contents of an archive (<code>.zip</code>,
- * <code>.jar</code>, or <code>.apk</code>).
+ * Processes the contents of an archive ({@code .zip},
+ * {@code .jar}, or {@code .apk}).
*
- * @param file non-null; archive file to process
+ * @param file {@code non-null;} archive file to process
* @return whether any processing actually happened
* @throws IOException on i/o problem
*/
diff --git a/dx/src/com/android/dx/cf/direct/CodeObserver.java b/dx/src/com/android/dx/cf/direct/CodeObserver.java
index 950147f..952f1bc 100644
--- a/dx/src/com/android/dx/cf/direct/CodeObserver.java
+++ b/dx/src/com/android/dx/cf/direct/CodeObserver.java
@@ -39,17 +39,17 @@
* Bytecode visitor to use when "observing" bytecode getting parsed.
*/
public class CodeObserver implements BytecodeArray.Visitor {
- /** non-null; actual array of bytecode */
+ /** {@code non-null;} actual array of bytecode */
private final ByteArray bytes;
- /** non-null; observer to inform of parsing */
+ /** {@code non-null;} observer to inform of parsing */
private final ParseObserver observer;
/**
* Constructs an instance.
*
- * @param bytes non-null; actual array of bytecode
- * @param observer non-null; observer to inform of parsing
+ * @param bytes {@code non-null;} actual array of bytecode
+ * @param observer {@code non-null;} observer to inform of parsing
*/
public CodeObserver(ByteArray bytes, ParseObserver observer) {
if (bytes == null) {
@@ -218,8 +218,8 @@
}
/**
- * Helper for {code #visitConstant} where the constant is an
- * <code>int</code>.
+ * Helper for {@link #visitConstant} where the constant is an
+ * {@code int}.
*
* @param opcode the opcode
* @param offset offset to the instruction
@@ -245,8 +245,8 @@
}
/**
- * Helper for {code #visitConstant} where the constant is a
- * <code>long</code>.
+ * Helper for {@link #visitConstant} where the constant is a
+ * {@code long}.
*
* @param opcode the opcode
* @param offset offset to the instruction
@@ -269,8 +269,8 @@
}
/**
- * Helper for {code #visitConstant} where the constant is a
- * <code>float</code>.
+ * Helper for {@link #visitConstant} where the constant is a
+ * {@code float}.
*
* @param opcode the opcode
* @param offset offset to the instruction
@@ -287,8 +287,8 @@
}
/**
- * Helper for {code #visitConstant} where the constant is a
- * <code>double</code>.
+ * Helper for {@link #visitConstant} where the constant is a
+ * {@code double}.
*
* @param opcode the opcode
* @param offset offset to the instruction
diff --git a/dx/src/com/android/dx/cf/direct/DirectClassFile.java b/dx/src/com/android/dx/cf/direct/DirectClassFile.java
index e4751a4..ac227fa 100644
--- a/dx/src/com/android/dx/cf/direct/DirectClassFile.java
+++ b/dx/src/com/android/dx/cf/direct/DirectClassFile.java
@@ -38,14 +38,14 @@
import com.android.dx.util.Hex;
/**
- * Class file with info taken from a <code>byte[]</code> or slice thereof.
+ * Class file with info taken from a {@code byte[]} or slice thereof.
*/
public class DirectClassFile implements ClassFile {
/** the expected value of the ClassFile.magic field */
private static final int CLASS_FILE_MAGIC = 0xcafebabe;
/**
- * minimum <code>.class</code> file major version
+ * minimum {@code .class} file major version
*
* The class file definition (vmspec/2nd-edition) says:
*
@@ -64,92 +64,92 @@
*/
private static final int CLASS_FILE_MIN_MAJOR_VERSION = 45;
- /** maximum <code>.class</code> file major version */
+ /** maximum {@code .class} file major version */
private static final int CLASS_FILE_MAX_MAJOR_VERSION = 50;
- /** maximum <code>.class</code> file minor version */
+ /** maximum {@code .class} file minor version */
private static final int CLASS_FILE_MAX_MINOR_VERSION = 0;
/**
- * non-null; the file path for the class, excluding any base directory
+ * {@code non-null;} the file path for the class, excluding any base directory
* specification
*/
private final String filePath;
- /** non-null; the bytes of the file */
+ /** {@code non-null;} the bytes of the file */
private final ByteArray bytes;
/**
* whether to be strict about parsing; if
- * <code>false</code>, this avoids doing checks that only exist
+ * {@code false}, this avoids doing checks that only exist
* for purposes of verification (such as magic number matching and
* path-package consistency checking)
*/
private final boolean strictParse;
/**
- * null-ok; the constant pool; only ever <code>null</code>
+ * {@code null-ok;} the constant pool; only ever {@code null}
* before the constant pool is successfully parsed
*/
private StdConstantPool pool;
/**
- * the class file field <code>access_flags</code>; will be <code>-1</code>
+ * the class file field {@code access_flags}; will be {@code -1}
* before the file is successfully parsed
*/
private int accessFlags;
/**
- * null-ok; the class file field <code>this_class</code>,
- * interpreted as a type constant; only ever <code>null</code>
+ * {@code null-ok;} the class file field {@code this_class},
+ * interpreted as a type constant; only ever {@code null}
* before the file is successfully parsed
*/
private CstType thisClass;
/**
- * null-ok; the class file field <code>super_class</code>, interpreted
+ * {@code null-ok;} the class file field {@code super_class}, interpreted
* as a type constant if non-zero
*/
private CstType superClass;
/**
- * null-ok; the class file field <code>interfaces</code>; only
- * ever <code>null</code> before the file is successfully
+ * {@code null-ok;} the class file field {@code interfaces}; only
+ * ever {@code null} before the file is successfully
* parsed
*/
private TypeList interfaces;
/**
- * null-ok; the class file field <code>fields</code>; only ever
- * <code>null</code> before the file is successfully parsed
+ * {@code null-ok;} the class file field {@code fields}; only ever
+ * {@code null} before the file is successfully parsed
*/
private FieldList fields;
/**
- * null-ok; the class file field <code>methods</code>; only ever
- * <code>null</code> before the file is successfully parsed
+ * {@code null-ok;} the class file field {@code methods}; only ever
+ * {@code null} before the file is successfully parsed
*/
private MethodList methods;
/**
- * null-ok; the class file field <code>attributes</code>; only
- * ever <code>null</code> before the file is successfully
+ * {@code null-ok;} the class file field {@code attributes}; only
+ * ever {@code null} before the file is successfully
* parsed
*/
private StdAttributeList attributes;
- /** null-ok; attribute factory, if any */
+ /** {@code null-ok;} attribute factory, if any */
private AttributeFactory attributeFactory;
- /** null-ok; parse observer, if any */
+ /** {@code null-ok;} parse observer, if any */
private ParseObserver observer;
/**
- * Returns the string form of an object or <code>"(none)"</code>
- * (rather than <code>"null"</code>) for <code>null</code>.
+ * Returns the string form of an object or {@code "(none)"}
+ * (rather than {@code "null"}) for {@code null}.
*
- * @param obj null-ok; the object to stringify
- * @return non-null; the appropriate string form
+ * @param obj {@code null-ok;} the object to stringify
+ * @return {@code non-null;} the appropriate string form
*/
public static String stringOrNone(Object obj) {
if (obj == null) {
@@ -162,11 +162,11 @@
/**
* Constructs an instance.
*
- * @param bytes non-null; the bytes of the file
- * @param filePath non-null; the file path for the class,
+ * @param bytes {@code non-null;} the bytes of the file
+ * @param filePath {@code non-null;} the file path for the class,
* excluding any base directory specification
* @param strictParse whether to be strict about parsing; if
- * <code>false</code>, this avoids doing checks that only exist
+ * {@code false}, this avoids doing checks that only exist
* for purposes of verification (such as magic number matching and
* path-package consistency checking)
*/
@@ -189,11 +189,11 @@
/**
* Constructs an instance.
*
- * @param bytes non-null; the bytes of the file
- * @param filePath non-null; the file path for the class,
+ * @param bytes {@code non-null;} the bytes of the file
+ * @param filePath {@code non-null;} the file path for the class,
* excluding any base directory specification
* @param strictParse whether to be strict about parsing; if
- * <code>false</code>, this avoids doing checks that only exist
+ * {@code false}, this avoids doing checks that only exist
* for purposes of verification (such as magic number matching and
* path-package consistency checking)
*/
@@ -205,7 +205,7 @@
/**
* Sets the parse observer for this instance.
*
- * @param observer null-ok; the observer
+ * @param observer {@code null-ok;} the observer
*/
public void setObserver(ParseObserver observer) {
this.observer = observer;
@@ -214,7 +214,7 @@
/**
* Sets the attribute factory to use.
*
- * @param attributeFactory non-null; the attribute factory
+ * @param attributeFactory {@code non-null;} the attribute factory
*/
public void setAttributeFactory(AttributeFactory attributeFactory) {
if (attributeFactory == null) {
@@ -227,7 +227,7 @@
/**
* Gets the {@link ByteArray} that this instance's data comes from.
*
- * @return non-null; the bytes
+ * @return {@code non-null;} the bytes
*/
public ByteArray getBytes() {
return bytes;
@@ -317,12 +317,12 @@
* list of constant pool indices for classes, which are in turn
* translated to type constants. Instance construction will fail
* if any of the (alleged) indices turn out not to refer to
- * constant pool entries of type <code>Class</code>.
+ * constant pool entries of type {@code Class}.
*
* @param offset offset into {@link #bytes} for the start of the
* data
* @param size number of elements in the list (not number of bytes)
- * @return non-null; an appropriately-constructed class list
+ * @return {@code non-null;} an appropriately-constructed class list
*/
public TypeList makeTypeList(int offset, int size) {
if (size == 0) {
@@ -337,7 +337,7 @@
}
/**
- * Gets the class file field <code>magic</code>, but without doing any
+ * Gets the class file field {@code magic}, but without doing any
* checks or parsing first.
*
* @return the magic value
@@ -347,7 +347,7 @@
}
/**
- * Gets the class file field <code>minor_version</code>, but
+ * Gets the class file field {@code minor_version}, but
* without doing any checks or parsing first.
*
* @return the minor version
@@ -357,7 +357,7 @@
}
/**
- * Gets the class file field <code>major_version</code>, but
+ * Gets the class file field {@code major_version}, but
* without doing any checks or parsing first.
*
* @return the major version
@@ -554,27 +554,27 @@
* which are in turn returned as type constants. Instance
* construction will fail if any of the (alleged) indices turn out
* not to refer to constant pool entries of type
- * <code>Class</code>.
+ * {@code Class}.
*/
private static class DcfTypeList implements TypeList {
- /** non-null; array containing the data */
+ /** {@code non-null;} array containing the data */
private final ByteArray bytes;
/** number of elements in the list (not number of bytes) */
private final int size;
- /** non-null; the constant pool */
+ /** {@code non-null;} the constant pool */
private final StdConstantPool pool;
/**
* Constructs an instance.
*
- * @param bytes non-null; original classfile's bytes
+ * @param bytes {@code non-null;} original classfile's bytes
* @param offset offset into {@link #bytes} for the start of the
* data
* @param size number of elements in the list (not number of bytes)
- * @param pool non-null; the constant pool to use
- * @param observer null-ok; parse observer to use, if any
+ * @param pool {@code non-null;} the constant pool to use
+ * @param observer {@code null-ok;} parse observer to use, if any
*/
public DcfTypeList(ByteArray bytes, int offset, int size,
StdConstantPool pool, ParseObserver observer) {
diff --git a/dx/src/com/android/dx/cf/direct/FieldListParser.java b/dx/src/com/android/dx/cf/direct/FieldListParser.java
index 06dcc41..24ba7e0 100644
--- a/dx/src/com/android/dx/cf/direct/FieldListParser.java
+++ b/dx/src/com/android/dx/cf/direct/FieldListParser.java
@@ -28,16 +28,16 @@
* Parser for lists of fields in a class file.
*/
final /*package*/ class FieldListParser extends MemberListParser {
- /** non-null; list in progress */
+ /** {@code non-null;} list in progress */
private final StdFieldList fields;
/**
* Constructs an instance.
*
- * @param cf non-null; the class file to parse from
- * @param definer non-null; class being defined
- * @param offset offset in <code>bytes</code> to the start of the list
- * @param attributeFactory non-null; attribute factory to use
+ * @param cf {@code non-null;} the class file to parse from
+ * @param definer {@code non-null;} class being defined
+ * @param offset offset in {@code bytes} to the start of the list
+ * @param attributeFactory {@code non-null;} attribute factory to use
*/
public FieldListParser(DirectClassFile cf, CstType definer, int offset,
AttributeFactory attributeFactory) {
@@ -48,7 +48,7 @@
/**
* Gets the parsed list.
*
- * @return non-null; the parsed list
+ * @return {@code non-null;} the parsed list
*/
public StdFieldList getList() {
parseIfNecessary();
diff --git a/dx/src/com/android/dx/cf/direct/MemberListParser.java b/dx/src/com/android/dx/cf/direct/MemberListParser.java
index 3c0bfa8..a0023c6 100644
--- a/dx/src/com/android/dx/cf/direct/MemberListParser.java
+++ b/dx/src/com/android/dx/cf/direct/MemberListParser.java
@@ -32,32 +32,32 @@
* Parser for lists of class file members (that is, fields and methods).
*/
abstract /*package*/ class MemberListParser {
- /** non-null; the class file to parse from */
+ /** {@code non-null;} the class file to parse from */
private final DirectClassFile cf;
- /** non-null; class being defined */
+ /** {@code non-null;} class being defined */
private final CstType definer;
/** offset in the byte array of the classfile to the start of the list */
private final int offset;
- /** non-null; attribute factory to use */
+ /** {@code non-null;} attribute factory to use */
private final AttributeFactory attributeFactory;
- /** >= -1; the end offset of this list in the byte array of the
- * classfile, or <code>-1</code> if not yet parsed */
+ /** {@code >= -1;} the end offset of this list in the byte array of the
+ * classfile, or {@code -1} if not yet parsed */
private int endOffset;
- /** null-ok; parse observer, if any */
+ /** {@code null-ok;} parse observer, if any */
private ParseObserver observer;
/**
* Constructs an instance.
*
- * @param cf non-null; the class file to parse from
- * @param definer non-null; class being defined
- * @param offset offset in <code>bytes</code> to the start of the list
- * @param attributeFactory non-null; attribute factory to use
+ * @param cf {@code non-null;} the class file to parse from
+ * @param definer {@code non-null;} class being defined
+ * @param offset offset in {@code bytes} to the start of the list
+ * @param attributeFactory {@code non-null;} attribute factory to use
*/
public MemberListParser(DirectClassFile cf, CstType definer,
int offset, AttributeFactory attributeFactory) {
@@ -81,10 +81,10 @@
}
/**
- * Gets the end offset of this constant pool in the <code>byte[]</code>
+ * Gets the end offset of this constant pool in the {@code byte[]}
* which it came from.
*
- * @return >= 0; the end offset
+ * @return {@code >= 0;} the end offset
*/
public int getEndOffset() {
parseIfNecessary();
@@ -94,7 +94,7 @@
/**
* Sets the parse observer for this instance.
*
- * @param observer null-ok; the observer
+ * @param observer {@code null-ok;} the observer
*/
public final void setObserver(ParseObserver observer) {
this.observer = observer;
@@ -122,7 +122,7 @@
/**
* Gets the class file being defined.
*
- * @return non-null; the class
+ * @return {@code non-null;} the class
*/
protected final CstType getDefiner() {
return definer;
@@ -132,7 +132,7 @@
* Gets the human-oriented name for what this instance is parsing.
* Subclasses must override this method.
*
- * @return non-null; the human oriented name
+ * @return {@code non-null;} the human oriented name
*/
protected abstract String humanName();
@@ -141,15 +141,15 @@
* Subclasses must override this method.
*
* @param accessFlags the flags
- * @return non-null; the string form
+ * @return {@code non-null;} the string form
*/
protected abstract String humanAccessFlags(int accessFlags);
/**
- * Gets the <code>CTX_*</code> constant to use when parsing attributes.
+ * Gets the {@code CTX_*} constant to use when parsing attributes.
* Subclasses must override this method.
*
- * @return non-null; the human oriented name
+ * @return {@code non-null;} the human oriented name
*/
protected abstract int getAttributeContext();
@@ -157,11 +157,11 @@
* Sets an element in the list. Subclasses must override this method.
*
* @param n which element
- * @param accessFlags the <code>access_flags</code>
+ * @param accessFlags the {@code access_flags}
* @param nat the interpreted name and type (based on the two
- * <code>*_index</code> fields)
+ * {@code *_index} fields)
* @param attributes list of parsed attributes
- * @return non-null; the constructed member
+ * @return {@code non-null;} the constructed member
*/
protected abstract Member set(int n, int accessFlags, CstNat nat,
AttributeList attributes);
diff --git a/dx/src/com/android/dx/cf/direct/MethodListParser.java b/dx/src/com/android/dx/cf/direct/MethodListParser.java
index 9ca8ba6..6ab1aba 100644
--- a/dx/src/com/android/dx/cf/direct/MethodListParser.java
+++ b/dx/src/com/android/dx/cf/direct/MethodListParser.java
@@ -28,16 +28,16 @@
* Parser for lists of methods in a class file.
*/
final /*package*/ class MethodListParser extends MemberListParser {
- /** non-null; list in progress */
+ /** {@code non-null;} list in progress */
final private StdMethodList methods;
/**
* Constructs an instance.
*
- * @param cf non-null; the class file to parse from
- * @param definer non-null; class being defined
- * @param offset offset in <code>bytes</code> to the start of the list
- * @param attributeFactory non-null; attribute factory to use
+ * @param cf {@code non-null;} the class file to parse from
+ * @param definer {@code non-null;} class being defined
+ * @param offset offset in {@code bytes} to the start of the list
+ * @param attributeFactory {@code non-null;} attribute factory to use
*/
public MethodListParser(DirectClassFile cf, CstType definer,
int offset, AttributeFactory attributeFactory) {
@@ -48,7 +48,7 @@
/**
* Gets the parsed list.
*
- * @return non-null; the parsed list
+ * @return {@code non-null;} the parsed list
*/
public StdMethodList getList() {
parseIfNecessary();
diff --git a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
index ab0e2f7..da12a4e 100644
--- a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
+++ b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
@@ -65,7 +65,7 @@
*/
public class StdAttributeFactory
extends AttributeFactory {
- /** non-null; shared instance of this class */
+ /** {@code non-null;} shared instance of this class */
public static final StdAttributeFactory THE_ONE =
new StdAttributeFactory();
@@ -191,7 +191,7 @@
}
/**
- * Parses an <code>AnnotationDefault</code> attribute.
+ * Parses an {@code AnnotationDefault} attribute.
*/
private Attribute annotationDefault(DirectClassFile cf,
int offset, int length, ParseObserver observer) {
@@ -207,7 +207,7 @@
}
/**
- * Parses a <code>Code</code> attribute.
+ * Parses a {@code Code} attribute.
*/
private Attribute code(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -311,7 +311,7 @@
}
/**
- * Parses a <code>ConstantValue</code> attribute.
+ * Parses a {@code ConstantValue} attribute.
*/
private Attribute constantValue(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -333,7 +333,7 @@
}
/**
- * Parses a <code>Deprecated</code> attribute.
+ * Parses a {@code Deprecated} attribute.
*/
private Attribute deprecated(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -345,7 +345,7 @@
}
/**
- * Parses an <code>EnclosingMethod</code> attribute.
+ * Parses an {@code EnclosingMethod} attribute.
*/
private Attribute enclosingMethod(DirectClassFile cf, int offset,
int length, ParseObserver observer) {
@@ -374,7 +374,7 @@
}
/**
- * Parses an <code>Exceptions</code> attribute.
+ * Parses an {@code Exceptions} attribute.
*/
private Attribute exceptions(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -402,7 +402,7 @@
}
/**
- * Parses an <code>InnerClasses</code> attribute.
+ * Parses an {@code InnerClasses} attribute.
*/
private Attribute innerClasses(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -459,7 +459,7 @@
}
/**
- * Parses a <code>LineNumberTable</code> attribute.
+ * Parses a {@code LineNumberTable} attribute.
*/
private Attribute lineNumberTable(DirectClassFile cf, int offset,
int length, ParseObserver observer) {
@@ -500,7 +500,7 @@
}
/**
- * Parses a <code>LocalVariableTable</code> attribute.
+ * Parses a {@code LocalVariableTable} attribute.
*/
private Attribute localVariableTable(DirectClassFile cf, int offset,
int length, ParseObserver observer) {
@@ -523,7 +523,7 @@
}
/**
- * Parses a <code>LocalVariableTypeTable</code> attribute.
+ * Parses a {@code LocalVariableTypeTable} attribute.
*/
private Attribute localVariableTypeTable(DirectClassFile cf, int offset,
int length, ParseObserver observer) {
@@ -546,15 +546,15 @@
}
/**
- * Parse the table part of either a <code>LocalVariableTable</code>
- * or a <code>LocalVariableTypeTable</code>.
+ * Parse the table part of either a {@code LocalVariableTable}
+ * or a {@code LocalVariableTypeTable}.
*
- * @param bytes non-null; bytes to parse, which should <i>only</i>
+ * @param bytes {@code non-null;} bytes to parse, which should <i>only</i>
* contain the table data (no header)
- * @param pool non-null; constant pool to use
- * @param count >= 0; the number of entries
- * @param typeTable <code>true</code> iff this is for a type table
- * @return non-null; the constructed list
+ * @param pool {@code non-null;} constant pool to use
+ * @param count {@code >= 0;} the number of entries
+ * @param typeTable {@code true} iff this is for a type table
+ * @return {@code non-null;} the constructed list
*/
private LocalVariableList parseLocalVariables(ByteArray bytes,
ConstantPool pool, ParseObserver observer, int count,
@@ -604,7 +604,7 @@
}
/**
- * Parses a <code>RuntimeInvisibleAnnotations</code> attribute.
+ * Parses a {@code RuntimeInvisibleAnnotations} attribute.
*/
private Attribute runtimeInvisibleAnnotations(DirectClassFile cf,
int offset, int length, ParseObserver observer) {
@@ -621,7 +621,7 @@
}
/**
- * Parses a <code>RuntimeVisibleAnnotations</code> attribute.
+ * Parses a {@code RuntimeVisibleAnnotations} attribute.
*/
private Attribute runtimeVisibleAnnotations(DirectClassFile cf,
int offset, int length, ParseObserver observer) {
@@ -638,7 +638,7 @@
}
/**
- * Parses a <code>RuntimeInvisibleParameterAnnotations</code> attribute.
+ * Parses a {@code RuntimeInvisibleParameterAnnotations} attribute.
*/
private Attribute runtimeInvisibleParameterAnnotations(DirectClassFile cf,
int offset, int length, ParseObserver observer) {
@@ -655,7 +655,7 @@
}
/**
- * Parses a <code>RuntimeVisibleParameterAnnotations</code> attribute.
+ * Parses a {@code RuntimeVisibleParameterAnnotations} attribute.
*/
private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf,
int offset, int length, ParseObserver observer) {
@@ -672,7 +672,7 @@
}
/**
- * Parses a <code>Signature</code> attribute.
+ * Parses a {@code Signature} attribute.
*/
private Attribute signature(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -694,7 +694,7 @@
}
/**
- * Parses a <code>SourceFile</code> attribute.
+ * Parses a {@code SourceFile} attribute.
*/
private Attribute sourceFile(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
@@ -716,7 +716,7 @@
}
/**
- * Parses a <code>Synthetic</code> attribute.
+ * Parses a {@code Synthetic} attribute.
*/
private Attribute synthetic(DirectClassFile cf, int offset, int length,
ParseObserver observer) {
diff --git a/dx/src/com/android/dx/cf/iface/Attribute.java b/dx/src/com/android/dx/cf/iface/Attribute.java
index f28f51e..b075251 100644
--- a/dx/src/com/android/dx/cf/iface/Attribute.java
+++ b/dx/src/com/android/dx/cf/iface/Attribute.java
@@ -23,16 +23,16 @@
/**
* Get the name of the attribute.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public String getName();
/**
* Get the total length of the attribute in bytes, including the
* header. Since the header is always six bytes, the result of
- * this method is always at least <code>6</code>.
+ * this method is always at least {@code 6}.
*
- * @return >= 6; the total length, in bytes
+ * @return {@code >= 6;} the total length, in bytes
*/
public int byteLength();
}
diff --git a/dx/src/com/android/dx/cf/iface/AttributeList.java b/dx/src/com/android/dx/cf/iface/AttributeList.java
index a72965a..f7a1d27 100644
--- a/dx/src/com/android/dx/cf/iface/AttributeList.java
+++ b/dx/src/com/android/dx/cf/iface/AttributeList.java
@@ -22,11 +22,11 @@
public interface AttributeList {
/**
* Get whether this instance is mutable. Note that the
- * <code>AttributeList</code> interface itself doesn't provide any means
+ * {@code AttributeList} interface itself doesn't provide any means
* of mutation, but that doesn't mean that there isn't a non-interface
* way of mutating an instance.
*
- * @return <code>true</code> iff this instance is somehow mutable
+ * @return {@code true} iff this instance is somehow mutable
*/
public boolean isMutable();
@@ -38,28 +38,28 @@
public int size();
/**
- * Get the <code>n</code>th attribute.
+ * Get the {@code n}th attribute.
*
- * @param n <code>n >= 0, n < size()</code>; which attribute
- * @return non-null; the attribute in question
+ * @param n {@code n >= 0, n < size();} which attribute
+ * @return {@code non-null;} the attribute in question
*/
public Attribute get(int n);
/**
* Get the total length of this list in bytes, when part of a
* class file. The returned value includes the two bytes for the
- * <code>attributes_count</code> length indicator.
+ * {@code attributes_count} length indicator.
*
- * @return >= 2; the total length, in bytes
+ * @return {@code >= 2;} the total length, in bytes
*/
public int byteLength();
/**
* Get the first attribute in the list with the given name, if any.
*
- * @param name non-null; attribute name
- * @return null-ok; first attribute in the list with the given name,
- * or <code>null</code> if there is none
+ * @param name {@code non-null;} attribute name
+ * @return {@code null-ok;} first attribute in the list with the given name,
+ * or {@code null} if there is none
*/
public Attribute findFirst(String name);
@@ -67,9 +67,9 @@
* Get the next attribute in the list after the given one, with the same
* name, if any.
*
- * @param attrib non-null; attribute to start looking after
- * @return null-ok; next attribute after <code>attrib</code> with the
- * same name as <code>attrib</code>
+ * @param attrib {@code non-null;} attribute to start looking after
+ * @return {@code null-ok;} next attribute after {@code attrib} with the
+ * same name as {@code attrib}
*/
public Attribute findNext(Attribute attrib);
}
diff --git a/dx/src/com/android/dx/cf/iface/ClassFile.java b/dx/src/com/android/dx/cf/iface/ClassFile.java
index 36a5f74..e37fec0 100644
--- a/dx/src/com/android/dx/cf/iface/ClassFile.java
+++ b/dx/src/com/android/dx/cf/iface/ClassFile.java
@@ -26,98 +26,98 @@
* facsimiles thereof.
*
* <p><b>Note:</b> The fields referred to in this documentation are of the
- * <code>ClassFile</code> structure defined in vmspec-2 sec4.1.
+ * {@code ClassFile} structure defined in vmspec-2 sec4.1.
*/
public interface ClassFile {
/**
- * Gets the field <code>magic</code>.
+ * Gets the field {@code magic}.
*
* @return the value in question
*/
public int getMagic();
/**
- * Gets the field <code>minor_version</code>.
+ * Gets the field {@code minor_version}.
*
* @return the value in question
*/
public int getMinorVersion();
/**
- * Gets the field <code>major_version</code>.
+ * Gets the field {@code major_version}.
*
* @return the value in question
*/
public int getMajorVersion();
/**
- * Gets the field <code>access_flags</code>.
+ * Gets the field {@code access_flags}.
*
* @return the value in question
*/
public int getAccessFlags();
/**
- * Gets the field <code>this_class</code>, interpreted as a type constant.
+ * Gets the field {@code this_class}, interpreted as a type constant.
*
- * @return non-null; the value in question
+ * @return {@code non-null;} the value in question
*/
public CstType getThisClass();
/**
- * Gets the field <code>super_class</code>, interpreted as a type constant
+ * Gets the field {@code super_class}, interpreted as a type constant
* if non-zero.
*
- * @return null-ok; the value in question
+ * @return {@code null-ok;} the value in question
*/
public CstType getSuperclass();
/**
- * Gets the field <code>constant_pool</code> (along with
- * <code>constant_pool_count</code>).
+ * Gets the field {@code constant_pool} (along with
+ * {@code constant_pool_count}).
*
- * @return non-null; the constant pool
+ * @return {@code non-null;} the constant pool
*/
public ConstantPool getConstantPool();
/**
- * Gets the field <code>interfaces<code> (along with
- * interfaces_count</code>).
+ * Gets the field {@code interfaces} (along with
+ * {@code interfaces_count}).
*
- * @return non-null; the list of interfaces
+ * @return {@code non-null;} the list of interfaces
*/
public TypeList getInterfaces();
/**
- * Gets the field <code>fields</code> (along with
- * <code>fields_count</code>).
+ * Gets the field {@code fields} (along with
+ * {@code fields_count}).
*
- * @return non-null; the list of fields
+ * @return {@code non-null;} the list of fields
*/
public FieldList getFields();
/**
- * Gets the field <code>methods</code> (along with
- * <code>methods_count</code>).
+ * Gets the field {@code methods} (along with
+ * {@code methods_count}).
*
- * @return non-null; the list of fields
+ * @return {@code non-null;} the list of fields
*/
public MethodList getMethods();
/**
- * Gets the field <code>attributes</code> (along with
- * <code>attributes_count</code>).
+ * Gets the field {@code attributes} (along with
+ * {@code attributes_count}).
*
- * @return non-null; the list of attributes
+ * @return {@code non-null;} the list of attributes
*/
public AttributeList getAttributes();
/**
- * Gets the name out of the <code>SourceFile</code> attribute of this
+ * Gets the name out of the {@code SourceFile} attribute of this
* file, if any. This is a convenient shorthand for scrounging around
* the class's attributes.
*
- * @return non-null; the constant pool
+ * @return {@code non-null;} the constant pool
*/
public CstUtf8 getSourceFile();
}
diff --git a/dx/src/com/android/dx/cf/iface/Field.java b/dx/src/com/android/dx/cf/iface/Field.java
index d1694fc..e3002bc 100644
--- a/dx/src/com/android/dx/cf/iface/Field.java
+++ b/dx/src/com/android/dx/cf/iface/Field.java
@@ -25,10 +25,10 @@
extends Member {
/**
* Get the constant value for this field, if any. This only returns
- * non-<code>null</code> for a <code>static final</code> field which
- * includes a <code>ConstantValue</code> attribute.
+ * non-{@code null} for a {@code static final} field which
+ * includes a {@code ConstantValue} attribute.
*
- * @return null-ok; the constant value, or <code>null</code> if this
+ * @return {@code null-ok;} the constant value, or {@code null} if this
* field isn't a constant
*/
public TypedConstant getConstantValue();
diff --git a/dx/src/com/android/dx/cf/iface/FieldList.java b/dx/src/com/android/dx/cf/iface/FieldList.java
index 80a794f..9cd27a3 100644
--- a/dx/src/com/android/dx/cf/iface/FieldList.java
+++ b/dx/src/com/android/dx/cf/iface/FieldList.java
@@ -23,11 +23,11 @@
{
/**
* Get whether this instance is mutable. Note that the
- * <code>FieldList</code> interface itself doesn't provide any means
+ * {@code FieldList} interface itself doesn't provide any means
* of mutation, but that doesn't mean that there isn't a non-interface
* way of mutating an instance.
*
- * @return <code>true</code> iff this instance is somehow mutable
+ * @return {@code true} iff this instance is somehow mutable
*/
public boolean isMutable();
@@ -39,10 +39,10 @@
public int size();
/**
- * Get the <code>n</code>th field.
+ * Get the {@code n}th field.
*
- * @param n <code>n >= 0, n < size()</code>; which field
- * @return non-null; the field in question
+ * @param n {@code n >= 0, n < size();} which field
+ * @return {@code non-null;} the field in question
*/
public Field get(int n);
}
diff --git a/dx/src/com/android/dx/cf/iface/Member.java b/dx/src/com/android/dx/cf/iface/Member.java
index b305e09..0453a6f 100644
--- a/dx/src/com/android/dx/cf/iface/Member.java
+++ b/dx/src/com/android/dx/cf/iface/Member.java
@@ -27,48 +27,48 @@
/**
* Get the defining class.
*
- * @return non-null; the defining class
+ * @return {@code non-null;} the defining class
*/
public CstType getDefiningClass();
/**
- * Get the field <code>access_flags</code>.
+ * Get the field {@code access_flags}.
*
* @return the access flags
*/
public int getAccessFlags();
/**
- * Get the field <code>name_index</code> of the member. This is
- * just a convenient shorthand for <code>getNat().getName()</code>.
+ * Get the field {@code name_index} of the member. This is
+ * just a convenient shorthand for {@code getNat().getName()}.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public CstUtf8 getName();
/**
- * Get the field <code>descriptor_index</code> of the member. This is
- * just a convenient shorthand for <code>getNat().getDescriptor()</code>.
+ * Get the field {@code descriptor_index} of the member. This is
+ * just a convenient shorthand for {@code getNat().getDescriptor()}.
*
- * @return non-null; the descriptor
+ * @return {@code non-null;} the descriptor
*/
public CstUtf8 getDescriptor();
/**
* Get the name and type associated with this member. This is a
- * combination of the fields <code>name_index</code> and
- * <code>descriptor_index</code> in the original classfile, interpreted
+ * combination of the fields {@code name_index} and
+ * {@code descriptor_index} in the original classfile, interpreted
* via the constant pool.
*
- * @return non-null; the name and type
+ * @return {@code non-null;} the name and type
*/
public CstNat getNat();
/**
- * Get the field <code>attributes</code> (along with
- * <code>attributes_count</code>).
+ * Get the field {@code attributes} (along with
+ * {@code attributes_count}).
*
- * @return non-null; the constant pool
+ * @return {@code non-null;} the constant pool
*/
public AttributeList getAttributes();
}
diff --git a/dx/src/com/android/dx/cf/iface/Method.java b/dx/src/com/android/dx/cf/iface/Method.java
index 424400a..18b9af6 100644
--- a/dx/src/com/android/dx/cf/iface/Method.java
+++ b/dx/src/com/android/dx/cf/iface/Method.java
@@ -26,9 +26,9 @@
{
/**
* Get the <i>effective</i> method descriptor, which includes, if
- * necessary, a first <code>this</code> parameter.
+ * necessary, a first {@code this} parameter.
*
- * @return non-null; the effective method descriptor
+ * @return {@code non-null;} the effective method descriptor
*/
public Prototype getEffectiveDescriptor();
}
diff --git a/dx/src/com/android/dx/cf/iface/MethodList.java b/dx/src/com/android/dx/cf/iface/MethodList.java
index a7a395c..dfa6528 100644
--- a/dx/src/com/android/dx/cf/iface/MethodList.java
+++ b/dx/src/com/android/dx/cf/iface/MethodList.java
@@ -22,11 +22,11 @@
public interface MethodList {
/**
* Get whether this instance is mutable. Note that the
- * <code>MethodList</code> interface itself doesn't provide any means
+ * {@code MethodList} interface itself doesn't provide any means
* of mutation, but that doesn't mean that there isn't a non-interface
* way of mutating an instance.
*
- * @return <code>true</code> iff this instance is somehow mutable
+ * @return {@code true} iff this instance is somehow mutable
*/
public boolean isMutable();
@@ -38,10 +38,10 @@
public int size();
/**
- * Get the <code>n</code>th method.
+ * Get the {@code n}th method.
*
- * @param n <code>n >= 0, n < size()</code>; which method
- * @return non-null; the method in question
+ * @param n {@code n >= 0, n < size();} which method
+ * @return {@code non-null;} the method in question
*/
public Method get(int n);
}
diff --git a/dx/src/com/android/dx/cf/iface/ParseObserver.java b/dx/src/com/android/dx/cf/iface/ParseObserver.java
index 2ad3493..98d5a75 100644
--- a/dx/src/com/android/dx/cf/iface/ParseObserver.java
+++ b/dx/src/com/android/dx/cf/iface/ParseObserver.java
@@ -34,11 +34,11 @@
/**
* Indicate that a particular member is now being parsed.
*
- * @param bytes non-null; the source that is being parsed
- * @param offset offset into <code>bytes</code> for the start of the
+ * @param bytes {@code non-null;} the source that is being parsed
+ * @param offset offset into {@code bytes} for the start of the
* member
- * @param name non-null; name of the member
- * @param descriptor non-null; descriptor of the member
+ * @param name {@code non-null;} name of the member
+ * @param descriptor {@code non-null;} descriptor of the member
*/
public void startParsingMember(ByteArray bytes, int offset, String name,
String descriptor);
@@ -46,12 +46,12 @@
/**
* Indicate that a particular member is no longer being parsed.
*
- * @param bytes non-null; the source that was parsed
- * @param offset offset into <code>bytes</code> for the end of the
+ * @param bytes {@code non-null;} the source that was parsed
+ * @param offset offset into {@code bytes} for the end of the
* member
- * @param name non-null; name of the member
- * @param descriptor non-null; descriptor of the member
- * @param member non-null; the actual member that was parsed
+ * @param name {@code non-null;} name of the member
+ * @param descriptor {@code non-null;} descriptor of the member
+ * @param member {@code non-null;} the actual member that was parsed
*/
public void endParsingMember(ByteArray bytes, int offset, String name,
String descriptor, Member member);
@@ -59,10 +59,10 @@
/**
* Indicate that some parsing happened.
*
- * @param bytes non-null; the source that was parsed
- * @param offset offset into <code>bytes</code> for what was parsed
+ * @param bytes {@code non-null;} the source that was parsed
+ * @param offset offset into {@code bytes} for what was parsed
* @param len number of bytes parsed
- * @param human non-null; human form for what was parsed
+ * @param human {@code non-null;} human form for what was parsed
*/
public void parsed(ByteArray bytes, int offset, int len, String human);
}
diff --git a/dx/src/com/android/dx/cf/iface/StdAttributeList.java b/dx/src/com/android/dx/cf/iface/StdAttributeList.java
index c29bb08..dd5dfd7 100644
--- a/dx/src/com/android/dx/cf/iface/StdAttributeList.java
+++ b/dx/src/com/android/dx/cf/iface/StdAttributeList.java
@@ -25,7 +25,7 @@
public final class StdAttributeList extends FixedSizeList
implements AttributeList {
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -95,8 +95,8 @@
/**
* Sets the attribute at the given index.
*
- * @param n >= 0, < size(); which attribute
- * @param attribute null-ok; the attribute object
+ * @param n {@code >= 0, < size();} which attribute
+ * @param attribute {@code null-ok;} the attribute object
*/
public void set(int n, Attribute attribute) {
set0(n, attribute);
diff --git a/dx/src/com/android/dx/cf/iface/StdField.java b/dx/src/com/android/dx/cf/iface/StdField.java
index 3551aee..c3a4da6 100644
--- a/dx/src/com/android/dx/cf/iface/StdField.java
+++ b/dx/src/com/android/dx/cf/iface/StdField.java
@@ -29,10 +29,10 @@
/**
* Constructs an instance.
*
- * @param definingClass non-null; the defining class
+ * @param definingClass {@code non-null;} the defining class
* @param accessFlags access flags
- * @param nat non-null; member name and type (descriptor)
- * @param attributes non-null; list of associated attributes
+ * @param nat {@code non-null;} member name and type (descriptor)
+ * @param attributes {@code non-null;} list of associated attributes
*/
public StdField(CstType definingClass, int accessFlags, CstNat nat,
AttributeList attributes) {
diff --git a/dx/src/com/android/dx/cf/iface/StdFieldList.java b/dx/src/com/android/dx/cf/iface/StdFieldList.java
index 0f8654b..044d6b7 100644
--- a/dx/src/com/android/dx/cf/iface/StdFieldList.java
+++ b/dx/src/com/android/dx/cf/iface/StdFieldList.java
@@ -24,7 +24,7 @@
*/
public final class StdFieldList extends FixedSizeList implements FieldList {
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -40,8 +40,8 @@
/**
* Sets the field at the given index.
*
- * @param n >= 0, < size(); which field
- * @param field null-ok; the field object
+ * @param n {@code >= 0, < size();} which field
+ * @param field {@code null-ok;} the field object
*/
public void set(int n, Field field) {
set0(n, field);
diff --git a/dx/src/com/android/dx/cf/iface/StdMember.java b/dx/src/com/android/dx/cf/iface/StdMember.java
index eaf949e..dfe45c3 100644
--- a/dx/src/com/android/dx/cf/iface/StdMember.java
+++ b/dx/src/com/android/dx/cf/iface/StdMember.java
@@ -25,25 +25,25 @@
* all the associated data.
*/
public abstract class StdMember implements Member {
- /** non-null; the defining class */
+ /** {@code non-null;} the defining class */
private final CstType definingClass;
/** access flags */
private final int accessFlags;
- /** non-null; member name and type */
+ /** {@code non-null;} member name and type */
private final CstNat nat;
- /** non-null; list of associated attributes */
+ /** {@code non-null;} list of associated attributes */
private final AttributeList attributes;
/**
* Constructs an instance.
*
- * @param definingClass non-null; the defining class
+ * @param definingClass {@code non-null;} the defining class
* @param accessFlags access flags
- * @param nat non-null; member name and type (descriptor)
- * @param attributes non-null; list of associated attributes
+ * @param nat {@code non-null;} member name and type (descriptor)
+ * @param attributes {@code non-null;} list of associated attributes
*/
public StdMember(CstType definingClass, int accessFlags, CstNat nat,
AttributeList attributes) {
diff --git a/dx/src/com/android/dx/cf/iface/StdMethod.java b/dx/src/com/android/dx/cf/iface/StdMethod.java
index a4acbaa..15fd6e1 100644
--- a/dx/src/com/android/dx/cf/iface/StdMethod.java
+++ b/dx/src/com/android/dx/cf/iface/StdMethod.java
@@ -26,16 +26,16 @@
* all the associated data.
*/
public final class StdMethod extends StdMember implements Method {
- /** non-null; the effective method descriptor */
+ /** {@code non-null;} the effective method descriptor */
private final Prototype effectiveDescriptor;
/**
* Constructs an instance.
*
- * @param definingClass non-null; the defining class
+ * @param definingClass {@code non-null;} the defining class
* @param accessFlags access flags
- * @param nat non-null; member name and type (descriptor)
- * @param attributes non-null; list of associated attributes
+ * @param nat {@code non-null;} member name and type (descriptor)
+ * @param attributes {@code non-null;} list of associated attributes
*/
public StdMethod(CstType definingClass, int accessFlags, CstNat nat,
AttributeList attributes) {
diff --git a/dx/src/com/android/dx/cf/iface/StdMethodList.java b/dx/src/com/android/dx/cf/iface/StdMethodList.java
index ef0ff31..521021e 100644
--- a/dx/src/com/android/dx/cf/iface/StdMethodList.java
+++ b/dx/src/com/android/dx/cf/iface/StdMethodList.java
@@ -24,7 +24,7 @@
*/
public final class StdMethodList extends FixedSizeList implements MethodList {
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -40,8 +40,8 @@
/**
* Sets the method at the given index.
*
- * @param n >= 0, < size(); which method
- * @param method null-ok; the method object
+ * @param n {@code >= 0, < size();} which method
+ * @param method {@code null-ok;} the method object
*/
public void set(int n, Method method) {
set0(n, method);
diff --git a/dx/src/com/android/dx/command/DxConsole.java b/dx/src/com/android/dx/command/DxConsole.java
index 982e659..9ce9836 100644
--- a/dx/src/com/android/dx/command/DxConsole.java
+++ b/dx/src/com/android/dx/command/DxConsole.java
@@ -20,18 +20,18 @@
/**
* Provides standard and error PrintStream object to output information.<br>
- * By default the PrintStream objects link to <code>System.out</code> and
- * <code>System.err</code> but they can be changed to link to other
+ * By default the PrintStream objects link to {@code System.out} and
+ * {@code System.err} but they can be changed to link to other
* PrintStream.
*/
public class DxConsole {
/**
- * Standard output stream. Links to <code>System.out</code> by default.
+ * Standard output stream. Links to {@code System.out} by default.
*/
public static PrintStream out = System.out;
/**
- * Error output stream. Links to <code>System.err</code> by default.
+ * Error output stream. Links to {@code System.err} by default.
*/
public static PrintStream err = System.err;
}
diff --git a/dx/src/com/android/dx/command/Main.java b/dx/src/com/android/dx/command/Main.java
index 17f5db3..281a83e 100644
--- a/dx/src/com/android/dx/command/Main.java
+++ b/dx/src/com/android/dx/command/Main.java
@@ -43,10 +43,12 @@
" options: none, important, lines.\n" +
" dx --annotool --annotation=<class> [--element=<element types>]\n" +
" [--print=<print types>]\n" +
- " dx --dump [--debug] [--strict] [--bytes] [--basic-blocks | " +
- "--rop-blocks]\n" +
+ " dx --dump [--debug] [--strict] [--bytes] [--optimize]\n" +
+ " [--basic-blocks | --rop-blocks | --ssa-blocks | --dot] " +
+ "[--ssa-step=<step>]\n" +
" [--width=<n>] [<file>.class | <file>.txt] ...\n" +
- " Dump classfiles in a human-oriented format.\n" +
+ " Dump classfiles, or transformations thereof, in a " +
+ "human-oriented format.\n" +
" dx --junit [-wait] <TestClass>\n" +
" Run the indicated unit test.\n" +
" dx -J<option> ... <arguments, in one of the above " +
@@ -156,9 +158,9 @@
* Returns a copy of the given args array, but without the indicated
* element.
*
- * @param orig non-null; original array
+ * @param orig {@code non-null;} original array
* @param n which element to omit
- * @return non-null; new array
+ * @return {@code non-null;} new array
*/
private static String[] without(String[] orig, int n) {
int len = orig.length - 1;
diff --git a/dx/src/com/android/dx/command/annotool/AnnotationLister.java b/dx/src/com/android/dx/command/annotool/AnnotationLister.java
index 78f5d64..0bd101e 100644
--- a/dx/src/com/android/dx/command/annotool/AnnotationLister.java
+++ b/dx/src/com/android/dx/command/annotool/AnnotationLister.java
@@ -34,7 +34,7 @@
/**
* Greps annotations on a set of class files and prints matching elements
* to stdout. What counts as a match and what should be printed is controlled
- * by the <code>Main.Arguments</code> instance.
+ * by the {@code Main.Arguments} instance.
*/
class AnnotationLister {
@@ -137,8 +137,8 @@
/**
* Inspects a class annotation.
*
- * @param cf non-null; class file
- * @param ann non-null; annotation
+ * @param cf {@code non-null;} class file
+ * @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,
BaseAnnotations ann) {
@@ -159,8 +159,8 @@
/**
* Inspects a package annotation
*
- * @param cf non-null; class file of "package-info" pseudo-class
- * @param ann non-null; annotation
+ * @param cf {@code non-null;} class file of "package-info" pseudo-class
+ * @param ann {@code non-null;} annotation
*/
private void visitPackageAnnotation(
DirectClassFile cf, BaseAnnotations ann) {
@@ -195,7 +195,7 @@
* Prints, or schedules for printing, elements related to a
* matching package.
*
- * @param packageName non-null; name of package
+ * @param packageName {@code non-null;} name of package
*/
private void printMatchPackage(String packageName) {
for(Main.PrintType pt: args.printTypes) {
@@ -216,7 +216,7 @@
* Prints, or schedules for printing, elements related to a matching
* class.
*
- * @param cf non-null; matching class
+ * @param cf {@code non-null;} matching class
*/
private void printMatch(DirectClassFile cf) {
for(Main.PrintType pt: args.printTypes) {
@@ -244,7 +244,7 @@
* Checks to see if a specified class name should be considered a match
* due to previous matches.
*
- * @param s non-null; class name
+ * @param s {@code non-null;} class name
* @return true if this class should be considered a match
*/
private boolean isMatchingInnerClass(String s) {
@@ -264,7 +264,7 @@
* Checks to see if a specified package should be considered a match due
* to previous matches.
*
- * @param s non-null; package name
+ * @param s {@code non-null;} package name
* @return true if this package should be considered a match
*/
private boolean isMatchingPackage(String s) {
diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java
index 19f67b4..43fa183 100644
--- a/dx/src/com/android/dx/command/dexer/Main.java
+++ b/dx/src/com/android/dx/command/dexer/Main.java
@@ -55,26 +55,26 @@
*/
public class Main {
/**
- * non-null; name for the <code>.dex</code> file that goes into
- * <code>.jar</code> files
+ * {@code non-null;} name for the {@code .dex} file that goes into
+ * {@code .jar} files
*/
private static final String DEX_IN_JAR_NAME = "classes.dex";
/**
- * non-null; name of the standard manifest file in <code>.jar</code>
+ * {@code non-null;} name of the standard manifest file in {@code .jar}
* files
*/
private static final String MANIFEST_NAME = "META-INF/MANIFEST.MF";
/**
- * non-null; attribute name for the (quasi-standard?)
- * <code>Created-By</code> attribute
+ * {@code non-null;} attribute name for the (quasi-standard?)
+ * {@code Created-By} attribute
*/
private static final Attributes.Name CREATED_BY =
new Attributes.Name("Created-By");
/**
- * non-null; list of <code>javax</code> subpackages that are considered
+ * {@code non-null;} list of {@code javax} subpackages that are considered
* to be "core". <b>Note:</b>: This list must be sorted, since it
* is binary-searched.
*/
@@ -90,15 +90,15 @@
/** number of errors during processing */
private static int errors = 0;
- /** non-null; parsed command-line arguments */
+ /** {@code non-null;} parsed command-line arguments */
private static Arguments args;
- /** non-null; output file in-progress */
+ /** {@code non-null;} output file in-progress */
private static DexFile outputDex;
/**
- * null-ok; map of resources to include in the output, or
- * <code>null</code> if resources are being ignored
+ * {@code null-ok;} map of resources to include in the output, or
+ * {@code null} if resources are being ignored
*/
private static TreeMap<String, byte[]> outputResources;
@@ -215,7 +215,7 @@
/**
* Processes one pathname element.
*
- * @param pathname non-null; the pathname to process. May be the path of
+ * @param pathname {@code non-null;} the pathname to process. May be the path of
* a class file, a jar file, or a directory containing class files.
* @return whether any processing actually happened
*/
@@ -248,8 +248,8 @@
/**
* Processes one file, which may be either a class or a resource.
*
- * @param name non-null; name of the file
- * @param bytes non-null; contents of the file
+ * @param name {@code non-null;} name of the file
+ * @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processFileBytes(String name, byte[] bytes) {
@@ -283,9 +283,9 @@
/**
* Processes one classfile.
*
- * @param name non-null; name of the file, clipped such that it
+ * @param name {@code non-null;} name of the file, clipped such that it
* <i>should</i> correspond to the name of the class it contains
- * @param bytes non-null; contents of the file
+ * @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processClass(String name, byte[] bytes) {
@@ -316,7 +316,7 @@
* class. If there is a problem, this updates the error count and
* throws an exception to stop processing.
*
- * @param name non-null; the fully-qualified internal-form class name
+ * @param name {@code non-null;} the fully-qualified internal-form class name
*/
private static void checkClassName(String name) {
boolean bogus = false;
@@ -346,35 +346,60 @@
DxConsole.err.println("\ntrouble processing \"" + name + "\":");
DxConsole.err.println("\n" +
- "Attempt to include a core VM class in something other " +
- "than a core library.\n" +
- "It is likely that you have attempted to include the " +
- "core library from a desktop\n" +
- "virtual machine into an application, which will most " +
- "assuredly not work. If\n" +
- "you really intend to build a core library -- which is "+
- "only appropriate as\n" +
- "part of creating a full virtual machine binary, as " +
- "opposed to compiling an\n" +
- "application -- then use the \"--core-library\" option " +
- "to suppress this error\n" +
- "message. If you go ahead and use \"--core-library\" " +
- "but are in fact building\n" +
- "an application, then please be aware that your build " +
- "will still fail at some\n" +
- "point; you will simply be denied the pleasure of " +
- "reading this helpful error\n" +
- "message.");
+ "Attempt to include a core class (java.* or javax.*) in " +
+ "something other\n" +
+ "than a core library. It is likely that you have " +
+ "attempted to include\n" +
+ "in an application the core library (or a part thereof) " +
+ "from a desktop\n" +
+ "virtual machine. This will most assuredly not work. " +
+ "At a minimum, it\n" +
+ "jeopardizes the compatibility of your app with future " +
+ "versions of the\n" +
+ "platform. It is also often of questionable legality.\n" +
+ "\n" +
+ "If you really intend to build a core library -- which is " +
+ "only\n" +
+ "appropriate as part of creating a full virtual machine " +
+ "distribution,\n" +
+ "as opposed to compiling an application -- then use the\n" +
+ "\"--core-library\" option to suppress this error message.\n" +
+ "\n" +
+ "If you go ahead and use \"--core-library\" but are in " +
+ "fact building an\n" +
+ "application, then be forewarned that your application " +
+ "will still fail\n" +
+ "to build or run, at some point. Please be prepared for " +
+ "angry customers\n" +
+ "who find, for example, that your application ceases to " +
+ "function once\n" +
+ "they upgrade their operating system. You will be to " +
+ "blame for this\n" +
+ "problem.\n" +
+ "\n" +
+ "If you are legitimately using some code that happens to " +
+ "be in a core\n" +
+ "package, then the easiest safe alternative you have is " +
+ "to repackage\n" +
+ "that code. That is, move the classes in question into " +
+ "your own package\n" +
+ "namespace. This means that they will never be in " +
+ "conflict with core\n" +
+ "system classes. If you find that you cannot do this, " +
+ "then that is an\n" +
+ "indication that the path you are on will ultimately lead " +
+ "to pain,\n" +
+ "suffering, grief, and lamentation.\n");
errors++;
throw new StopProcessing();
}
/**
- * Converts {@link #outputDex} into a <code>byte[]</code>, write
+ * Converts {@link #outputDex} into a {@code byte[]}, write
* it out to the proper file (if any), and also do whatever human-oriented
* dumping is required.
*
- * @return null-ok; the converted <code>byte[]</code> or <code>null</code>
+ * @return {@code null-ok;} the converted {@code byte[]} or {@code null}
* if there was a problem
*/
private static byte[] writeDex() {
@@ -438,8 +463,8 @@
/**
* Creates a jar file from the resources and given dex file array.
*
- * @param fileName non-null; name of the file
- * @param dexArray non-null; array containing the dex file to include
+ * @param fileName {@code non-null;} name of the file
+ * @param dexArray {@code non-null;} array containing the dex file to include
* @return whether the creation was successful
*/
private static boolean createJar(String fileName, byte[] dexArray) {
@@ -496,7 +521,7 @@
* Creates and returns the manifest to use for the output. This may
* modify {@link #outputResources} (removing the pre-existing manifest).
*
- * @return non-null; the manifest
+ * @return {@code non-null;} the manifest
*/
private static Manifest makeManifest() throws IOException {
byte[] manifestBytes = outputResources.get(MANIFEST_NAME);
@@ -531,8 +556,8 @@
/**
* Opens and returns the named file for writing, treating "-" specially.
*
- * @param name non-null; the file name
- * @return non-null; the opened file
+ * @param name {@code non-null;} the file name
+ * @return {@code non-null;} the opened file
*/
private static OutputStream openOutput(String name) throws IOException {
if (name.equals("-") ||
@@ -547,9 +572,9 @@
* Flushes and closes the given output stream, except if it happens to be
* {@link System#out} in which case this method does the flush but not
* the close. This method will also silently do nothing if given a
- * <code>null</code> argument.
+ * {@code null} argument.
*
- * @param stream null-ok; what to close
+ * @param stream {@code null-ok;} what to close
*/
private static void closeOutput(OutputStream stream) throws IOException {
if (stream == null) {
@@ -565,18 +590,18 @@
/**
* Returns the "fixed" version of a given file path, suitable for
- * use as a path within a <code>.jar</code> file and for checking
+ * use as a path within a {@code .jar} file and for checking
* against a classfile-internal "this class" name. This looks for
- * the last instance of the substring <code>"/./"</code> within
+ * the last instance of the substring {@code "/./"} within
* the path, and if it finds it, it takes the portion after to be
* the fixed path. If that isn't found but the path starts with
- * <code>"./"</code>, then that prefix is removed and the rest is
+ * {@code "./"}, then that prefix is removed and the rest is
* return. If neither of these is the case, this method returns
* its argument.
*
- * @param path non-null; the path to "fix"
- * @return non-null; the fixed version (which might be the same as
- * the given <code>path</code>)
+ * @param path {@code non-null;} the path to "fix"
+ * @return {@code non-null;} the fixed version (which might be the same as
+ * the given {@code path})
*/
private static String fixPath(String path) {
/*
@@ -603,9 +628,9 @@
/**
* Dumps any method with the given name in the given file.
*
- * @param dex non-null; the dex file
- * @param fqName non-null; the fully-qualified name of the method(s)
- * @param out non-null; where to dump to
+ * @param dex {@code non-null;} the dex file
+ * @param fqName {@code non-null;} the fully-qualified name of the method(s)
+ * @param out {@code non-null;} where to dump to
*/
private static void dumpMethod(DexFile dex, String fqName,
OutputStreamWriter out) {
@@ -719,36 +744,36 @@
/** whether we are constructing a core library */
public boolean coreLibrary = false;
- /** null-ok; particular method to dump */
+ /** {@code null-ok;} particular method to dump */
public String methodToDump = null;
/** max width for columnar output */
public int dumpWidth = 0;
- /** null-ok; output file name for binary file */
+ /** {@code null-ok;} output file name for binary file */
public String outName = null;
- /** null-ok; output file name for human-oriented dump */
+ /** {@code null-ok;} output file name for human-oriented dump */
public String humanOutName = null;
/** whether strict file-name-vs-class-name checking should be done */
public boolean strictNameCheck = true;
/**
- * whether it is okay for there to be no <code>.class</code> files
+ * whether it is okay for there to be no {@code .class} files
* to process
*/
public boolean emptyOk = false;
/**
- * whether the binary output is to be a <code>.jar</code> file
- * instead of a plain <code>.dex</code>
+ * whether the binary output is to be a {@code .jar} file
+ * instead of a plain {@code .dex}
*/
public boolean jarOutput = false;
/**
- * when writing a <code>.jar</code> file, whether to still
- * keep the <code>.class</code> files
+ * when writing a {@code .jar} file, whether to still
+ * keep the {@code .class} files
*/
public boolean keepClassesInJar = false;
@@ -758,7 +783,7 @@
/** whether to keep local variable information */
public boolean localInfo = true;
- /** non-null after {@link #parse}; file name arguments */
+ /** {@code non-null after {@link #parse};} file name arguments */
public String[] fileNames;
/** whether to do SSA/register optimization */
@@ -779,7 +804,7 @@
/**
* Parses the given command-line arguments.
*
- * @param args non-null; the arguments
+ * @param args {@code non-null;} the arguments
*/
public void parse(String[] args) {
int at = 0;
diff --git a/dx/src/com/android/dx/command/dump/BaseDumper.java b/dx/src/com/android/dx/command/dump/BaseDumper.java
index f4a8dee..d2c1e13 100644
--- a/dx/src/com/android/dx/command/dump/BaseDumper.java
+++ b/dx/src/com/android/dx/command/dump/BaseDumper.java
@@ -34,21 +34,21 @@
*/
public abstract class BaseDumper
implements ParseObserver {
- /** non-null; array of data being dumped */
+ /** {@code non-null;} array of data being dumped */
private final byte[] bytes;
/** whether or not to include the raw bytes (in a column on the left) */
private final boolean rawBytes;
- /** non-null; where to dump to */
+ /** {@code non-null;} where to dump to */
private final PrintStream out;
/** width of the output in columns */
private final int width;
/**
- * non-null; the file path for the class, excluding any base directory
- * specification
+ * {@code non-null;} the file path for the class, excluding any base
+ * directory specification
*/
private final String filePath;
@@ -61,7 +61,7 @@
/** the current level of indentation */
private int indent;
- /** non-null; the current column separator string */
+ /** {@code non-null;} the current column separator string */
private String separator;
/** the offset of the next byte to dump */
@@ -73,10 +73,9 @@
/**
* Constructs an instance.
*
- * @param bytes non-null; bytes of the (alleged) class file
+ * @param bytes {@code non-null;} bytes of the (alleged) class file
* on the left)
- * @param out non-null; where to dump to
- * passed in as <= 0
+ * @param out {@code non-null;} where to dump to
* @param filePath the file path for the class, excluding any base
* directory specification
*/
@@ -109,7 +108,8 @@
* @return width in register-units
*/
static int computeParamWidth(ConcreteMethod meth, boolean isStatic) {
- return meth.getEffectiveDescriptor().getParameterTypes().getWordCount();
+ return meth.getEffectiveDescriptor().getParameterTypes().
+ getWordCount();
}
/** {@inheritDoc} */
@@ -158,7 +158,7 @@
* Gets the current dump cursor (that is, the offset of the expected
* next byte to dump).
*
- * @return >= 0; the dump cursor
+ * @return {@code >= 0;} the dump cursor
*/
protected final int getAt() {
return at;
@@ -167,17 +167,17 @@
/**
* Sets the dump cursor to the indicated offset in the given array.
*
- * @param arr non-null; array in question
- * @param offset >= 0; offset into the array
+ * @param arr {@code non-null;} array in question
+ * @param offset {@code >= 0;} offset into the array
*/
protected final void setAt(ByteArray arr, int offset) {
at = arr.underlyingOffset(offset, bytes);
}
/**
- * Gets the array of <code>byte</code>s to process.
+ * Gets the array of {@code byte}s to process.
*
- * @return non-null; the bytes
+ * @return {@code non-null;} the bytes
*/
protected final byte[] getBytes() {
return bytes;
@@ -186,7 +186,7 @@
/**
* Gets the filesystem/jar path of the file being dumped.
*
- * @return non-null; the path
+ * @return {@code non-null;} the path
*/
protected final String getFilePath() {
return filePath;
@@ -204,7 +204,7 @@
/**
* Prints the given string to this instance's output stream.
*
- * @param s null-ok; string to print
+ * @param s {@code null-ok;} string to print
*/
protected final void print(String s) {
out.print(s);
@@ -214,7 +214,7 @@
* Prints the given string to this instance's output stream, followed
* by a newline.
*
- * @param s null-ok; string to print
+ * @param s {@code null-ok;} string to print
*/
protected final void println(String s) {
out.println(s);
@@ -230,10 +230,10 @@
}
/**
- * Gets the width of the first column of output. This is <code>0</code>
+ * Gets the width of the first column of output. This is {@code 0}
* unless raw bytes are being included in the output.
*
- * @return >= 0; the width of the first column
+ * @return {@code >= 0;} the width of the first column
*/
protected final int getWidth1() {
if (rawBytes) {
@@ -246,7 +246,7 @@
/**
* Gets the width of the second column of output.
*
- * @return >= 0; the width of the second column
+ * @return {@code >= 0;} the width of the second column
*/
protected final int getWidth2() {
int w1 = rawBytes ? (getWidth1() + 1) : 0;
@@ -258,7 +258,7 @@
*
* @param offset offset to start dumping at
* @param len length to dump
- * @return non-null; the dump
+ * @return {@code non-null;} the dump
*/
protected final String hexDump(int offset, int len) {
return Hex.dump(bytes, offset, len, offset, hexCols, 4);
@@ -268,9 +268,9 @@
* Combines a pair of strings as two columns, or if this is one-column
* output, format the otherwise-second column.
*
- * @param s1 non-null; the first column's string
- * @param s2 non-null; the second column's string
- * @return non-null; the combined output
+ * @param s1 {@code non-null;} the first column's string
+ * @param s2 {@code non-null;} the second column's string
+ * @return {@code non-null;} the combined output
*/
protected final String twoColumns(String s1, String s2) {
int w1 = getWidth1();
diff --git a/dx/src/com/android/dx/command/dump/BlockDumper.java b/dx/src/com/android/dx/command/dump/BlockDumper.java
index 0be2fb4..a4b3993 100644
--- a/dx/src/com/android/dx/command/dump/BlockDumper.java
+++ b/dx/src/com/android/dx/command/dump/BlockDumper.java
@@ -54,12 +54,12 @@
private boolean rop;
/**
- * null-ok; the class file object being constructed; becomes non-null
- * during {@link #dump}
+ * {@code null-ok;} the class file object being constructed;
+ * becomes non-null during {@link #dump}
*/
protected DirectClassFile classFile;
- /** null-ok; most recently parsed code attribute */
+ /** {@code null-ok;} most recently parsed code attribute */
private AttCode codeAtt;
/** whether or not to suppress dumping */
@@ -75,9 +75,8 @@
* Dumps the given array, interpreting it as a class file and dumping
* methods with indications of block-level stuff.
*
- * @param bytes non-null; bytes of the (alleged) class file
- * @param out non-null; where to dump to
- * passed in as <= 0
+ * @param bytes {@code non-null;} bytes of the (alleged) class file
+ * @param out {@code non-null;} where to dump to
* @param filePath the file path for the class, excluding any base
* directory specification
* @param rop whether or not to registerize (make rop blocks)
@@ -208,7 +207,7 @@
/**
* Does a regular basic block dump.
*
- * @param meth non-null; method data to dump
+ * @param meth {@code non-null;} method data to dump
*/
private void regularDump(ConcreteMethod meth) {
BytecodeArray code = meth.getCode();
@@ -283,7 +282,7 @@
/**
* Does a registerizing dump.
*
- * @param meth non-null; method data to dump
+ * @param meth {@code non-null;} method data to dump
*/
private void ropDump(ConcreteMethod meth) {
BytecodeArray code = meth.getCode();
diff --git a/dx/src/com/android/dx/command/dump/ClassDumper.java b/dx/src/com/android/dx/command/dump/ClassDumper.java
index 10dacf3..e98b6d6 100644
--- a/dx/src/com/android/dx/command/dump/ClassDumper.java
+++ b/dx/src/com/android/dx/command/dump/ClassDumper.java
@@ -30,8 +30,8 @@
/**
* Dumps the given array, interpreting it as a class file.
*
- * @param bytes non-null; bytes of the (alleged) class file
- * @param out non-null; where to dump to
+ * @param bytes {@code non-null;} bytes of the (alleged) class file
+ * @param out {@code non-null;} where to dump to
* passed in as <= 0
* @param filePath the file path for the class, excluding any base
* directory specification
diff --git a/dx/src/com/android/dx/command/dump/DotDumper.java b/dx/src/com/android/dx/command/dump/DotDumper.java
index 87c5298..9de48fc 100644
--- a/dx/src/com/android/dx/command/dump/DotDumper.java
+++ b/dx/src/com/android/dx/command/dump/DotDumper.java
@@ -39,16 +39,15 @@
* with the popular graph utility "dot".
*/
public class DotDumper implements ParseObserver {
+ private DirectClassFile classFile;
- DirectClassFile classFile;
+ private final byte[] bytes;
+ private final String filePath;
+ private final boolean strictParse;
+ private final boolean optimize;
+ private final Args args;
- byte[] bytes;
- String filePath;
- boolean strictParse;
- boolean optimize;
- Args args;
-
- static void dump (byte[] bytes, String filePath, Args args) {
+ static void dump(byte[] bytes, String filePath, Args args) {
new DotDumper(bytes, filePath, args).run();
}
@@ -60,7 +59,6 @@
this.args = args;
}
-
private void run() {
ByteArray ba = new ByteArray(bytes);
@@ -89,17 +87,17 @@
}
public void changeIndent(int indentDelta) {
-
+ // This space intentionally left blank.
}
public void parsed(ByteArray bytes, int offset, int len, String human) {
-
+ // This space intentionally left blank.
}
/** {@inheritDoc} */
public void startParsingMember(ByteArray bytes, int offset, String name,
String descriptor) {
-
+ // This space intentionally left blank.
}
public void endParsingMember(ByteArray bytes, int offset, String name,
@@ -165,6 +163,5 @@
}
System.out.println("}");
-
}
}
diff --git a/dx/src/com/android/dx/command/dump/Main.java b/dx/src/com/android/dx/command/dump/Main.java
index 1ea26bc..d6ba374 100644
--- a/dx/src/com/android/dx/command/dump/Main.java
+++ b/dx/src/com/android/dx/command/dump/Main.java
@@ -110,8 +110,8 @@
/**
* Processes one file.
*
- * @param name non-null; name of the file
- * @param bytes non-null; contents of the file
+ * @param name {@code non-null;} name of the file
+ * @param bytes {@code non-null;} contents of the file
*/
private static void processOne(String name, byte[] bytes) {
if (parsedArgs.dotDump) {
diff --git a/dx/src/com/android/dx/command/dump/SsaDumper.java b/dx/src/com/android/dx/command/dump/SsaDumper.java
index 95442a1..e3dad46 100644
--- a/dx/src/com/android/dx/command/dump/SsaDumper.java
+++ b/dx/src/com/android/dx/command/dump/SsaDumper.java
@@ -40,29 +40,48 @@
import com.android.dx.util.IntList;
import java.io.PrintStream;
+import java.util.ArrayList;
import java.util.BitSet;
+import java.util.Collections;
import java.util.EnumSet;
+/**
+ * Dumper for the SSA-translated blocks of a method.
+ */
public class SsaDumper extends BlockDumper {
-
+ /**
+ * Does the dump.
+ *
+ * @param bytes {@code non-null;} bytes of the original class file
+ * @param out {@code non-null;} where to dump to
+ * @param filePath the file path for the class, excluding any base
+ * directory specification
+ * @param args commandline parsedArgs
+ */
public static void dump(byte[] bytes, PrintStream out,
String filePath, Args args) {
-
- SsaDumper sd =
- new SsaDumper(bytes, out, filePath, args);
+ SsaDumper sd = new SsaDumper(bytes, out, filePath, args);
sd.dump();
}
- SsaDumper(byte[] bytes, PrintStream out, String filePath, Args args) {
-
+ /**
+ * Constructs an instance.
+ *
+ * @param bytes {@code non-null;} bytes of the original class file
+ * @param out {@code non-null;} where to dump to
+ * @param filePath the file path for the class, excluding any base
+ * directory specification
+ * @param args commandline parsedArgs
+ */
+ private SsaDumper(byte[] bytes, PrintStream out, String filePath,
+ Args args) {
super(bytes, out, filePath, true, args);
-
}
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
- String descriptor, Member member) {
+ String descriptor, Member member) {
if (!(member instanceof Method)) {
return;
}
@@ -71,17 +90,14 @@
return;
}
- ConcreteMethod meth = new ConcreteMethod((Method) member, classFile,
- true, true);
-
+ ConcreteMethod meth =
+ new ConcreteMethod((Method) member, classFile, true, true);
TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
-
RopMethod rmeth = Ropper.convert(meth, advice);
-
SsaMethod ssaMeth = null;
-
boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags());
int paramWidth = computeParamWidth(meth, isStatic);
+
if (args.ssaStep == null) {
ssaMeth = Optimizer.debugNoRegisterAllocation(rmeth,
paramWidth, isStatic, true, advice,
@@ -106,21 +122,26 @@
sb.append(Hex.u2(
ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex())));
sb.append('\n');
+
+ ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks();
+ ArrayList<SsaBasicBlock> sortedBlocks =
+ (ArrayList<SsaBasicBlock>) blocks.clone();
+ Collections.sort(sortedBlocks, SsaBasicBlock.LABEL_COMPARATOR);
- for (SsaBasicBlock block : ssaMeth.getBlocks()) {
+ for (SsaBasicBlock block : sortedBlocks) {
sb.append("block ")
.append(Hex.u2(block.getRopLabel())).append('\n');
BitSet preds = block.getPredecessors();
for(int i=preds.nextSetBit(0); i>=0; i=preds.nextSetBit(i+1)) {
- sb.append (" pred ");
- sb.append (Hex.u2(ssaMeth.blockIndexToRopLabel(i)));
+ sb.append(" pred ");
+ sb.append(Hex.u2(ssaMeth.blockIndexToRopLabel(i)));
sb.append('\n');
}
- sb.append (" live in:" + block.getLiveInRegs());
- sb.append ("\n");
+ sb.append(" live in:" + block.getLiveInRegs());
+ sb.append("\n");
for (SsaInsn insn: block.getInsns()) {
sb.append(" ");
@@ -129,7 +150,7 @@
}
if (block.getSuccessors().cardinality() == 0) {
- sb.append (" returns\n");
+ sb.append(" returns\n");
} else {
int primary = block.getPrimarySuccessorRopLabel();
@@ -138,18 +159,18 @@
int szSuccLabels = succLabelList.size();
for (int i = 0; i < szSuccLabels; i++) {
- sb.append (" next ");
- sb.append (Hex.u2(succLabelList.get(i)));
+ sb.append(" next ");
+ sb.append(Hex.u2(succLabelList.get(i)));
if (szSuccLabels != 1 && primary == succLabelList.get(i)) {
- sb.append (" *");
+ sb.append(" *");
}
sb.append('\n');
}
}
- sb.append (" live out:" + block.getLiveOutRegs());
- sb.append ("\n");
+ sb.append(" live out:" + block.getLiveOutRegs());
+ sb.append("\n");
}
suppressDump = false;
diff --git a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
index dab15c9..cdd29d7 100644
--- a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
+++ b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
@@ -51,7 +51,7 @@
/**
* Utility methods that translate various classfile attributes
- * into forms suitable for use in creating <code>dex</code> files.
+ * into forms suitable for use in creating {@code dex} files.
*/
/*package*/ class AttributeTranslator {
/**
@@ -64,8 +64,8 @@
/**
* Gets the list of thrown exceptions for a given method.
*
- * @param method non-null; the method in question
- * @return non-null; the list of thrown exceptions
+ * @param method {@code non-null;} the method in question
+ * @return {@code non-null;} the list of thrown exceptions
*/
public static TypeList getExceptions(Method method) {
AttributeList attribs = method.getAttributes();
@@ -83,10 +83,10 @@
* Gets the annotations out of a given {@link AttributeList}. This
* combines both visible and invisible annotations into a single
* result set and also adds in a system annotation for the
- * <code>Signature</code> attribute if present.
+ * {@code Signature} attribute if present.
*
- * @param attribs non-null; the attributes list to search in
- * @return non-null; the set of annotations, which may be empty
+ * @param attribs {@code non-null;} the attributes list to search in
+ * @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getAnnotations(AttributeList attribs) {
Annotations result = getAnnotations0(attribs);
@@ -102,15 +102,15 @@
/**
* Gets the annotations out of a given class, similar to {@link
* #getAnnotations}, also including annotations for translations
- * of class-level attributes <code>EnclosingMethod</code> and
- * <code>InnerClasses</code>, if present. Additionally, if the
+ * of class-level attributes {@code EnclosingMethod} and
+ * {@code InnerClasses}, if present. Additionally, if the
* class is an annotation class, then this also includes a
- * representation of all the <code>AnnotationDefault</code>
+ * representation of all the {@code AnnotationDefault}
* values.
*
- * @param cf non-null; the class in question
- * @param args non-null; the high-level options
- * @return non-null; the set of annotations, which may be empty
+ * @param cf {@code non-null;} the class in question
+ * @param args {@code non-null;} the high-level options
+ * @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getClassAnnotations(DirectClassFile cf,
CfOptions args) {
@@ -148,10 +148,10 @@
/**
* Gets the annotations out of a given method, similar to {@link
* #getAnnotations}, also including an annotation for the translation
- * of the method-specific attribute <code>Exceptions</code>.
+ * of the method-specific attribute {@code Exceptions}.
*
- * @param method non-null; the method in question
- * @return non-null; the set of annotations, which may be empty
+ * @param method {@code non-null;} the method in question
+ * @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getMethodAnnotations(Method method) {
Annotations result = getAnnotations(method.getAttributes());
@@ -170,8 +170,8 @@
* Helper method for {@link #getAnnotations} which just gets the
* existing annotations, per se.
*
- * @param attribs non-null; the attributes list to search in
- * @return non-null; the set of annotations, which may be empty
+ * @param attribs {@code non-null;} the attributes list to search in
+ * @return {@code non-null;} the set of annotations, which may be empty
*/
private static Annotations getAnnotations0(AttributeList attribs) {
AttRuntimeVisibleAnnotations visible =
@@ -199,11 +199,11 @@
}
/**
- * Gets the <code>Signature</code> attribute out of a given
+ * Gets the {@code Signature} attribute out of a given
* {@link AttributeList}, if any, translating it to an annotation.
*
- * @param attribs non-null; the attributes list to search in
- * @return null-ok; the converted <code>Signature</code> annotation,
+ * @param attribs {@code non-null;} the attributes list to search in
+ * @return {@code null-ok;} the converted {@code Signature} annotation,
* if there was an attribute to translate
*/
private static Annotation getSignature(AttributeList attribs) {
@@ -218,15 +218,15 @@
}
/**
- * Gets the <code>EnclosingMethod</code> attribute out of a given
+ * Gets the {@code EnclosingMethod} attribute out of a given
* {@link AttributeList}, if any, translating it to an annotation.
* If the class really has an enclosing method, this returns an
- * <code>EnclosingMethod</code> annotation; if not, this returns
- * an <code>EnclosingClass</code> annotation.
+ * {@code EnclosingMethod} annotation; if not, this returns
+ * an {@code EnclosingClass} annotation.
*
- * @param attribs non-null; the attributes list to search in
- * @return null-ok; the converted <code>EnclosingMethod</code> or
- * <code>EnclosingClass</code> annotation, if there was an
+ * @param attribs {@code non-null;} the attributes list to search in
+ * @return {@code null-ok;} the converted {@code EnclosingMethod} or
+ * {@code EnclosingClass} annotation, if there was an
* attribute to translate
*/
private static Annotation translateEnclosingMethod(AttributeList attribs) {
@@ -256,16 +256,16 @@
}
/**
- * Gets the <code>InnerClasses</code> attribute out of a given
+ * Gets the {@code InnerClasses} attribute out of a given
* {@link AttributeList}, if any, translating it to one or more of an
- * <code>InnerClass</code>, <code>EnclosingClass</code>, or
- * <code>MemberClasses</code> annotation.
+ * {@code InnerClass}, {@code EnclosingClass}, or
+ * {@code MemberClasses} annotation.
*
- * @param thisClass non-null; type representing the class being processed
- * @param attribs non-null; the attributes list to search in
+ * @param thisClass {@code non-null;} type representing the class being processed
+ * @param attribs {@code non-null;} the attributes list to search in
* @param needEnclosingClass whether to include an
- * <code>EnclosingClass</code> annotation
- * @return null-ok; the converted list of annotations, if there
+ * {@code EnclosingClass} annotation
+ * @return {@code null-ok;} the converted list of annotations, if there
* was an attribute to translate
*/
private static Annotations translateInnerClasses(CstType thisClass,
@@ -342,8 +342,8 @@
* combines both visible and invisible annotations into a single
* result set.
*
- * @param method non-null; the method in question
- * @return non-null; the list of annotation sets, which may be empty
+ * @param method {@code non-null;} the method in question
+ * @return {@code non-null;} the list of annotation sets, which may be empty
*/
public static AnnotationsList getParameterAnnotations(Method method) {
AttributeList attribs = method.getAttributes();
@@ -374,14 +374,14 @@
}
/**
- * Gets the <code>AnnotationDefault</code> attributes out of a
+ * Gets the {@code AnnotationDefault} attributes out of a
* given class, if any, reforming them as an
- * <code>AnnotationDefault</code> annotation.
+ * {@code AnnotationDefault} annotation.
*
- * @param cf non-null; the class in question
- * @return null-ok; an appropriately-constructed
- * <code>AnnotationDefault</code> annotation, if there were any
- * annotation defaults in the class, or <code>null<code> if not
+ * @param cf {@code non-null;} the class in question
+ * @return {@code null-ok;} an appropriately-constructed
+ * {@code AnnotationDefault} annotation, if there were any
+ * annotation defaults in the class, or {@code null} if not
*/
private static Annotation translateAnnotationDefaults(DirectClassFile cf) {
CstType thisClass = cf.getThisClass();
diff --git a/dx/src/com/android/dx/dex/cf/CfTranslator.java b/dx/src/com/android/dx/dex/cf/CfTranslator.java
index c48be53..8210e90 100644
--- a/dx/src/com/android/dx/dex/cf/CfTranslator.java
+++ b/dx/src/com/android/dx/dex/cf/CfTranslator.java
@@ -55,11 +55,11 @@
import com.android.dx.util.ExceptionWithContext;
/**
- * Static method that turns <code>byte[]</code>s containing Java
+ * Static method that turns {@code byte[]}s containing Java
* classfiles into {@link ClassDefItem} instances.
*/
public class CfTranslator {
- /** set to <code>true</code> to enable development-time debugging code */
+ /** set to {@code true} to enable development-time debugging code */
private static final boolean DEBUG = false;
/**
@@ -70,14 +70,14 @@
}
/**
- * Takes a <code>byte[]</code>, interprets it as a Java classfile, and
+ * Takes a {@code byte[]}, interprets it as a Java classfile, and
* translates it into a {@link ClassDefItem}.
*
- * @param filePath non-null; the file path for the class,
+ * @param filePath {@code non-null;} the file path for the class,
* excluding any base directory specification
- * @param bytes non-null; contents of the file
+ * @param bytes {@code non-null;} contents of the file
* @param args command-line arguments
- * @return non-null; the translated class
+ * @return {@code non-null;} the translated class
*/
public static ClassDefItem translate(String filePath, byte[] bytes,
CfOptions args) {
@@ -94,11 +94,11 @@
* from {@link #translate} just to keep things a bit simpler in
* terms of exception handling.
*
- * @param filePath non-null; the file path for the class,
+ * @param filePath {@code non-null;} the file path for the class,
* excluding any base directory specification
- * @param bytes non-null; contents of the file
+ * @param bytes {@code non-null;} contents of the file
* @param args command-line arguments
- * @return non-null; the translated class
+ * @return {@code non-null;} the translated class
*/
private static ClassDefItem translate0(String filePath, byte[] bytes,
CfOptions args) {
@@ -136,8 +136,8 @@
/**
* Processes the fields of the given class.
*
- * @param cf non-null; class being translated
- * @param out non-null; output class
+ * @param cf {@code non-null;} class being translated
+ * @param out {@code non-null;} output class
*/
private static void processFields(DirectClassFile cf, ClassDefItem out) {
CstType thisClass = cf.getThisClass();
@@ -179,8 +179,8 @@
* Helper for {@link #processFields}, which translates constants into
* more specific types if necessary.
*
- * @param constant non-null; the constant in question
- * @param type non-null; the desired type
+ * @param constant {@code non-null;} the constant in question
+ * @param type {@code non-null;} the desired type
*/
private static TypedConstant coerceConstant(TypedConstant constant,
Type type) {
@@ -213,9 +213,9 @@
/**
* Processes the methods of the given class.
*
- * @param cf non-null; class being translated
- * @param args non-null; command-line args
- * @param out non-null; output class
+ * @param cf {@code non-null;} class being translated
+ * @param args {@code non-null;} command-line args
+ * @param out {@code non-null;} output class
*/
private static void processMethods(DirectClassFile cf,
CfOptions args, ClassDefItem out) {
diff --git a/dx/src/com/android/dx/dex/cf/CodeStatistics.java b/dx/src/com/android/dx/dex/cf/CodeStatistics.java
index fa83100..b692d77 100644
--- a/dx/src/com/android/dx/dex/cf/CodeStatistics.java
+++ b/dx/src/com/android/dx/dex/cf/CodeStatistics.java
@@ -26,7 +26,7 @@
* code.
*/
public final class CodeStatistics {
- /** set to <code>true</code> to enable development-time debugging code */
+ /** set to {@code true} to enable development-time debugging code */
private static final boolean DEBUG = false;
/**
@@ -76,7 +76,7 @@
/**
* Updates the number of original bytecode bytes processed.
*
- * @param count >= 0; the number of bytes to add
+ * @param count {@code >= 0;} the number of bytes to add
*/
public static void updateOriginalByteCount(int count) {
runningOriginalBytes += count;
@@ -146,7 +146,7 @@
/**
* Prints out the collected statistics.
*
- * @param out non-null; where to output to
+ * @param out {@code non-null;} where to output to
*/
public static void dumpStatistics(PrintStream out) {
out.printf("Optimizer Delta Rop Insns: %d total: %d "
diff --git a/dx/src/com/android/dx/dex/cf/OptimizerOptions.java b/dx/src/com/android/dx/dex/cf/OptimizerOptions.java
index 1dc3f76..0108a7f 100644
--- a/dx/src/com/android/dx/dex/cf/OptimizerOptions.java
+++ b/dx/src/com/android/dx/dex/cf/OptimizerOptions.java
@@ -31,13 +31,13 @@
*/
public class OptimizerOptions {
/**
- * null-ok; hash set of class name + method names that should be optimized.
+ * {@code null-ok;} hash set of class name + method names that should be optimized.
* null if this constraint was not specified on the command line
*/
private static HashSet<String> optimizeList;
/**
- * null-ok; hash set of class name + method names that should NOT
+ * {@code null-ok;} hash set of class name + method names that should NOT
* be optimized. null if this constraint was not specified on the
* command line
*/
@@ -118,12 +118,12 @@
* Compares the output of the optimizer run normally with a run skipping
* some optional steps. Results are printed to stderr.
*
- * @param nonOptRmeth non-null; origional rop method
- * @param paramSize >= 0 parameter size of method
+ * @param nonOptRmeth {@code non-null;} origional rop method
+ * @param paramSize {@code >= 0;} parameter size of method
* @param isStatic true if this method has no 'this' pointer argument.
- * @param args non-null; translator arguments
- * @param advice non-null; translation advice
- * @param rmeth non-null; method with all optimization steps run.
+ * @param args {@code non-null;} translator arguments
+ * @param advice {@code non-null;} translation advice
+ * @param rmeth {@code non-null;} method with all optimization steps run.
*/
public static void compareOptimizerStep(RopMethod nonOptRmeth,
int paramSize, boolean isStatic, CfOptions args,
diff --git a/dx/src/com/android/dx/dex/code/ArrayData.java b/dx/src/com/android/dx/dex/code/ArrayData.java
index 8476a03..30baa5a 100644
--- a/dx/src/com/android/dx/dex/code/ArrayData.java
+++ b/dx/src/com/android/dx/dex/code/ArrayData.java
@@ -29,12 +29,12 @@
*/
public final class ArrayData extends VariableSizeInsn {
/**
- * non-null; address representing the instruction that uses this
+ * {@code non-null;} address representing the instruction that uses this
* instance
*/
private final CodeAddress user;
- /** non-null; initial values to be filled into an array */
+ /** {@code non-null;} initial values to be filled into an array */
private final ArrayList<Constant> values;
/** non-null: type of constant that initializes the array */
@@ -48,12 +48,12 @@
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param user non-null; address representing the instruction that
+ * @param position {@code non-null;} source position
+ * @param user {@code non-null;} address representing the instruction that
* uses this instance
- * @param values non-null; initial values to be filled into an array
+ * @param values {@code non-null;} initial values to be filled into an array
*/
public ArrayData(SourcePosition position, CodeAddress user,
ArrayList<Constant> values,
diff --git a/dx/src/com/android/dx/dex/code/BlockAddresses.java b/dx/src/com/android/dx/dex/code/BlockAddresses.java
index 9fea66c..e55f893 100644
--- a/dx/src/com/android/dx/dex/code/BlockAddresses.java
+++ b/dx/src/com/android/dx/dex/code/BlockAddresses.java
@@ -28,15 +28,15 @@
* start address, end address, and last instruction address.
*/
public final class BlockAddresses {
- /** non-null; array containing addresses for the start of each basic
+ /** {@code non-null;} array containing addresses for the start of each basic
* block (indexed by basic block label) */
private final CodeAddress[] starts;
- /** non-null; array containing addresses for the final instruction
+ /** {@code non-null;} array containing addresses for the final instruction
* of each basic block (indexed by basic block label) */
private final CodeAddress[] lasts;
- /** non-null; array containing addresses for the end (just past the
+ /** {@code non-null;} array containing addresses for the end (just past the
* final instruction) of each basic block (indexed by basic block
* label) */
private final CodeAddress[] ends;
@@ -44,7 +44,7 @@
/**
* Constructs an instance.
*
- * @param method non-null; the method to have block addresses for
+ * @param method {@code non-null;} the method to have block addresses for
*/
public BlockAddresses(RopMethod method) {
BasicBlockList blocks = method.getBlocks();
@@ -60,8 +60,8 @@
/**
* Gets the instance for the start of the given block.
*
- * @param block non-null; the block in question
- * @return non-null; the appropriate instance
+ * @param block {@code non-null;} the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getStart(BasicBlock block) {
return starts[block.getLabel()];
@@ -70,8 +70,8 @@
/**
* Gets the instance for the start of the block with the given label.
*
- * @param label non-null; the label of the block in question
- * @return non-null; the appropriate instance
+ * @param label {@code non-null;} the label of the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getStart(int label) {
return starts[label];
@@ -80,8 +80,8 @@
/**
* Gets the instance for the final instruction of the given block.
*
- * @param block non-null; the block in question
- * @return non-null; the appropriate instance
+ * @param block {@code non-null;} the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getLast(BasicBlock block) {
return lasts[block.getLabel()];
@@ -91,8 +91,8 @@
* Gets the instance for the final instruction of the block with
* the given label.
*
- * @param label non-null; the label of the block in question
- * @return non-null; the appropriate instance
+ * @param label {@code non-null;} the label of the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getLast(int label) {
return lasts[label];
@@ -102,8 +102,8 @@
* Gets the instance for the end (address after the final instruction)
* of the given block.
*
- * @param block non-null; the block in question
- * @return non-null; the appropriate instance
+ * @param block {@code non-null;} the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getEnd(BasicBlock block) {
return ends[block.getLabel()];
@@ -113,8 +113,8 @@
* Gets the instance for the end (address after the final instruction)
* of the block with the given label.
*
- * @param label non-null; the label of the block in question
- * @return non-null; the appropriate instance
+ * @param label {@code non-null;} the label of the block in question
+ * @return {@code non-null;} the appropriate instance
*/
public CodeAddress getEnd(int label) {
return ends[label];
diff --git a/dx/src/com/android/dx/dex/code/CatchBuilder.java b/dx/src/com/android/dx/dex/code/CatchBuilder.java
index 8bc963b..d2ec3d7 100644
--- a/dx/src/com/android/dx/dex/code/CatchBuilder.java
+++ b/dx/src/com/android/dx/dex/code/CatchBuilder.java
@@ -27,7 +27,7 @@
/**
* Builds and returns the catch table for this instance.
*
- * @return non-null; the constructed table
+ * @return {@code non-null;} the constructed table
*/
public CatchTable build();
@@ -42,7 +42,7 @@
/**
* Gets the set of catch types associated with this instance.
*
- * @return non-null; the set of catch types
+ * @return {@code non-null;} the set of catch types
*/
public HashSet<Type> getCatchTypes();
}
diff --git a/dx/src/com/android/dx/dex/code/CatchHandlerList.java b/dx/src/com/android/dx/dex/code/CatchHandlerList.java
index 862586c..a8a97be 100644
--- a/dx/src/com/android/dx/dex/code/CatchHandlerList.java
+++ b/dx/src/com/android/dx/dex/code/CatchHandlerList.java
@@ -25,13 +25,13 @@
*/
public final class CatchHandlerList extends FixedSizeList
implements Comparable<CatchHandlerList> {
- /** non-null; empty instance */
+ /** {@code non-null;} empty instance */
public static final CatchHandlerList EMPTY = new CatchHandlerList(0);
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
- * @param size >= 0; the size of the list
+ * @param size {@code >= 0;} the size of the list
*/
public CatchHandlerList(int size) {
super(size);
@@ -40,10 +40,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Entry get(int n) {
return (Entry) get0(n);
@@ -58,10 +58,10 @@
* Get the human form of this instance, prefixed on each line
* with the string.
*
- * @param prefix non-null; the prefix for every line
- * @param header non-null; the header for the first line (after the
+ * @param prefix {@code non-null;} the prefix for every line
+ * @param header {@code non-null;} the header for the first line (after the
* first prefix)
- * @return non-null; the human form
+ * @return {@code non-null;} the human form
*/
public String toHuman(String prefix, String header) {
StringBuilder sb = new StringBuilder(100);
@@ -97,8 +97,8 @@
* Returns whether or not this instance ends with a "catch-all"
* handler.
*
- * @return <code>true</code> if this instance ends with a "catch-all"
- * handler or <code>false</code> if not
+ * @return {@code true} if this instance ends with a "catch-all"
+ * handler or {@code false} if not
*/
public boolean catchesAll() {
int size = size();
@@ -114,9 +114,9 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 0, < size(); which index
- * @param exceptionType non-null; type of exception handled
- * @param handler >= 0; exception handler address
+ * @param n {@code >= 0, < size();} which index
+ * @param exceptionType {@code non-null;} type of exception handled
+ * @param handler {@code >= 0;} exception handler address
*/
public void set(int n, CstType exceptionType, int handler) {
set0(n, new Entry(exceptionType, handler));
@@ -125,8 +125,8 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 0, < size(); which index
- * @param entry non-null; the entry to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param entry {@code non-null;} the entry to set at {@code n}
*/
public void set(int n, Entry entry) {
set0(n, entry);
@@ -165,17 +165,17 @@
* Entry in the list.
*/
public static class Entry implements Comparable<Entry> {
- /** non-null; type of exception handled */
+ /** {@code non-null;} type of exception handled */
private final CstType exceptionType;
- /** >= 0; exception handler address */
+ /** {@code >= 0;} exception handler address */
private final int handler;
/**
* Constructs an instance.
*
- * @param exceptionType non-null; type of exception handled
- * @param handler >= 0; exception handler address
+ * @param exceptionType {@code non-null;} type of exception handled
+ * @param handler {@code >= 0;} exception handler address
*/
public Entry(CstType exceptionType, int handler) {
if (handler < 0) {
@@ -220,7 +220,7 @@
/**
* Gets the exception type handled.
*
- * @return non-null; the exception type
+ * @return {@code non-null;} the exception type
*/
public CstType getExceptionType() {
return exceptionType;
@@ -229,7 +229,7 @@
/**
* Gets the handler address.
*
- * @return >= 0; the handler address
+ * @return {@code >= 0;} the handler address
*/
public int getHandler() {
return handler;
diff --git a/dx/src/com/android/dx/dex/code/CatchTable.java b/dx/src/com/android/dx/dex/code/CatchTable.java
index 86f9c58..fd8e3a7 100644
--- a/dx/src/com/android/dx/dex/code/CatchTable.java
+++ b/dx/src/com/android/dx/dex/code/CatchTable.java
@@ -26,13 +26,13 @@
*/
public final class CatchTable extends FixedSizeList
implements Comparable<CatchTable> {
- /** non-null; empty instance */
+ /** {@code non-null;} empty instance */
public static final CatchTable EMPTY = new CatchTable(0);
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
- * @param size >= 0; the size of the table
+ * @param size {@code >= 0;} the size of the table
*/
public CatchTable(int size) {
super(size);
@@ -41,10 +41,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Entry get(int n) {
return (Entry) get0(n);
@@ -53,8 +53,8 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 0, < size(); which index
- * @param entry non-null; the entry to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param entry {@code non-null;} the entry to set at {@code n}
*/
public void set(int n, Entry entry) {
set0(n, entry);
@@ -93,21 +93,21 @@
* Entry in a catch list.
*/
public static class Entry implements Comparable<Entry> {
- /** >= 0; start address */
+ /** {@code >= 0;} start address */
private final int start;
- /** > start; end address (exclusive) */
+ /** {@code > start;} end address (exclusive) */
private final int end;
- /** non-null; list of catch handlers */
+ /** {@code non-null;} list of catch handlers */
private final CatchHandlerList handlers;
/**
* Constructs an instance.
*
- * @param start >= 0; start address
- * @param end > start; end address (exclusive)
- * @param handlers non-null; list of catch handlers
+ * @param start {@code >= 0;} start address
+ * @param end {@code > start;} end address (exclusive)
+ * @param handlers {@code non-null;} list of catch handlers
*/
public Entry(int start, int end, CatchHandlerList handlers) {
if (start < 0) {
@@ -165,7 +165,7 @@
/**
* Gets the start address.
*
- * @return >= 0; the start address
+ * @return {@code >= 0;} the start address
*/
public int getStart() {
return start;
@@ -174,7 +174,7 @@
/**
* Gets the end address (exclusive).
*
- * @return > start; the end address (exclusive)
+ * @return {@code > start;} the end address (exclusive)
*/
public int getEnd() {
return end;
@@ -183,7 +183,7 @@
/**
* Gets the handlers.
*
- * @return non-null; the handlers
+ * @return {@code non-null;} the handlers
*/
public CatchHandlerList getHandlers() {
return handlers;
diff --git a/dx/src/com/android/dx/dex/code/CodeAddress.java b/dx/src/com/android/dx/dex/code/CodeAddress.java
index 9730913..f25718e 100644
--- a/dx/src/com/android/dx/dex/code/CodeAddress.java
+++ b/dx/src/com/android/dx/dex/code/CodeAddress.java
@@ -29,9 +29,9 @@
public final class CodeAddress extends ZeroSizeInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
+ * @param position {@code non-null;} source position
*/
public CodeAddress(SourcePosition position) {
super(position);
diff --git a/dx/src/com/android/dx/dex/code/CstInsn.java b/dx/src/com/android/dx/dex/code/CstInsn.java
index 1bc9021..a579c5e 100644
--- a/dx/src/com/android/dx/dex/code/CstInsn.java
+++ b/dx/src/com/android/dx/dex/code/CstInsn.java
@@ -25,31 +25,31 @@
* to all the normal instruction information.
*/
public final class CstInsn extends FixedSizeInsn {
- /** non-null; the constant argument for this instruction */
+ /** {@code non-null;} the constant argument for this instruction */
private final Constant constant;
/**
- * >= -1; the constant pool index for {@link #constant}, or
- * <code>-1</code> if not yet set
+ * {@code >= -1;} the constant pool index for {@link #constant}, or
+ * {@code -1} if not yet set
*/
private int index;
/**
- * >= -1; the constant pool index for the class reference in
- * {@link #constant} if any, or <code>-1</code> if not yet set
+ * {@code >= -1;} the constant pool index for the class reference in
+ * {@link #constant} if any, or {@code -1} if not yet set
*/
private int classIndex;
/**
* Constructs an instance. The output address of this instance is
- * initially unknown (<code>-1</code>) as is the constant pool index.
+ * initially unknown ({@code -1}) as is the constant pool index.
*
* @param opcode the opcode; one of the constants from {@link Dops}
- * @param position non-null; source position
- * @param registers non-null; register list, including a
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins or outs)
- * @param constant non-null; constant argument
+ * @param constant {@code non-null;} constant argument
*/
public CstInsn(Dop opcode, SourcePosition position,
RegisterSpecList registers, Constant constant) {
@@ -101,7 +101,7 @@
/**
* Gets the constant argument.
*
- * @return non-null; the constant argument
+ * @return {@code non-null;} the constant argument
*/
public Constant getConstant() {
return constant;
@@ -111,7 +111,7 @@
* Gets the constant's index. It is only valid to call this after
* {@link #setIndex} has been called.
*
- * @return >= 0; the constant pool index
+ * @return {@code >= 0;} the constant pool index
*/
public int getIndex() {
if (index < 0) {
@@ -126,7 +126,7 @@
*
* @see #setIndex
*
- * @return <code>true</code> iff the index has been set
+ * @return {@code true} iff the index has been set
*/
public boolean hasIndex() {
return (index >= 0);
@@ -136,7 +136,7 @@
* Sets the constant's index. It is only valid to call this method once
* per instance.
*
- * @param index >= 0; the constant pool index
+ * @param index {@code >= 0;} the constant pool index
*/
public void setIndex(int index) {
if (index < 0) {
@@ -154,7 +154,7 @@
* Gets the constant's class index. It is only valid to call this after
* {@link #setClassIndex} has been called.
*
- * @return >= 0; the constant's class's constant pool index
+ * @return {@code >= 0;} the constant's class's constant pool index
*/
public int getClassIndex() {
if (classIndex < 0) {
@@ -170,7 +170,7 @@
*
* @see #setClassIndex
*
- * @return <code>true</code> iff the index has been set
+ * @return {@code true} iff the index has been set
*/
public boolean hasClassIndex() {
return (classIndex >= 0);
@@ -183,7 +183,7 @@
* with reference constants that this method should ever be
* called. It is only valid to call this method once per instance.
*
- * @param index >= 0; the constant's class's constant pool index
+ * @param index {@code >= 0;} the constant's class's constant pool index
*/
public void setClassIndex(int index) {
if (index < 0) {
diff --git a/dx/src/com/android/dx/dex/code/DalvCode.java b/dx/src/com/android/dx/dex/code/DalvCode.java
index cf6af09..f911912 100644
--- a/dx/src/com/android/dx/dex/code/DalvCode.java
+++ b/dx/src/com/android/dx/dex/code/DalvCode.java
@@ -23,7 +23,7 @@
/**
* Container for all the pieces of a concrete method. Each instance
- * corresponds to a <code>code</code> structure in a <code>.dex</code> file.
+ * corresponds to a {@code code} structure in a {@code .dex} file.
*/
public final class DalvCode {
/**
@@ -33,37 +33,37 @@
private final int positionInfo;
/**
- * null-ok; the instruction list, ready for final processing;
+ * {@code null-ok;} the instruction list, ready for final processing;
* nulled out in {@link #finishProcessingIfNecessary}
*/
private OutputFinisher unprocessedInsns;
/**
- * non-null; unprocessed catch table;
+ * {@code non-null;} unprocessed catch table;
* nulled out in {@link #finishProcessingIfNecessary}
*/
private CatchBuilder unprocessedCatches;
/**
- * null-ok; catch table; set in
+ * {@code null-ok;} catch table; set in
* {@link #finishProcessingIfNecessary}
*/
private CatchTable catches;
/**
- * null-ok; source positions list; set in
+ * {@code null-ok;} source positions list; set in
* {@link #finishProcessingIfNecessary}
*/
private PositionList positions;
/**
- * null-ok; local variable list; set in
+ * {@code null-ok;} local variable list; set in
* {@link #finishProcessingIfNecessary}
*/
private LocalList locals;
/**
- * null-ok; the processed instruction list; set in
+ * {@code null-ok;} the processed instruction list; set in
* {@link #finishProcessingIfNecessary}
*/
private DalvInsnList insns;
@@ -73,9 +73,9 @@
*
* @param positionInfo how much position info to preserve; one of the
* static constants in {@link PositionList}
- * @param unprocessedInsns non-null; the instruction list, ready
+ * @param unprocessedInsns {@code non-null;} the instruction list, ready
* for final processing
- * @param unprocessedCatches non-null; unprocessed catch
+ * @param unprocessedCatches {@code non-null;} unprocessed catch
* (exception handler) table
*/
public DalvCode(int positionInfo, OutputFinisher unprocessedInsns,
@@ -120,7 +120,7 @@
* given callback to perform lookups. This must be called before
* {@link #getInsns}.
*
- * @param callback non-null; callback object
+ * @param callback {@code non-null;} callback object
*/
public void assignIndices(AssignIndicesCallback callback) {
unprocessedInsns.assignIndices(callback);
@@ -129,7 +129,7 @@
/**
* Gets whether this instance has any position data to represent.
*
- * @return <code>true</code> iff this instance has any position
+ * @return {@code true} iff this instance has any position
* data to represent
*/
public boolean hasPositions() {
@@ -140,7 +140,7 @@
/**
* Gets whether this instance has any local variable data to represent.
*
- * @return <code>true</code> iff this instance has any local variable
+ * @return {@code true} iff this instance has any local variable
* data to represent
*/
public boolean hasLocals() {
@@ -160,7 +160,7 @@
/**
* Gets the set of catch types handled anywhere in the code.
*
- * @return non-null; the set of catch types
+ * @return {@code non-null;} the set of catch types
*/
public HashSet<Type> getCatchTypes() {
return unprocessedCatches.getCatchTypes();
@@ -170,7 +170,7 @@
* Gets the set of all constants referred to by instructions in
* the code.
*
- * @return non-null; the set of constants
+ * @return {@code non-null;} the set of constants
*/
public HashSet<Constant> getInsnConstants() {
return unprocessedInsns.getAllConstants();
@@ -179,7 +179,7 @@
/**
* Gets the list of instructions.
*
- * @return non-null; the instruction list
+ * @return {@code non-null;} the instruction list
*/
public DalvInsnList getInsns() {
finishProcessingIfNecessary();
@@ -189,7 +189,7 @@
/**
* Gets the catch (exception handler) table.
*
- * @return non-null; the catch table
+ * @return {@code non-null;} the catch table
*/
public CatchTable getCatches() {
finishProcessingIfNecessary();
@@ -199,7 +199,7 @@
/**
* Gets the source positions list.
*
- * @return non-null; the source positions list
+ * @return {@code non-null;} the source positions list
*/
public PositionList getPositions() {
finishProcessingIfNecessary();
@@ -209,7 +209,7 @@
/**
* Gets the source positions list.
*
- * @return non-null; the source positions list
+ * @return {@code non-null;} the source positions list
*/
public LocalList getLocals() {
finishProcessingIfNecessary();
@@ -223,8 +223,8 @@
/**
* Gets the index for the given constant.
*
- * @param cst non-null; the constant
- * @return >= -1; the index or <code>-1</code> if the constant
+ * @param cst {@code non-null;} the constant
+ * @return {@code >= -1;} the index or {@code -1} if the constant
* shouldn't actually be reified with an index
*/
public int getIndex(Constant cst);
diff --git a/dx/src/com/android/dx/dex/code/DalvInsn.java b/dx/src/com/android/dx/dex/code/DalvInsn.java
index d922193..11ee55d 100644
--- a/dx/src/com/android/dx/dex/code/DalvInsn.java
+++ b/dx/src/com/android/dx/dex/code/DalvInsn.java
@@ -29,26 +29,26 @@
public abstract class DalvInsn {
/**
* the actual output address of this instance, if known, or
- * <code>-1</code> if not
+ * {@code -1} if not
*/
private int address;
/** the opcode; one of the constants from {@link Dops} */
private final Dop opcode;
- /** non-null; source position */
+ /** {@code non-null;} source position */
private final SourcePosition position;
- /** non-null; list of register arguments */
+ /** {@code non-null;} list of register arguments */
private final RegisterSpecList registers;
/**
* Makes a move instruction, appropriate and ideal for the given arguments.
*
- * @param position non-null; source position information
- * @param dest non-null; destination register
- * @param src non-null; source register
- * @return non-null; an appropriately-constructed instance
+ * @param position {@code non-null;} source position information
+ * @param dest {@code non-null;} destination register
+ * @param src {@code non-null;} source register
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static SimpleInsn makeMove(SourcePosition position,
RegisterSpec dest, RegisterSpec src) {
@@ -75,17 +75,17 @@
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
* <p><b>Note:</b> In the unlikely event that an instruction takes
- * absolutely no registers (e.g., a <code>nop</code> or a
+ * absolutely no registers (e.g., a {@code nop} or a
* no-argument no-result static method call), then the given
* register list may be passed as {@link
* RegisterSpecList#EMPTY}.</p>
*
* @param opcode the opcode; one of the constants from {@link Dops}
- * @param position non-null; source position
- * @param registers non-null; register list, including a
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins and outs)
*/
@@ -151,11 +151,11 @@
/**
* Gets the output address of this instruction, if it is known. This throws
- * a <code>RuntimeException</code> if it has not yet been set.
+ * a {@code RuntimeException} if it has not yet been set.
*
* @see #setAddress
*
- * @return >= 0; the output address
+ * @return {@code >= 0;} the output address
*/
public final int getAddress() {
if (address < 0) {
@@ -168,7 +168,7 @@
/**
* Gets the opcode.
*
- * @return non-null; the opcode
+ * @return {@code non-null;} the opcode
*/
public final Dop getOpcode() {
return opcode;
@@ -177,7 +177,7 @@
/**
* Gets the source position.
*
- * @return non-null; the source position
+ * @return {@code non-null;} the source position
*/
public final SourcePosition getPosition() {
return position;
@@ -186,7 +186,7 @@
/**
* Gets the register list for this instruction.
*
- * @return non-null; the registers
+ * @return {@code non-null;} the registers
*/
public final RegisterSpecList getRegisters() {
return registers;
@@ -195,9 +195,9 @@
/**
* Returns whether this instance's opcode uses a result register.
* This method is a convenient shorthand for
- * <code>getOpcode().hasResult()</code>.
+ * {@code getOpcode().hasResult()}.
*
- * @return <code>true</code> iff this opcode uses a result register
+ * @return {@code true} iff this opcode uses a result register
*/
public final boolean hasResult() {
return opcode.hasResult();
@@ -210,7 +210,7 @@
* (to be explicit here) category-2 values take up two consecutive
* registers.
*
- * @return >= 0; the minimum distinct register requirement
+ * @return {@code >= 0;} the minimum distinct register requirement
*/
public final int getMinimumRegisterRequirement() {
boolean hasResult = hasResult();
@@ -231,7 +231,7 @@
*
* @see #hrVersion
*
- * @return null-ok; the prefix, if any
+ * @return {@code null-ok;} the prefix, if any
*/
public DalvInsn hrPrefix() {
RegisterSpecList regs = registers;
@@ -255,7 +255,7 @@
*
* @see #hrVersion
*
- * @return null-ok; the suffix, if any
+ * @return {@code null-ok;} the suffix, if any
*/
public DalvInsn hrSuffix() {
if (hasResult()) {
@@ -268,8 +268,8 @@
/**
* Gets the instruction that is equivalent to this one, except that
- * uses sequential registers starting at <code>0</code> (storing
- * the result, if any, in register <code>0</code> as well). The
+ * uses sequential registers starting at {@code 0} (storing
+ * the result, if any, in register {@code 0} as well). The
* sequence of instructions from {@link #hrPrefix} and {@link
* #hrSuffix} (if non-null) surrounding the result of a call to
* this method are the high register transformation of this
@@ -277,7 +277,7 @@
* used will be the number returned by {@link
* #getMinimumRegisterRequirement}.
*
- * @return non-null; the replacement
+ * @return {@code non-null;} the replacement
*/
public DalvInsn hrVersion() {
RegisterSpecList regs =
@@ -289,7 +289,7 @@
* Gets the short identifier for this instruction. This is its
* address, if assigned, or its identity hashcode if not.
*
- * @return non-null; the identifier
+ * @return {@code non-null;} the identifier
*/
public final String identifierString() {
if (address != -1) {
@@ -301,16 +301,16 @@
/**
* Returns the string form of this instance suitable for inclusion in
- * a human-oriented listing dump. This method will return <code>null</code>
+ * a human-oriented listing dump. This method will return {@code null}
* if this instance should not appear in a listing.
*
- * @param prefix non-null; prefix before the address; each follow-on
+ * @param prefix {@code non-null;} prefix before the address; each follow-on
* line will be indented to match as well
- * @param width >= 0; the width of the output or <code>0</code> for
+ * @param width {@code >= 0;} the width of the output or {@code 0} for
* unlimited width
* @param noteIndices whether to include an explicit notation of
* constant pool indices
- * @return null-ok; the string form or <code>null</code> if this
+ * @return {@code null-ok;} the string form or {@code null} if this
* instance should not appear in a listing
*/
public final String listingString(String prefix, int width,
@@ -331,7 +331,7 @@
/**
* Sets the output address.
*
- * @param address >= 0; the output address
+ * @param address {@code >= 0;} the output address
*/
public final void setAddress(int address) {
if (address < 0) {
@@ -347,7 +347,7 @@
* to the address plus the length of the instruction format of this
* instance's opcode.
*
- * @return >= 0; the next address
+ * @return {@code >= 0;} the next address
*/
public final int getNextAddress() {
return getAddress() + codeSize();
@@ -356,7 +356,7 @@
/**
* Gets the size of this instruction, in 16-bit code units.
*
- * @return >= 0; the code size of this instruction
+ * @return {@code >= 0;} the code size of this instruction
*/
public abstract int codeSize();
@@ -364,7 +364,7 @@
* Writes this instance to the given output. This method should
* never annotate the output.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public abstract void writeTo(AnnotatedOutput out);
@@ -372,8 +372,8 @@
* Returns an instance that is just like this one, except that its
* opcode is replaced by the one given, and its address is reset.
*
- * @param opcode non-null; the new opcode
- * @return non-null; an appropriately-constructed instance
+ * @param opcode {@code non-null;} the new opcode
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract DalvInsn withOpcode(Dop opcode);
@@ -383,7 +383,7 @@
* address is reset.
*
* @param delta the amount to offset register references by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract DalvInsn withRegisterOffset(int delta);
@@ -392,8 +392,8 @@
* register list is replaced by the given one, and its address is
* reset.
*
- * @param registers non-null; new register list
- * @return non-null; an appropriately-constructed instance
+ * @param registers {@code non-null;} new register list
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract DalvInsn withRegisters(RegisterSpecList registers);
@@ -401,8 +401,8 @@
* Gets the string form for any arguments to this instance. Subclasses
* must override this.
*
- * @return null-ok; the string version of any arguments or
- * <code>null</code> if there are none
+ * @return {@code null-ok;} the string version of any arguments or
+ * {@code null} if there are none
*/
protected abstract String argString();
@@ -411,12 +411,12 @@
* form of this instance suitable for inclusion in a
* human-oriented listing dump, not including the instruction
* address and without respect for any output formatting. This
- * method should return <code>null</code> if this instance should
+ * method should return {@code null} if this instance should
* not appear in a listing.
*
* @param noteIndices whether to include an explicit notation of
* constant pool indices
- * @return null-ok; the listing string
+ * @return {@code null-ok;} the listing string
*/
protected abstract String listingString0(boolean noteIndices);
}
diff --git a/dx/src/com/android/dx/dex/code/DalvInsnList.java b/dx/src/com/android/dx/dex/code/DalvInsnList.java
index 2cd15c6..5cf22f2 100644
--- a/dx/src/com/android/dx/dex/code/DalvInsnList.java
+++ b/dx/src/com/android/dx/dex/code/DalvInsnList.java
@@ -46,10 +46,10 @@
* Constructs and returns an immutable instance whose elements are
* identical to the ones in the given list, in the same order.
*
- * @param list non-null; the list to use for elements
+ * @param list {@code non-null;} the list to use for elements
* @param regCount count, in register-units, of the number of registers
* this code block requires.
- * @return non-null; an appropriately-constructed instance of this
+ * @return {@code non-null;} an appropriately-constructed instance of this
* class
*/
public static DalvInsnList makeImmutable(ArrayList<DalvInsn> list,
@@ -66,7 +66,7 @@
}
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -78,10 +78,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public DalvInsn get(int n) {
return (DalvInsn) get0(n);
@@ -90,8 +90,8 @@
/**
* Sets the instruction at the given index.
*
- * @param n >= 0, < size(); which index
- * @param insn non-null; the instruction to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param insn {@code non-null;} the instruction to set at {@code n}
*/
public void set(int n, DalvInsn insn) {
set0(n, insn);
@@ -102,7 +102,7 @@
* return a meaningful result if the instructions in this instance all
* have valid addresses.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int codeSize() {
int sz = size();
@@ -119,7 +119,7 @@
* Writes all the instructions in this instance to the given output
* destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public void writeTo(AnnotatedOutput out) {
int startCursor = out.getCursor();
@@ -170,7 +170,7 @@
* Gets the minimum required register count implied by this
* instance. This includes any unused parameters that could
* potentially be at the top of the register space.
- * @return >= 0; the required registers size
+ * @return {@code >= 0;} the required registers size
*/
public int getRegistersSize() {
return regCount;
@@ -181,7 +181,7 @@
* method. This is equal to the largest argument word count of any
* method referred to by this instance.
*
- * @return >= 0; the required outgoing arguments size
+ * @return {@code >= 0;} the required outgoing arguments size
*/
public int getOutsSize() {
int sz = size();
@@ -216,8 +216,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; prefix to attach to each line of output
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} prefix to attach to each line of output
* @param verbose whether to be verbose; verbose output includes
* lines for zero-size instructions and explicit constant pool indices
*/
@@ -250,8 +250,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; prefix to attach to each line of output
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} prefix to attach to each line of output
* @param verbose whether to be verbose; verbose output includes
* lines for zero-size instructions
*/
diff --git a/dx/src/com/android/dx/dex/code/Dop.java b/dx/src/com/android/dx/dex/code/Dop.java
index 6914fca..d1f92bf 100644
--- a/dx/src/com/android/dx/dex/code/Dop.java
+++ b/dx/src/com/android/dx/dex/code/Dop.java
@@ -26,25 +26,25 @@
/** DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family */
private final int family;
- /** non-null; the instruction format */
+ /** {@code non-null;} the instruction format */
private final InsnFormat format;
/** whether this opcode uses a result register */
private final boolean hasResult;
- /** non-null; the name */
+ /** {@code non-null;} the name */
private final String name;
/**
* Constructs an instance.
*
- * @param opcode DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode
+ * @param opcode {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode
* value itself
- * @param family DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
- * @param format non-null; the instruction format
+ * @param family {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family
+ * @param format {@code non-null;} the instruction format
* @param hasResult whether the opcode has a result register; if so it
* is always the first register
- * @param name non-null; the name
+ * @param name {@code non-null;} the name
*/
public Dop(int opcode, int family, InsnFormat format,
boolean hasResult, String name) {
@@ -80,7 +80,7 @@
/**
* Gets the opcode value.
*
- * @return DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value
+ * @return {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value
*/
public int getOpcode() {
return opcode;
@@ -90,7 +90,7 @@
* Gets the opcode family. The opcode family is the unmarked (no
* "/...") opcode that has equivalent semantics to this one.
*
- * @return DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
+ * @return {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family
*/
public int getFamily() {
return family;
@@ -99,7 +99,7 @@
/**
* Gets the instruction format.
*
- * @return non-null; the instruction format
+ * @return {@code non-null;} the instruction format
*/
public InsnFormat getFormat() {
return format;
@@ -108,7 +108,7 @@
/**
* Returns whether this opcode uses a result register.
*
- * @return <code>true</code> iff this opcode uses a result register
+ * @return {@code true} iff this opcode uses a result register
*/
public boolean hasResult() {
return hasResult;
@@ -117,7 +117,7 @@
/**
* Gets the opcode name.
*
- * @return non-null; the opcode name
+ * @return {@code non-null;} the opcode name
*/
public String getName() {
return name;
@@ -127,7 +127,7 @@
* Gets the opcode for the opposite test of this instance. This is only
* valid for opcodes which are in fact tests.
*
- * @return non-null; the opposite test
+ * @return {@code non-null;} the opposite test
*/
public Dop getOppositeTest() {
switch (opcode) {
diff --git a/dx/src/com/android/dx/dex/code/Dops.java b/dx/src/com/android/dx/dex/code/Dops.java
index 8923c59..dfdaa73 100644
--- a/dx/src/com/android/dx/dex/code/Dops.java
+++ b/dx/src/com/android/dx/dex/code/Dops.java
@@ -47,7 +47,7 @@
* them.
*/
public final class Dops {
- /** non-null; array containing all the standard instances */
+ /** {@code non-null;} array containing all the standard instances */
private static final Dop[] DOPS;
/**
@@ -1172,8 +1172,8 @@
/**
* Gets the {@link Dop} for the given opcode value.
*
- * @param opcode DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode value
- * @return non-null; the associated opcode instance
+ * @param opcode {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode value
+ * @return {@code non-null;} the associated opcode instance
*/
public static Dop get(int opcode) {
int idx = opcode - DalvOps.MIN_VALUE;
@@ -1194,9 +1194,9 @@
* Gets the {@link Dop} with the given family/format combination, if
* any.
*
- * @param family DalvOps.MIN_VALUE..DalvOps.MAX_VALUE; the opcode family
- * @param format non-null; the opcode's instruction format
- * @return null-ok; the corresponding opcode, or <code>null</code> if
+ * @param family {@code DalvOps.MIN_VALUE..DalvOps.MAX_VALUE;} the opcode family
+ * @param format {@code non-null;} the opcode's instruction format
+ * @return {@code null-ok;} the corresponding opcode, or {@code null} if
* there is none
*/
public static Dop getOrNull(int family, InsnFormat format) {
@@ -1222,7 +1222,7 @@
/**
* Puts the given opcode into the table of all ops.
*
- * @param opcode non-null; the opcode
+ * @param opcode {@code non-null;} the opcode
*/
private static void set(Dop opcode) {
int idx = opcode.getOpcode() - DalvOps.MIN_VALUE;
diff --git a/dx/src/com/android/dx/dex/code/FixedSizeInsn.java b/dx/src/com/android/dx/dex/code/FixedSizeInsn.java
index 63c9d24..147937f 100644
--- a/dx/src/com/android/dx/dex/code/FixedSizeInsn.java
+++ b/dx/src/com/android/dx/dex/code/FixedSizeInsn.java
@@ -28,17 +28,17 @@
public abstract class FixedSizeInsn extends DalvInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
* <p><b>Note:</b> In the unlikely event that an instruction takes
- * absolutely no registers (e.g., a <code>nop</code> or a
+ * absolutely no registers (e.g., a {@code nop} or a
* no-argument no-result * static method call), then the given
* register list may be passed as {@link
* RegisterSpecList#EMPTY}.</p>
*
* @param opcode the opcode; one of the constants from {@link Dops}
- * @param position non-null; source position
- * @param registers non-null; register list, including a
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins or outs)
*/
diff --git a/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java b/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java
index 458bc89..9155367 100644
--- a/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java
+++ b/dx/src/com/android/dx/dex/code/HighRegisterPrefix.java
@@ -24,21 +24,21 @@
/**
* Combination instruction which turns into a variable number of
- * <code>move*</code> instructions to move a set of registers into
- * registers starting at <code>0</code> sequentially. This is used
+ * {@code move*} instructions to move a set of registers into
+ * registers starting at {@code 0} sequentially. This is used
* in translating an instruction whose register requirements cannot
* be met using a straightforward choice of a single opcode.
*/
public final class HighRegisterPrefix extends VariableSizeInsn {
- /** null-ok; cached instructions, if constructed */
+ /** {@code null-ok;} cached instructions, if constructed */
private SimpleInsn[] insns;
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param registers non-null; source registers
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} source registers
*/
public HighRegisterPrefix(SourcePosition position,
RegisterSpecList registers) {
@@ -135,9 +135,9 @@
* Returns the proper move instruction for the given source spec
* and destination index.
*
- * @param src non-null; the source register spec
- * @param destIndex >= 0; the destination register index
- * @return non-null; the appropriate move instruction
+ * @param src {@code non-null;} the source register spec
+ * @param destIndex {@code >= 0;} the destination register index
+ * @return {@code non-null;} the appropriate move instruction
*/
private static SimpleInsn moveInsnFor(RegisterSpec src, int destIndex) {
return DalvInsn.makeMove(SourcePosition.NO_INFO,
diff --git a/dx/src/com/android/dx/dex/code/InsnFormat.java b/dx/src/com/android/dx/dex/code/InsnFormat.java
index ed4137b..ca6688b 100644
--- a/dx/src/com/android/dx/dex/code/InsnFormat.java
+++ b/dx/src/com/android/dx/dex/code/InsnFormat.java
@@ -37,10 +37,10 @@
* dump, of the given instruction. The instruction must be of this
* instance's format for proper operation.
*
- * @param insn non-null; the instruction
+ * @param insn {@code non-null;} the instruction
* @param noteIndices whether to include an explicit notation of
* constant pool indices
- * @return non-null; the string form
+ * @return {@code non-null;} the string form
*/
public final String listingString(DalvInsn insn, boolean noteIndices) {
String op = insn.getOpcode().getName();
@@ -66,28 +66,28 @@
/**
* Returns the string form of the arguments to the given instruction.
* The instruction must be of this instance's format. If the instruction
- * has no arguments, then the result should be <code>""</code>, not
- * <code>null</code>.
+ * has no arguments, then the result should be {@code ""}, not
+ * {@code null}.
*
* <p>Subclasses must override this method.</p>
*
- * @param insn non-null; the instruction
- * @return non-null; the string form
+ * @param insn {@code non-null;} the instruction
+ * @return {@code non-null;} the string form
*/
public abstract String insnArgString(DalvInsn insn);
/**
* Returns the associated comment for the given instruction, if any.
* The instruction must be of this instance's format. If the instruction
- * has no comment, then the result should be <code>""</code>, not
- * <code>null</code>.
+ * has no comment, then the result should be {@code ""}, not
+ * {@code null}.
*
* <p>Subclasses must override this method.</p>
*
- * @param insn non-null; the instruction
+ * @param insn {@code non-null;} the instruction
* @param noteIndices whether to include an explicit notation of
* constant pool indices
- * @return non-null; the string form
+ * @return {@code non-null;} the string form
*/
public abstract String insnCommentString(DalvInsn insn,
boolean noteIndices);
@@ -97,7 +97,7 @@
* size is a number of 16-bit code units, not bytes. This should
* throw an exception if this format is of variable size.
*
- * @return >= 0; the instruction length in 16-bit code units
+ * @return {@code >= 0;} the instruction length in 16-bit code units
*/
public abstract int codeSize();
@@ -112,24 +112,24 @@
*
* <p>Subclasses must override this method.</p>
*
- * @param insn non-null; the instruction to check
- * @return <code>true</code> iff the instruction's arguments are
- * appropriate for this instance, or <code>false</code> if not
+ * @param insn {@code non-null;} the instruction to check
+ * @return {@code true} iff the instruction's arguments are
+ * appropriate for this instance, or {@code false} if not
*/
public abstract boolean isCompatible(DalvInsn insn);
/**
* Returns whether or not the given instruction's branch offset will
- * fit in this instance's format. This always returns <code>false</code>
+ * fit in this instance's format. This always returns {@code false}
* for formats that don't include a branch offset.
*
* <p>The default implementation of this method always returns
- * <code>false</code>. Subclasses must override this method if they
+ * {@code false}. Subclasses must override this method if they
* include branch offsets.</p>
*
- * @param insn non-null; the instruction to check
- * @return <code>true</code> iff the instruction's branch offset is
- * appropriate for this instance, or <code>false</code> if not
+ * @param insn {@code non-null;} the instruction to check
+ * @return {@code true} iff the instruction's branch offset is
+ * appropriate for this instance, or {@code false} if not
*/
public boolean branchFits(TargetInsn insn) {
return false;
@@ -141,7 +141,7 @@
*
* <p>Subclasses must override this method.</p>
*
- * @return null-ok; the next format to try, or <code>null</code> if
+ * @return {@code null-ok;} the next format to try, or {@code null} if
* there are no suitable alternatives
*/
public abstract InsnFormat nextUp();
@@ -152,16 +152,16 @@
*
* <p>Subclasses must override this method.</p>
*
- * @param out non-null; the output destination to write to
- * @param insn non-null; the instruction to write
+ * @param out {@code non-null;} the output destination to write to
+ * @param insn {@code non-null;} the instruction to write
*/
public abstract void writeTo(AnnotatedOutput out, DalvInsn insn);
/**
* Helper method to return a register list string.
*
- * @param list non-null; the list of registers
- * @return non-null; the string form
+ * @param list {@code non-null;} the list of registers
+ * @return {@code non-null;} the string form
*/
protected static String regListString(RegisterSpecList list) {
int sz = list.size();
@@ -185,7 +185,7 @@
* Helper method to return a literal bits argument string.
*
* @param value the value
- * @return non-null; the string form
+ * @return {@code non-null;} the string form
*/
protected static String literalBitsString(CstLiteralBits value) {
StringBuffer sb = new StringBuffer(100);
@@ -208,8 +208,8 @@
*
* @param value the value
* @param width the width of the constant, in bits (used for displaying
- * the uninterpreted bits; one of: <code>4 8 16 32 64</code>
- * @return non-null; the comment
+ * the uninterpreted bits; one of: {@code 4 8 16 32 64}
+ * @return {@code non-null;} the comment
*/
protected static String literalBitsComment(CstLiteralBits value,
int width) {
@@ -242,8 +242,8 @@
/**
* Helper method to return a branch address string.
*
- * @param insn non-null; the instruction in question
- * @return non-null; the string form of the instruction's branch target
+ * @param insn {@code non-null;} the instruction in question
+ * @return {@code non-null;} the string form of the instruction's branch target
*/
protected static String branchString(DalvInsn insn) {
TargetInsn ti = (TargetInsn) insn;
@@ -255,8 +255,8 @@
/**
* Helper method to return the comment for a branch.
*
- * @param insn non-null; the instruction in question
- * @return non-null; the comment
+ * @param insn {@code non-null;} the instruction in question
+ * @return {@code non-null;} the comment
*/
protected static String branchComment(DalvInsn insn) {
TargetInsn ti = (TargetInsn) insn;
@@ -268,8 +268,8 @@
/**
* Helper method to return a constant string.
*
- * @param insn non-null; a constant-bearing instruction
- * @return non-null; the string form of the contained constant
+ * @param insn {@code non-null;} a constant-bearing instruction
+ * @return {@code non-null;} the string form of the contained constant
*/
protected static String cstString(DalvInsn insn) {
CstInsn ci = (CstInsn) insn;
@@ -281,8 +281,8 @@
/**
* Helper method to return an instruction comment for a constant.
*
- * @param insn non-null; a constant-bearing instruction
- * @return non-null; comment string representing the constant
+ * @param insn {@code non-null;} a constant-bearing instruction
+ * @return {@code non-null;} comment string representing the constant
*/
protected static String cstComment(DalvInsn insn) {
CstInsn ci = (CstInsn) insn;
@@ -310,7 +310,7 @@
* Helper method to determine if a signed int value fits in a nibble.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range -8..+7
+ * @return {@code true} iff it's in the range -8..+7
*/
protected static boolean signedFitsInNibble(int value) {
return (value >= -8) && (value <= 7);
@@ -320,7 +320,7 @@
* Helper method to determine if an unsigned int value fits in a nibble.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range 0..0xf
+ * @return {@code true} iff it's in the range 0..0xf
*/
protected static boolean unsignedFitsInNibble(int value) {
return value == (value & 0xf);
@@ -330,7 +330,7 @@
* Helper method to determine if a signed int value fits in a byte.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range -0x80..+0x7f
+ * @return {@code true} iff it's in the range -0x80..+0x7f
*/
protected static boolean signedFitsInByte(int value) {
return (byte) value == value;
@@ -340,7 +340,7 @@
* Helper method to determine if an unsigned int value fits in a byte.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range 0..0xff
+ * @return {@code true} iff it's in the range 0..0xff
*/
protected static boolean unsignedFitsInByte(int value) {
return value == (value & 0xff);
@@ -350,7 +350,7 @@
* Helper method to determine if a signed int value fits in a short.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range -0x8000..+0x7fff
+ * @return {@code true} iff it's in the range -0x8000..+0x7fff
*/
protected static boolean signedFitsInShort(int value) {
return (short) value == value;
@@ -360,7 +360,7 @@
* Helper method to determine if an unsigned int value fits in a short.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range 0..0xffff
+ * @return {@code true} iff it's in the range 0..0xffff
*/
protected static boolean unsignedFitsInShort(int value) {
return value == (value & 0xffff);
@@ -370,7 +370,7 @@
* Helper method to determine if a signed int value fits in three bytes.
*
* @param value the value in question
- * @return <code>true</code> iff it's in the range -0x800000..+0x7fffff
+ * @return {@code true} iff it's in the range -0x800000..+0x7fffff
*/
protected static boolean signedFitsIn3Bytes(int value) {
return value == ((value << 8) >> 8);
@@ -380,8 +380,8 @@
* Helper method to extract the callout-argument index from an
* appropriate instruction.
*
- * @param insn non-null; the instruction
- * @return >= 0; the callout argument index
+ * @param insn {@code non-null;} the instruction
+ * @return {@code >= 0;} the callout argument index
*/
protected static int argIndex(DalvInsn insn) {
int arg = ((CstInteger) ((CstInsn) insn).getConstant()).getValue();
@@ -397,8 +397,8 @@
* Helper method to combine an opcode and a second byte of data into
* the appropriate form for emitting into a code buffer.
*
- * @param insn non-null; the instruction containing the opcode
- * @param arg 0..255; arbitrary other byte value
+ * @param insn {@code non-null;} the instruction containing the opcode
+ * @param arg {@code 0..255;} arbitrary other byte value
* @return combined value
*/
protected static short opcodeUnit(DalvInsn insn, int arg) {
@@ -418,8 +418,8 @@
/**
* Helper method to combine two bytes into a code unit.
*
- * @param low 0..255; low byte
- * @param high 0..255; high byte
+ * @param low {@code 0..255;} low byte
+ * @param high {@code 0..255;} high byte
* @return combined value
*/
protected static short codeUnit(int low, int high) {
@@ -437,10 +437,10 @@
/**
* Helper method to combine four nibbles into a code unit.
*
- * @param n0 0..15; low nibble
- * @param n1 0..15; medium-low nibble
- * @param n2 0..15; medium-high nibble
- * @param n3 0..15; high nibble
+ * @param n0 {@code 0..15;} low nibble
+ * @param n1 {@code 0..15;} medium-low nibble
+ * @param n2 {@code 0..15;} medium-high nibble
+ * @param n3 {@code 0..15;} high nibble
* @return combined value
*/
protected static short codeUnit(int n0, int n1, int n2, int n3) {
@@ -466,9 +466,9 @@
/**
* Helper method to combine two nibbles into a byte.
*
- * @param low 0..15; low nibble
- * @param high 0..15; high nibble
- * @return 0..255; combined value
+ * @param low {@code 0..15;} low nibble
+ * @param high {@code 0..15;} high nibble
+ * @return {@code 0..255;} combined value
*/
protected static int makeByte(int low, int high) {
if ((low & 0xf) != low) {
@@ -485,7 +485,7 @@
/**
* Writes one code unit to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
*/
protected static void write(AnnotatedOutput out, short c0) {
@@ -495,7 +495,7 @@
/**
* Writes two code units to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
* @param c1 code unit to write
*/
@@ -507,7 +507,7 @@
/**
* Writes three code units to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
* @param c1 code unit to write
* @param c2 code unit to write
@@ -522,7 +522,7 @@
/**
* Writes four code units to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
* @param c1 code unit to write
* @param c2 code unit to write
@@ -539,7 +539,7 @@
/**
* Writes five code units to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
* @param c1 code unit to write
* @param c2 code unit to write
@@ -558,7 +558,7 @@
/**
* Writes six code units to the given output destination.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
* @param c0 code unit to write
* @param c1 code unit to write
* @param c2 code unit to write
diff --git a/dx/src/com/android/dx/dex/code/LocalEnd.java b/dx/src/com/android/dx/dex/code/LocalEnd.java
index c19a8dc..360a55c 100644
--- a/dx/src/com/android/dx/dex/code/LocalEnd.java
+++ b/dx/src/com/android/dx/dex/code/LocalEnd.java
@@ -28,7 +28,7 @@
*/
public final class LocalEnd extends ZeroSizeInsn {
/**
- * non-null; register spec representing the local variable ended
+ * {@code non-null;} register spec representing the local variable ended
* by this instance. <b>Note:</b> Technically, only the register
* number needs to be recorded here as the rest of the information
* is implicit in the ambient local variable state, but other code
@@ -38,10 +38,10 @@
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param local non-null; register spec representing the local
+ * @param position {@code non-null;} source position
+ * @param local {@code non-null;} register spec representing the local
* variable introduced by this instance
*/
public LocalEnd(SourcePosition position, RegisterSpec local) {
@@ -70,7 +70,7 @@
* Gets the register spec representing the local variable ended
* by this instance.
*
- * @return non-null; the register spec
+ * @return {@code non-null;} the register spec
*/
public RegisterSpec getLocal() {
return local;
diff --git a/dx/src/com/android/dx/dex/code/LocalList.java b/dx/src/com/android/dx/dex/code/LocalList.java
index 4614fc4..8f2b6f6 100644
--- a/dx/src/com/android/dx/dex/code/LocalList.java
+++ b/dx/src/com/android/dx/dex/code/LocalList.java
@@ -33,16 +33,16 @@
* and a type.
*/
public final class LocalList extends FixedSizeList {
- /** non-null; empty instance */
+ /** {@code non-null;} empty instance */
public static final LocalList EMPTY = new LocalList(0);
/** whether to run the self-check code */
private static final boolean DEBUG = false;
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
- * @param size >= 0; the size of the list
+ * @param size {@code >= 0;} the size of the list
*/
public LocalList(int size) {
super(size);
@@ -51,10 +51,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Entry get(int n) {
return (Entry) get0(n);
@@ -63,8 +63,8 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 0, < size(); which index
- * @param entry non-null; the entry to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param entry {@code non-null;} the entry to set at {@code n}
*/
public void set(int n, Entry entry) {
set0(n, entry);
@@ -73,8 +73,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; prefix to attach to each line of output
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} prefix to attach to each line of output
*/
public void debugPrint(PrintStream out, String prefix) {
int sz = size();
@@ -118,24 +118,24 @@
* Entry in a local list.
*/
public static class Entry implements Comparable<Entry> {
- /** >= 0; address */
+ /** {@code >= 0;} address */
private final int address;
- /** non-null; disposition of the local */
+ /** {@code non-null;} disposition of the local */
private final Disposition disposition;
- /** non-null; register spec representing the variable */
+ /** {@code non-null;} register spec representing the variable */
private final RegisterSpec spec;
- /** non-null; variable type (derived from {@code spec}) */
+ /** {@code non-null;} variable type (derived from {@code spec}) */
private final CstType type;
/**
* Constructs an instance.
*
- * @param address >= 0; address
- * @param disposition non-null; disposition of the local
- * @param spec non-null; register spec representing the variable
+ * @param address {@code >= 0;} address
+ * @param disposition {@code non-null;} disposition of the local
+ * @param spec {@code non-null;} register spec representing the variable
*/
public Entry(int address, Disposition disposition, RegisterSpec spec) {
if (address < 0) {
@@ -182,8 +182,8 @@
* disposition (variants of end are all consistered
* equivalent), and spec.
*
- * @param other non-null; entry to compare to
- * @return {@code -1..1}; standard result of comparison
+ * @param other {@code non-null;} entry to compare to
+ * @return {@code -1..1;} standard result of comparison
*/
public int compareTo(Entry other) {
if (address < other.address) {
@@ -205,7 +205,7 @@
/**
* Gets the address.
*
- * @return >= 0; the address
+ * @return {@code >= 0;} the address
*/
public int getAddress() {
return address;
@@ -214,7 +214,7 @@
/**
* Gets the disposition.
*
- * @return non-null; the disposition
+ * @return {@code non-null;} the disposition
*/
public Disposition getDisposition() {
return disposition;
@@ -233,7 +233,7 @@
/**
* Gets the variable name.
*
- * @return null-ok; the variable name
+ * @return {@code null-ok;} the variable name
*/
public CstUtf8 getName() {
return spec.getLocalItem().getName();
@@ -242,7 +242,7 @@
/**
* Gets the variable signature.
*
- * @return null-ok; the variable signature
+ * @return {@code null-ok;} the variable signature
*/
public CstUtf8 getSignature() {
return spec.getLocalItem().getSignature();
@@ -251,7 +251,7 @@
/**
* Gets the variable's type.
*
- * @return non-null; the type
+ * @return {@code non-null;} the type
*/
public CstType getType() {
return type;
@@ -260,7 +260,7 @@
/**
* Gets the number of the register holding the variable.
*
- * @return >= 0; the number fo the register holding the variable
+ * @return {@code >= 0;} the number fo the register holding the variable
*/
public int getRegister() {
return spec.getReg();
@@ -269,7 +269,7 @@
/**
* Gets the RegisterSpec of the register holding the variable.
*
- * @return non-null; RegisterSpec of the holding register.
+ * @return {@code non-null;} RegisterSpec of the holding register.
*/
public RegisterSpec getRegisterSpec() {
return spec;
@@ -278,9 +278,9 @@
/**
* Returns whether or not this instance matches the given spec.
*
- * @param spec non-null; the spec in question
- * @return <code>true</code> iff this instance matches
- * <code>spec</code>
+ * @param spec {@code non-null;} the spec in question
+ * @return {@code true} iff this instance matches
+ * {@code spec}
*/
public boolean matches(RegisterSpec otherSpec) {
return spec.equalsUsingSimpleType(otherSpec);
@@ -290,9 +290,9 @@
* Returns whether or not this instance matches the spec in
* the given instance.
*
- * @param other non-null; another entry
- * @return <code>true</code> iff this instance's spec matches
- * <code>other</code>
+ * @param other {@code non-null;} another entry
+ * @return {@code true} iff this instance's spec matches
+ * {@code other}
*/
public boolean matches(Entry other) {
return matches(other.spec);
@@ -302,8 +302,8 @@
* Returns an instance just like this one but with the disposition
* set as given
*
- * @param disposition non-null; the new disposition
- * @return non-null; an appropriately-constructed instance
+ * @param disposition {@code non-null;} the new disposition
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Entry withDisposition(Disposition disposition) {
if (disposition == this.disposition) {
@@ -318,8 +318,8 @@
* Constructs an instance for the given method, based on the given
* block order and intermediate local information.
*
- * @param insns non-null; instructions to convert
- * @return non-null; the constructed list
+ * @param insns {@code non-null;} instructions to convert
+ * @return {@code non-null;} the constructed list
*/
public static LocalList make(DalvInsnList insns) {
int sz = insns.size();
@@ -453,26 +453,26 @@
* Intermediate state when constructing a local list.
*/
public static class MakeState {
- /** non-null; result being collected */
+ /** {@code non-null;} result being collected */
private final ArrayList<Entry> result;
/**
- * >= 0; running count of nulled result entries, to help with
+ * {@code >= 0;} running count of nulled result entries, to help with
* sizing the final list
*/
private int nullResultCount;
- /** null-ok; current register mappings */
+ /** {@code null-ok;} current register mappings */
private RegisterSpecSet regs;
- /** null-ok; result indices where local ends are stored */
+ /** {@code null-ok;} result indices where local ends are stored */
private int[] endIndices;
- /** >= 0; last address seen */
+ /** {@code >= 0;} last address seen */
private int lastAddress;
/**
- * >= 0; result index where the first element for the most
+ * {@code >= 0;} result index where the first element for the most
* recent address is stored
*/
private int startIndexForAddress;
@@ -493,8 +493,8 @@
* Checks the address and other vitals as a prerequisite to
* further processing.
*
- * @param address >= 0; address about to be processed
- * @param reg >= 0; register number about to be processed
+ * @param address {@code >= 0;} address about to be processed
+ * @param reg {@code >= 0;} register number about to be processed
*/
private void aboutToProcess(int address, int reg) {
boolean first = (endIndices == null);
@@ -535,8 +535,8 @@
* The first call on this instance must be to this method, so that
* the register state can be properly sized.
*
- * @param address >= 0; the address
- * @param specs non-null; spec set representing the locals
+ * @param address {@code >= 0;} the address
+ * @param specs {@code non-null;} spec set representing the locals
*/
public void snapshot(int address, RegisterSpecSet specs) {
int sz = specs.getMaxSize();
@@ -562,8 +562,8 @@
/**
* Starts a local at the given address.
*
- * @param address >= 0; the address
- * @param startedLocal non-null; spec representing the started local
+ * @param address {@code >= 0;} the address
+ * @param startedLocal {@code non-null;} spec representing the started local
*/
public void startLocal(int address, RegisterSpec startedLocal) {
int regNum = startedLocal.getReg();
@@ -679,8 +679,8 @@
/**
* Ends a local at the given address.
*
- * @param address >= 0; the address
- * @param endedLocal non-null; spec representing the local being ended
+ * @param address {@code >= 0;} the address
+ * @param endedLocal {@code non-null;} spec representing the local being ended
*/
public void endLocal(int address, RegisterSpec endedLocal) {
int regNum = endedLocal.getReg();
@@ -715,8 +715,8 @@
* if needed update the newly-active end to reflect an altered
* disposition.
*
- * @param address >= 0; the address
- * @param endedLocal non-null; spec representing the local being ended
+ * @param address {@code >= 0;} the address
+ * @param endedLocal {@code non-null;} spec representing the local being ended
* @return {@code true} iff this method found the case in question
* and adjusted things accordingly
*/
@@ -798,8 +798,8 @@
* goal of not representing known nulls in a locals list, but
* it gets the job done.</p>
*
- * @param orig null-ok; the original spec
- * @return null-ok; an appropriately modified spec, or the
+ * @param orig {@code null-ok;} the original spec
+ * @return {@code null-ok;} an appropriately modified spec, or the
* original if nothing needs to be done
*/
private static RegisterSpec filterSpec(RegisterSpec orig) {
@@ -814,9 +814,9 @@
* Adds an entry to the result, updating the adjunct tables
* accordingly.
*
- * @param address >= 0; the address
- * @param disposition non-null; the disposition
- * @param spec non-null; spec representing the local
+ * @param address {@code >= 0;} the address
+ * @param disposition {@code non-null;} the disposition
+ * @param spec {@code non-null;} spec representing the local
*/
private void add(int address, Disposition disposition,
RegisterSpec spec) {
@@ -836,9 +836,9 @@
/**
* Adds or updates an end local (changing its disposition).
*
- * @param address >= 0; the address
- * @param disposition non-null; the disposition
- * @param spec non-null; spec representing the local
+ * @param address {@code >= 0;} the address
+ * @param disposition {@code non-null;} the disposition
+ * @param spec {@code non-null;} spec representing the local
*/
private void addOrUpdateEnd(int address, Disposition disposition,
RegisterSpec spec) {
@@ -865,7 +865,7 @@
/**
* Finishes processing altogether and gets the result.
*
- * @return non-null; the result list
+ * @return {@code non-null;} the result list
*/
public LocalList finish() {
aboutToProcess(Integer.MAX_VALUE, 0);
diff --git a/dx/src/com/android/dx/dex/code/LocalSnapshot.java b/dx/src/com/android/dx/dex/code/LocalSnapshot.java
index 19a9baa..409ad15 100644
--- a/dx/src/com/android/dx/dex/code/LocalSnapshot.java
+++ b/dx/src/com/android/dx/dex/code/LocalSnapshot.java
@@ -27,15 +27,15 @@
* the instance in an instruction array.
*/
public final class LocalSnapshot extends ZeroSizeInsn {
- /** non-null; local state associated with this instance */
+ /** {@code non-null;} local state associated with this instance */
private final RegisterSpecSet locals;
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param locals non-null; associated local variable state
+ * @param position {@code non-null;} source position
+ * @param locals {@code non-null;} associated local variable state
*/
public LocalSnapshot(SourcePosition position, RegisterSpecSet locals) {
super(position);
@@ -62,7 +62,7 @@
/**
* Gets the local state associated with this instance.
*
- * @return non-null; the state
+ * @return {@code non-null;} the state
*/
public RegisterSpecSet getLocals() {
return locals;
diff --git a/dx/src/com/android/dx/dex/code/LocalStart.java b/dx/src/com/android/dx/dex/code/LocalStart.java
index 22e20f8..ec70e30 100644
--- a/dx/src/com/android/dx/dex/code/LocalStart.java
+++ b/dx/src/com/android/dx/dex/code/LocalStart.java
@@ -28,7 +28,7 @@
*/
public final class LocalStart extends ZeroSizeInsn {
/**
- * non-null; register spec representing the local variable introduced
+ * {@code non-null;} register spec representing the local variable introduced
* by this instance
*/
private final RegisterSpec local;
@@ -36,8 +36,8 @@
/**
* Returns the local variable listing string for a single register spec.
*
- * @param spec non-null; the spec to convert
- * @return non-null; the string form
+ * @param spec {@code non-null;} the spec to convert
+ * @return {@code non-null;} the string form
*/
public static String localString(RegisterSpec spec) {
return spec.regString() + ' ' + spec.getLocalItem().toString() + ": " +
@@ -46,10 +46,10 @@
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param local non-null; register spec representing the local
+ * @param position {@code non-null;} source position
+ * @param local {@code non-null;} register spec representing the local
* variable introduced by this instance
*/
public LocalStart(SourcePosition position, RegisterSpec local) {
@@ -78,7 +78,7 @@
* Gets the register spec representing the local variable introduced
* by this instance.
*
- * @return non-null; the register spec
+ * @return {@code non-null;} the register spec
*/
public RegisterSpec getLocal() {
return local;
diff --git a/dx/src/com/android/dx/dex/code/OddSpacer.java b/dx/src/com/android/dx/dex/code/OddSpacer.java
index f99df36..727def0 100644
--- a/dx/src/com/android/dx/dex/code/OddSpacer.java
+++ b/dx/src/com/android/dx/dex/code/OddSpacer.java
@@ -21,7 +21,7 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Pseudo-instruction which either turns into a <code>nop</code> or
+ * Pseudo-instruction which either turns into a {@code nop} or
* nothingness, in order to make the subsequent instruction have an
* even address. This is used to align (subsequent) instructions that
* require it.
@@ -29,9 +29,9 @@
public final class OddSpacer extends VariableSizeInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
+ * @param position {@code non-null;} source position
*/
public OddSpacer(SourcePosition position) {
super(position, RegisterSpecList.EMPTY);
diff --git a/dx/src/com/android/dx/dex/code/OutputCollector.java b/dx/src/com/android/dx/dex/code/OutputCollector.java
index 98d8a9c..2643373 100644
--- a/dx/src/com/android/dx/dex/code/OutputCollector.java
+++ b/dx/src/com/android/dx/dex/code/OutputCollector.java
@@ -28,13 +28,13 @@
*/
public final class OutputCollector {
/**
- * non-null; the associated finisher (which holds the instruction
+ * {@code non-null;} the associated finisher (which holds the instruction
* list in-progress)
*/
private final OutputFinisher finisher;
/**
- * null-ok; suffix for the output, or <code>null</code> if the suffix
+ * {@code null-ok;} suffix for the output, or {@code null} if the suffix
* has been appended to the main output (by {@link #appendSuffixToOutput})
*/
private ArrayList<DalvInsn> suffix;
@@ -42,10 +42,10 @@
/**
* Constructs an instance.
*
- * @param initialCapacity >= 0; initial capacity of the output list
- * @param suffixInitialCapacity >= 0; initial capacity of the output
+ * @param initialCapacity {@code >= 0;} initial capacity of the output list
+ * @param suffixInitialCapacity {@code >= 0;} initial capacity of the output
* suffix
- * @param regCount >= 0; register count for the method
+ * @param regCount {@code >= 0;} register count for the method
*/
public OutputCollector(int initialCapacity, int suffixInitialCapacity,
int regCount) {
@@ -56,7 +56,7 @@
/**
* Adds an instruction to the output.
*
- * @param insn non-null; the instruction to add
+ * @param insn {@code non-null;} the instruction to add
*/
public void add(DalvInsn insn) {
finisher.add(insn);
@@ -68,9 +68,9 @@
* indicated instruction really is a reversible branch.
*
* @param which how many instructions back to find the branch;
- * <code>0</code> is the most recently added instruction,
- * <code>1</code> is the instruction before that, etc.
- * @param newTarget non-null; the new target for the reversed branch
+ * {@code 0} is the most recently added instruction,
+ * {@code 1} is the instruction before that, etc.
+ * @param newTarget {@code non-null;} the new target for the reversed branch
*/
public void reverseBranch(int which, CodeAddress newTarget) {
finisher.reverseBranch(which, newTarget);
@@ -79,7 +79,7 @@
/**
* Adds an instruction to the output suffix.
*
- * @param insn non-null; the instruction to add
+ * @param insn {@code non-null;} the instruction to add
*/
public void addSuffix(DalvInsn insn) {
suffix.add(insn);
@@ -89,7 +89,7 @@
* Gets the results of all the calls on this instance, in the form of
* an {@link OutputFinisher}.
*
- * @return non-null; the output finisher
+ * @return {@code non-null;} the output finisher
* @throws UnsupportedOperationException if this method has
* already been called
*/
diff --git a/dx/src/com/android/dx/dex/code/OutputFinisher.java b/dx/src/com/android/dx/dex/code/OutputFinisher.java
index 73eecf8..5b1d533 100644
--- a/dx/src/com/android/dx/dex/code/OutputFinisher.java
+++ b/dx/src/com/android/dx/dex/code/OutputFinisher.java
@@ -37,12 +37,12 @@
*/
public final class OutputFinisher {
/**
- * >= 0; register count for the method, not including any extra
+ * {@code >= 0;} register count for the method, not including any extra
* "reserved" registers needed to translate "difficult" instructions
*/
private final int unreservedRegCount;
- /** non-null; the list of instructions, per se */
+ /** {@code non-null;} the list of instructions, per se */
private ArrayList<DalvInsn> insns;
/** whether any instruction has position info */
@@ -52,7 +52,7 @@
private boolean hasAnyLocalInfo;
/**
- * >= 0; the count of reserved registers (low-numbered
+ * {@code >= 0;} the count of reserved registers (low-numbered
* registers used when expanding instructions that can't be
* represented simply); becomes valid after a call to {@link
* #massageInstructions}
@@ -62,8 +62,8 @@
/**
* Constructs an instance. It initially contains no instructions.
*
- * @param regCount >= 0; register count for the method
- * @param initialCapacity >= 0; initial capacity of the instructions
+ * @param regCount {@code >= 0;} register count for the method
+ * @param initialCapacity {@code >= 0;} initial capacity of the instructions
* list
*/
public OutputFinisher(int initialCapacity, int regCount) {
@@ -98,8 +98,8 @@
* Helper for {@link #add} which scrutinizes a single
* instruction for local variable information.
*
- * @param insn non-null; instruction to scrutinize
- * @return <code>true</code> iff the instruction refers to any
+ * @param insn {@code non-null;} instruction to scrutinize
+ * @return {@code true} iff the instruction refers to any
* named locals
*/
private static boolean hasLocalInfo(DalvInsn insn) {
@@ -125,8 +125,8 @@
* Helper for {@link #hasAnyLocalInfo} which scrutinizes a single
* register spec.
*
- * @param spec non-null; spec to scrutinize
- * @return <code>true</code> iff the spec refers to any
+ * @param spec {@code non-null;} spec to scrutinize
+ * @return {@code true} iff the spec refers to any
* named locals
*/
private static boolean hasLocalInfo(RegisterSpec spec) {
@@ -138,7 +138,7 @@
* Returns the set of all constants referred to by instructions added
* to this instance.
*
- * @return non-null; the set of constants
+ * @return {@code non-null;} the set of constants
*/
public HashSet<Constant> getAllConstants() {
HashSet<Constant> result = new HashSet<Constant>(20);
@@ -154,8 +154,8 @@
* Helper for {@link #getAllConstants} which adds all the info for
* a single instruction.
*
- * @param result non-null; result set to add to
- * @param insn non-null; instruction to scrutinize
+ * @param result {@code non-null;} result set to add to
+ * @param insn {@code non-null;} instruction to scrutinize
*/
private static void addConstants(HashSet<Constant> result,
DalvInsn insn) {
@@ -176,10 +176,10 @@
/**
* Helper for {@link #getAllConstants} which adds all the info for
- * a single <code>RegisterSpec</code>.
+ * a single {@code RegisterSpec}.
*
- * @param result non-null; result set to add to
- * @param spec null-ok; register spec to add
+ * @param result {@code non-null;} result set to add to
+ * @param spec {@code null-ok;} register spec to add
*/
private static void addConstants(HashSet<Constant> result,
RegisterSpec spec) {
@@ -208,7 +208,7 @@
/**
* Adds an instruction to the output.
*
- * @param insn non-null; the instruction to add
+ * @param insn {@code non-null;} the instruction to add
*/
public void add(DalvInsn insn) {
insns.add(insn);
@@ -218,8 +218,8 @@
/**
* Inserts an instruction in the output at the given offset.
*
- * @param at >= 0; what index to insert at
- * @param insn non-null; the instruction to insert
+ * @param at {@code >= 0;} what index to insert at
+ * @param insn {@code non-null;} the instruction to insert
*/
public void insert(int at, DalvInsn insn) {
insns.add(at, insn);
@@ -230,7 +230,7 @@
* Helper for {@link #add} and {@link #insert},
* which updates the position and local info flags.
*
- * @param insn non-null; an instruction that was just introduced
+ * @param insn {@code non-null;} an instruction that was just introduced
*/
private void updateInfo(DalvInsn insn) {
if (! hasAnyPositionInfo) {
@@ -253,9 +253,9 @@
* indicated instruction really is a reversible branch.
*
* @param which how many instructions back to find the branch;
- * <code>0</code> is the most recently added instruction,
- * <code>1</code> is the instruction before that, etc.
- * @param newTarget non-null; the new target for the reversed branch
+ * {@code 0} is the most recently added instruction,
+ * {@code 1} is the instruction before that, etc.
+ * @param newTarget {@code non-null;} the new target for the reversed branch
*/
public void reverseBranch(int which, CodeAddress newTarget) {
int size = insns.size();
@@ -284,7 +284,7 @@
* given callback to perform lookups. This should be called before
* calling {@link #finishProcessingAndGetList}.
*
- * @param callback non-null; callback object
+ * @param callback {@code non-null;} callback object
*/
public void assignIndices(DalvCode.AssignIndicesCallback callback) {
for (DalvInsn insn : insns) {
@@ -298,8 +298,8 @@
* Helper for {@link #assignIndices} which does assignment for one
* instruction.
*
- * @param insn non-null; the instruction
- * @param callback non-null; the callback
+ * @param insn {@code non-null;} the instruction
+ * @param callback {@code non-null;} the callback
*/
private static void assignIndices(CstInsn insn,
DalvCode.AssignIndicesCallback callback) {
@@ -336,7 +336,7 @@
* <p><b>Note:</b> This method may only be called once per instance
* of this class.</p>
*
- * @return non-null; the output list
+ * @return {@code non-null;} the output list
* @throws UnsupportedOperationException if this method has
* already been called
*/
@@ -359,7 +359,7 @@
* the format out of each instruction into a separate array, to be
* further manipulated as things progress.
*
- * @return non-null; the array of formats
+ * @return {@code non-null;} the array of formats
*/
private InsnFormat[] makeFormatsArray() {
int size = insns.size();
@@ -375,11 +375,11 @@
/**
* Helper for {@link #finishProcessingAndGetList}, which figures
* out how many reserved registers are required and then reserving
- * them. It also updates the given <code>formats</code> array so
+ * them. It also updates the given {@code formats} array so
* as to avoid extra work when constructing the massaged
* instruction list.
*
- * @param formats non-null; array of per-instruction format selections
+ * @param formats {@code non-null;} array of per-instruction format selections
*/
private void reserveRegisters(InsnFormat[] formats) {
int oldReservedCount = (reservedCount < 0) ? 0 : reservedCount;
@@ -425,11 +425,11 @@
* Helper for {@link #reserveRegisters}, which does one
* pass over the instructions, calculating the number of
* registers that need to be reserved. It also updates the
- * <code>formats</code> list to help avoid extra work in future
+ * {@code formats} list to help avoid extra work in future
* register reservation passes.
*
- * @param formats non-null; array of per-instruction format selections
- * @return >= 0; the count of reserved registers
+ * @param formats {@code non-null;} array of per-instruction format selections
+ * @return {@code >= 0;} the count of reserved registers
*/
private int calculateReservedCount(InsnFormat[] formats) {
int size = insns.size();
@@ -470,16 +470,16 @@
/**
* Attempts to fit the given instruction into a format, returning
- * either a format that the instruction fits into or <code>null</code>
+ * either a format that the instruction fits into or {@code null}
* to indicate that the instruction will need to be expanded. This
* fitting process starts with the given format as a first "best
* guess" and then pessimizes from there if necessary.
*
- * @param insn non-null; the instruction in question
- * @param format null-ok; the current guess as to the best instruction
- * format to use; <code>null</code> means that no simple format fits
- * @return null-ok; a possibly-different format, which is either a
- * good fit or <code>null</code> to indicate that no simple format
+ * @param insn {@code non-null;} the instruction in question
+ * @param format {@code null-ok;} the current guess as to the best instruction
+ * format to use; {@code null} means that no simple format fits
+ * @return {@code null-ok;} a possibly-different format, which is either a
+ * good fit or {@code null} to indicate that no simple format
* fits
*/
private InsnFormat findFormatForInsn(DalvInsn insn, InsnFormat format) {
@@ -527,7 +527,7 @@
* final addresses aren't known at the point that this method is
* called.</p>
*
- * @param formats non-null; array of per-instruction format selections
+ * @param formats {@code non-null;} array of per-instruction format selections
*/
private void massageInstructions(InsnFormat[] formats) {
if (reservedCount == 0) {
@@ -566,8 +566,8 @@
* problems) is expanded into a series of instances that together
* perform the proper function.
*
- * @param formats non-null; array of per-instruction format selections
- * @return non-null; the replacement list
+ * @param formats {@code non-null;} array of per-instruction format selections
+ * @return {@code non-null;} the replacement list
*/
private ArrayList<DalvInsn> performExpansion(InsnFormat[] formats) {
int size = insns.size();
@@ -651,9 +651,9 @@
* Helper for {@link #assignAddressesAndFixBranches}, which checks
* the branch target size requirement of each branch instruction
* to make sure it fits. For instructions that don't fit, this
- * rewrites them to use a <code>goto</code> of some sort. In the
+ * rewrites them to use a {@code goto} of some sort. In the
* case of a conditional branch that doesn't fit, the sense of the
- * test is reversed in order to branch around a <code>goto</code>
+ * test is reversed in order to branch around a {@code goto}
* to the original target.
*
* @return whether any branches had to be fixed
diff --git a/dx/src/com/android/dx/dex/code/PositionList.java b/dx/src/com/android/dx/dex/code/PositionList.java
index d8f76eb..41e3667 100644
--- a/dx/src/com/android/dx/dex/code/PositionList.java
+++ b/dx/src/com/android/dx/dex/code/PositionList.java
@@ -24,7 +24,7 @@
* method to extract an instance out of a {@link DalvInsnList}.
*/
public final class PositionList extends FixedSizeList {
- /** non-null; empty instance */
+ /** {@code non-null;} empty instance */
public static final PositionList EMPTY = new PositionList(0);
/**
@@ -50,10 +50,10 @@
* Extracts and returns the source position information out of an
* instruction list.
*
- * @param insns non-null; instructions to convert
+ * @param insns {@code non-null;} instructions to convert
* @param howMuch how much information should be included; one of the
* static constants defined by this class
- * @return non-null; the positions list
+ * @return {@code non-null;} the positions list
*/
public static PositionList make(DalvInsnList insns, int howMuch) {
switch (howMuch) {
@@ -112,9 +112,9 @@
}
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
- * @param size >= 0; the size of the list
+ * @param size {@code >= 0;} the size of the list
*/
public PositionList(int size) {
super(size);
@@ -123,10 +123,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Entry get(int n) {
return (Entry) get0(n);
@@ -135,8 +135,8 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 0, < size(); which index
- * @param entry non-null; the entry to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param entry {@code non-null;} the entry to set at {@code n}
*/
public void set(int n, Entry entry) {
set0(n, entry);
@@ -146,17 +146,17 @@
* Entry in a position list.
*/
public static class Entry {
- /** >= 0; address of this entry */
+ /** {@code >= 0;} address of this entry */
private final int address;
- /** non-null; corresponding source position information */
+ /** {@code non-null;} corresponding source position information */
private final SourcePosition position;
/**
* Constructs an instance.
*
- * @param address >= 0; address of this entry
- * @param position non-null; corresponding source position information
+ * @param address {@code >= 0;} address of this entry
+ * @param position {@code non-null;} corresponding source position information
*/
public Entry (int address, SourcePosition position) {
if (address < 0) {
@@ -174,7 +174,7 @@
/**
* Gets the address.
*
- * @return >= 0; the address
+ * @return {@code >= 0;} the address
*/
public int getAddress() {
return address;
@@ -183,7 +183,7 @@
/**
* Gets the source position information.
*
- * @return non-null; the position information
+ * @return {@code non-null;} the position information
*/
public SourcePosition getPosition() {
return position;
diff --git a/dx/src/com/android/dx/dex/code/RopToDop.java b/dx/src/com/android/dx/dex/code/RopToDop.java
index 8ad0e64..0385467 100644
--- a/dx/src/com/android/dx/dex/code/RopToDop.java
+++ b/dx/src/com/android/dx/dex/code/RopToDop.java
@@ -35,7 +35,7 @@
* {@link Dop} instances.
*/
public final class RopToDop {
- /** non-null; map from all the common rops to dalvik opcodes */
+ /** {@code non-null;} map from all the common rops to dalvik opcodes */
private static final HashMap<Rop, Dop> MAP;
/**
@@ -278,7 +278,7 @@
* Returns the dalvik opcode appropriate for the given register-based
* instruction.
*
- * @param insn non-null; the original instruction
+ * @param insn {@code non-null;} the original instruction
* @return the corresponding dalvik opcode; one of the constants in
* {@link Dops}
*/
diff --git a/dx/src/com/android/dx/dex/code/RopTranslator.java b/dx/src/com/android/dx/dex/code/RopTranslator.java
index f3dfe0b..9f47b13 100644
--- a/dx/src/com/android/dx/dex/code/RopTranslator.java
+++ b/dx/src/com/android/dx/dex/code/RopTranslator.java
@@ -46,7 +46,7 @@
* #translate} method is the thing to call on this class.
*/
public final class RopTranslator {
- /** non-null; method to translate */
+ /** {@code non-null;} method to translate */
private final RopMethod method;
/**
@@ -55,22 +55,22 @@
*/
private final int positionInfo;
- /** null-ok; local variable info to use */
+ /** {@code null-ok;} local variable info to use */
private final LocalVariableInfo locals;
- /** non-null; container for all the address objects for the method */
+ /** {@code non-null;} container for all the address objects for the method */
private final BlockAddresses addresses;
- /** non-null; list of output instructions in-progress */
+ /** {@code non-null;} list of output instructions in-progress */
private final OutputCollector output;
- /** non-null; visitor to use during translation */
+ /** {@code non-null;} visitor to use during translation */
private final TranslationVisitor translationVisitor;
- /** >= 0; register count for the method */
+ /** {@code >= 0;} register count for the method */
private final int regCount;
- /** null-ok; block output order; becomes non-null in {@link #pickOrder} */
+ /** {@code null-ok;} block output order; becomes non-null in {@link #pickOrder} */
private int[] order;
/** size, in register units, of all the parameters to this method */
@@ -86,13 +86,13 @@
* Translates a {@link RopMethod}. This may modify the given
* input.
*
- * @param method non-null; the original method
+ * @param method {@code non-null;} the original method
* @param positionInfo how much position info to preserve; one of the
* static constants in {@link PositionList}
- * @param locals null-ok; local variable information to use
+ * @param locals {@code null-ok;} local variable information to use
* @param paramSize size, in register units, of all the parameters to
* this method
- * @return non-null; the translated version
+ * @return {@code non-null;} the translated version
*/
public static DalvCode translate(RopMethod method, int positionInfo,
LocalVariableInfo locals, int paramSize) {
@@ -105,10 +105,10 @@
/**
* Constructs an instance. This method is private. Use {@link #translate}.
*
- * @param method non-null; the original method
+ * @param method {@code non-null;} the original method
* @param positionInfo how much position info to preserve; one of the
* static constants in {@link PositionList}
- * @param locals null-ok; local variable information to use
+ * @param locals {@code null-ok;} local variable information to use
* @param paramSize size, in register units, of all the parameters to
* this method
*/
@@ -177,7 +177,7 @@
/*
* We almost could just check the first block here, but the
- * <code>cf</code> layer will put in a second move-param in a
+ * {@code cf} layer will put in a second move-param in a
* subsequent block in the case of synchronized methods.
*/
method.getBlocks().forEachInsn(new Insn.BaseVisitor() {
@@ -199,7 +199,7 @@
/**
* Does the translation and returns the result.
*
- * @return non-null; the result
+ * @return {@code non-null;} the result
*/
private DalvCode translateAndGetResult() {
pickOrder();
@@ -232,9 +232,9 @@
* Helper for {@link #outputInstructions}, which does the processing
* and output of one block.
*
- * @param block non-null; the block to process and output
- * @param nextLabel >= -1; the next block that will be processed, or
- * <code>-1</code> if there is no next block
+ * @param block {@code non-null;} the block to process and output
+ * @param nextLabel {@code >= -1;} the next block that will be processed, or
+ * {@code -1} if there is no next block
*/
private void outputBlock(BasicBlock block, int nextLabel) {
// Append the code address for this block.
@@ -440,8 +440,8 @@
* two register sources, and have a source equal to the result,
* place that source first.
*
- * @param insn non-null; instruction in question
- * @return non-null; the instruction's complete register list
+ * @param insn {@code non-null;} instruction in question
+ * @return {@code non-null;} the instruction's complete register list
*/
private static RegisterSpecList getRegs(Insn insn) {
return getRegs(insn, insn.getResult());
@@ -453,9 +453,9 @@
* two register sources, and have a source equal to the result,
* place that source first.
*
- * @param insn non-null; instruction in question
- * @param resultReg null-ok; the real result to use (ignore the insn's)
- * @return non-null; the instruction's complete register list
+ * @param insn {@code non-null;} instruction in question
+ * @param resultReg {@code null-ok;} the real result to use (ignore the insn's)
+ * @return {@code non-null;} the instruction's complete register list
*/
private static RegisterSpecList getRegs(Insn insn,
RegisterSpec resultReg) {
@@ -486,14 +486,14 @@
* Instruction visitor class for doing the instruction translation per se.
*/
private class TranslationVisitor implements Insn.Visitor {
- /** non-null; list of output instructions in-progress */
+ /** {@code non-null;} list of output instructions in-progress */
private final OutputCollector output;
- /** non-null; basic block being worked on */
+ /** {@code non-null;} basic block being worked on */
private BasicBlock block;
/**
- * null-ok; code address for the salient last instruction of the
+ * {@code null-ok;} code address for the salient last instruction of the
* block (used before switches and throwing instructions)
*/
private CodeAddress lastAddress;
@@ -501,7 +501,7 @@
/**
* Constructs an instance.
*
- * @param output non-null; destination for instruction output
+ * @param output {@code non-null;} destination for instruction output
*/
public TranslationVisitor(OutputCollector output) {
this.output = output;
@@ -510,8 +510,8 @@
/**
* Sets the block currently being worked on.
*
- * @param block non-null; the block
- * @param lastAddress non-null; code address for the salient
+ * @param block {@code non-null;} the block
+ * @param lastAddress {@code non-null;} code address for the salient
* last instruction of the block
*/
public void setBlock(BasicBlock block, CodeAddress lastAddress) {
@@ -654,7 +654,7 @@
* the RegisterSpec of the result of the move-result-pseudo at the
* top of that block or null if none.
*
- * @return null-ok; result of move-result-pseudo at the beginning of
+ * @return {@code null-ok;} result of move-result-pseudo at the beginning of
* primary successor
*/
private RegisterSpec getNextMoveResultPseudo()
@@ -783,7 +783,7 @@
/**
* Adds to the output.
*
- * @param insn non-null; instruction to add
+ * @param insn {@code non-null;} instruction to add
*/
protected void addOutput(DalvInsn insn) {
output.add(insn);
@@ -792,7 +792,7 @@
/**
* Adds to the output suffix.
*
- * @param insn non-null; instruction to add
+ * @param insn {@code non-null;} instruction to add
*/
protected void addOutputSuffix(DalvInsn insn) {
output.addSuffix(insn);
@@ -805,14 +805,14 @@
*/
private class LocalVariableAwareTranslationVisitor
extends TranslationVisitor {
- /** non-null; local variable info */
+ /** {@code non-null;} local variable info */
private LocalVariableInfo locals;
/**
* Constructs an instance.
*
- * @param output non-null; destination for instruction output
- * @param locals non-null; the local variable info
+ * @param output {@code non-null;} destination for instruction output
+ * @param locals {@code non-null;} the local variable info
*/
public LocalVariableAwareTranslationVisitor(OutputCollector output,
LocalVariableInfo locals) {
@@ -859,7 +859,7 @@
* Adds a {@link LocalStart} to the output if the given
* instruction in fact introduces a local variable.
*
- * @param insn non-null; instruction in question
+ * @param insn {@code non-null;} instruction in question
*/
public void addIntroductionIfNecessary(Insn insn) {
RegisterSpec spec = locals.getAssignment(insn);
diff --git a/dx/src/com/android/dx/dex/code/SimpleInsn.java b/dx/src/com/android/dx/dex/code/SimpleInsn.java
index ba20409..5e7b259 100644
--- a/dx/src/com/android/dx/dex/code/SimpleInsn.java
+++ b/dx/src/com/android/dx/dex/code/SimpleInsn.java
@@ -26,11 +26,11 @@
public final class SimpleInsn extends FixedSizeInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
* @param opcode the opcode; one of the constants from {@link Dops}
- * @param position non-null; source position
- * @param registers non-null; register list, including a
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins or outs)
*/
diff --git a/dx/src/com/android/dx/dex/code/StdCatchBuilder.java b/dx/src/com/android/dx/dex/code/StdCatchBuilder.java
index 1240f3f..23e25aa 100644
--- a/dx/src/com/android/dx/dex/code/StdCatchBuilder.java
+++ b/dx/src/com/android/dx/dex/code/StdCatchBuilder.java
@@ -35,22 +35,22 @@
/** the maximum range of a single catch handler, in code units */
private static final int MAX_CATCH_RANGE = 65535;
- /** non-null; method to build the list for */
+ /** {@code non-null;} method to build the list for */
private final RopMethod method;
- /** non-null; block output order */
+ /** {@code non-null;} block output order */
private final int[] order;
- /** non-null; address objects for each block */
+ /** {@code non-null;} address objects for each block */
private final BlockAddresses addresses;
/**
* Constructs an instance. It merely holds onto its parameters for
* a subsequent call to {@link #build}.
*
- * @param method non-null; method to build the list for
- * @param order non-null; block output order
- * @param addresses non-null; address objects for each block
+ * @param method {@code non-null;} method to build the list for
+ * @param order {@code non-null;} block output order
+ * @param addresses {@code non-null;} address objects for each block
*/
public StdCatchBuilder(RopMethod method, int[] order,
BlockAddresses addresses) {
@@ -115,10 +115,10 @@
/**
* Builds and returns the catch table for a given method.
*
- * @param method non-null; method to build the list for
- * @param order non-null; block output order
- * @param addresses non-null; address objects for each block
- * @return non-null; the constructed table
+ * @param method {@code non-null;} method to build the list for
+ * @param order {@code non-null;} block output order
+ * @param addresses {@code non-null;} address objects for each block
+ * @return {@code non-null;} the constructed table
*/
public static CatchTable build(RopMethod method, int[] order,
BlockAddresses addresses) {
@@ -210,9 +210,9 @@
/**
* Makes the {@link CatchHandlerList} for the given basic block.
*
- * @param block non-null; block to get entries for
- * @param addresses non-null; address objects for each block
- * @return non-null; array of entries
+ * @param block {@code non-null;} block to get entries for
+ * @param addresses {@code non-null;} address objects for each block
+ * @return {@code non-null;} array of entries
*/
private static CatchHandlerList handlersFor(BasicBlock block,
BlockAddresses addresses) {
@@ -267,10 +267,10 @@
* Makes a {@link CatchTable#Entry} for the given block range and
* handlers.
*
- * @param start non-null; the start block for the range (inclusive)
- * @param end non-null; the start block for the range (also inclusive)
- * @param handlers non-null; the handlers for the range
- * @param addresses non-null; address objects for each block
+ * @param start {@code non-null;} the start block for the range (inclusive)
+ * @param end {@code non-null;} the start block for the range (also inclusive)
+ * @param handlers {@code non-null;} the handlers for the range
+ * @param addresses {@code non-null;} address objects for each block
*/
private static CatchTable.Entry makeEntry(BasicBlock start,
BasicBlock end, CatchHandlerList handlers,
@@ -293,10 +293,10 @@
* for a catch handler. This is true as long as the covered range is
* under 65536 code units.
*
- * @param start non-null; the start block for the range (inclusive)
- * @param end non-null; the start block for the range (also inclusive)
- * @param addresses non-null; address objects for each block
- * @return <code>true</code> if the range is valid as a catch range
+ * @param start {@code non-null;} the start block for the range (inclusive)
+ * @param end {@code non-null;} the start block for the range (also inclusive)
+ * @param addresses {@code non-null;} address objects for each block
+ * @return {@code true} if the range is valid as a catch range
*/
private static boolean rangeIsValid(BasicBlock start, BasicBlock end,
BlockAddresses addresses) {
diff --git a/dx/src/com/android/dx/dex/code/SwitchData.java b/dx/src/com/android/dx/dex/code/SwitchData.java
index 1aaafa9..e5a8da4 100644
--- a/dx/src/com/android/dx/dex/code/SwitchData.java
+++ b/dx/src/com/android/dx/dex/code/SwitchData.java
@@ -29,16 +29,16 @@
*/
public final class SwitchData extends VariableSizeInsn {
/**
- * non-null; address representing the instruction that uses this
+ * {@code non-null;} address representing the instruction that uses this
* instance
*/
private final CodeAddress user;
- /** non-null; sorted list of switch cases (keys) */
+ /** {@code non-null;} sorted list of switch cases (keys) */
private final IntList cases;
/**
- * non-null; corresponding list of code addresses; the branch
+ * {@code non-null;} corresponding list of code addresses; the branch
* target for each case
*/
private final CodeAddress[] targets;
@@ -48,13 +48,13 @@
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param user non-null; address representing the instruction that
+ * @param position {@code non-null;} source position
+ * @param user {@code non-null;} address representing the instruction that
* uses this instance
- * @param cases non-null; sorted list of switch cases (keys)
- * @param targets non-null; corresponding list of code addresses; the
+ * @param cases {@code non-null;} sorted list of switch cases (keys)
+ * @param targets {@code non-null;} corresponding list of code addresses; the
* branch target for each case
*/
public SwitchData(SourcePosition position, CodeAddress user,
@@ -151,7 +151,7 @@
/**
* Returns whether or not this instance's data will be output as packed.
*
- * @return <code>true</code> iff the data is to be packed
+ * @return {@code true} iff the data is to be packed
*/
public boolean isPacked() {
return packed;
@@ -202,8 +202,8 @@
* Gets the size of a packed table for the given cases, in 16-bit code
* units.
*
- * @param cases non-null; sorted list of cases
- * @return >= -1; the packed table size or <code>-1</code> if the
+ * @param cases {@code non-null;} sorted list of cases
+ * @return {@code >= -1;} the packed table size or {@code -1} if the
* cases couldn't possibly be represented as a packed table
*/
private static long packedCodeSize(IntList cases) {
@@ -219,8 +219,8 @@
* Gets the size of a sparse table for the given cases, in 16-bit code
* units.
*
- * @param cases non-null; sorted list of cases
- * @return > 0; the sparse table size
+ * @param cases {@code non-null;} sorted list of cases
+ * @return {@code > 0;} the sparse table size
*/
private static long sparseCodeSize(IntList cases) {
int sz = cases.size();
@@ -231,8 +231,8 @@
/**
* Determines whether the given list of cases warrant being packed.
*
- * @param cases non-null; sorted list of cases
- * @return <code>true</code> iff the table encoding the cases
+ * @param cases {@code non-null;} sorted list of cases
+ * @return {@code true} iff the table encoding the cases
* should be packed
*/
private static boolean shouldPack(IntList cases) {
diff --git a/dx/src/com/android/dx/dex/code/TargetInsn.java b/dx/src/com/android/dx/dex/code/TargetInsn.java
index 5620795..0faaada 100644
--- a/dx/src/com/android/dx/dex/code/TargetInsn.java
+++ b/dx/src/com/android/dx/dex/code/TargetInsn.java
@@ -23,20 +23,20 @@
* Instruction which has a single branch target.
*/
public final class TargetInsn extends FixedSizeInsn {
- /** non-null; the branch target */
+ /** {@code non-null;} the branch target */
private CodeAddress target;
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>), and the target is initially
- * <code>null</code>.
+ * unknown ({@code -1}), and the target is initially
+ * {@code null}.
*
* @param opcode the opcode; one of the constants from {@link Dops}
- * @param position non-null; source position
- * @param registers non-null; register list, including a
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins or outs)
- * @param target non-null; the branch target
+ * @param target {@code non-null;} the branch target
*/
public TargetInsn(Dop opcode, SourcePosition position,
RegisterSpecList registers, CodeAddress target) {
@@ -64,12 +64,12 @@
/**
* Returns an instance that is just like this one, except that its
* opcode has the opposite sense (as a test; e.g. a
- * <code>lt</code> test becomes a <code>ge</code>), and its branch
+ * {@code lt} test becomes a {@code ge}), and its branch
* target is replaced by the one given, and all set-once values
* associated with the class (such as its address) are reset.
*
- * @param target non-null; the new branch target
- * @return non-null; an appropriately-constructed instance
+ * @param target {@code non-null;} the new branch target
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public TargetInsn withNewTargetAndReversed(CodeAddress target) {
Dop opcode = getOpcode().getOppositeTest();
@@ -80,7 +80,7 @@
/**
* Gets the unique branch target of this instruction.
*
- * @return non-null; the branch target
+ * @return {@code non-null;} the branch target
*/
public CodeAddress getTarget() {
return target;
@@ -90,9 +90,9 @@
* Gets the target address of this instruction. This is only valid
* to call if the target instruction has been assigned an address,
* and it is merely a convenient shorthand for
- * <code>getTarget().getAddress()</code>.
+ * {@code getTarget().getAddress()}.
*
- * @return >= 0; the target address
+ * @return {@code >= 0;} the target address
*/
public int getTargetAddress() {
return target.getAddress();
@@ -102,7 +102,7 @@
* Gets the branch offset of this instruction. This is only valid to
* call if both this and the target instruction each has been assigned
* an address, and it is merely a convenient shorthand for
- * <code>getTargetAddress() - getAddress()</code>.
+ * {@code getTargetAddress() - getAddress()}.
*
* @return the branch offset
*/
@@ -113,8 +113,8 @@
/**
* Returns whether the target offset is known.
*
- * @return <code>true</code> if the target offset is known or
- * <code>false</code> if not
+ * @return {@code true} if the target offset is known or
+ * {@code false} if not
*/
public boolean hasTargetOffset() {
return hasAddress() && target.hasAddress();
diff --git a/dx/src/com/android/dx/dex/code/VariableSizeInsn.java b/dx/src/com/android/dx/dex/code/VariableSizeInsn.java
index 7884249..889a50c 100644
--- a/dx/src/com/android/dx/dex/code/VariableSizeInsn.java
+++ b/dx/src/com/android/dx/dex/code/VariableSizeInsn.java
@@ -25,10 +25,10 @@
public abstract class VariableSizeInsn extends DalvInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
- * @param registers non-null; source registers
+ * @param position {@code non-null;} source position
+ * @param registers {@code non-null;} source registers
*/
public VariableSizeInsn(SourcePosition position,
RegisterSpecList registers) {
diff --git a/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java b/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java
index 2ddb181..198bebf 100644
--- a/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java
+++ b/dx/src/com/android/dx/dex/code/ZeroSizeInsn.java
@@ -28,9 +28,9 @@
public abstract class ZeroSizeInsn extends DalvInsn {
/**
* Constructs an instance. The output address of this instance is initially
- * unknown (<code>-1</code>).
+ * unknown ({@code -1}).
*
- * @param position non-null; source position
+ * @param position {@code non-null;} source position
*/
public ZeroSizeInsn(SourcePosition position) {
super(Dops.SPECIAL_FORMAT, position, RegisterSpecList.EMPTY);
diff --git a/dx/src/com/android/dx/dex/code/form/Form10t.java b/dx/src/com/android/dx/dex/code/form/Form10t.java
index 8551012..82b731d 100644
--- a/dx/src/com/android/dx/dex/code/form/Form10t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form10t.java
@@ -22,11 +22,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>10t</code>. See the instruction format spec
+ * Instruction format {@code 10t}. See the instruction format spec
* for details.
*/
public final class Form10t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form10t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form10x.java b/dx/src/com/android/dx/dex/code/form/Form10x.java
index 7dc7c43..c7a22a6 100644
--- a/dx/src/com/android/dx/dex/code/form/Form10x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form10x.java
@@ -22,11 +22,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>10x</code>. See the instruction format spec
+ * Instruction format {@code 10x}. See the instruction format spec
* for details.
*/
public final class Form10x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form10x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form11n.java b/dx/src/com/android/dx/dex/code/form/Form11n.java
index b94038b..d63fc6f 100644
--- a/dx/src/com/android/dx/dex/code/form/Form11n.java
+++ b/dx/src/com/android/dx/dex/code/form/Form11n.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>11n</code>. See the instruction format spec
+ * Instruction format {@code 11n}. See the instruction format spec
* for details.
*/
public final class Form11n extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form11n();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form11x.java b/dx/src/com/android/dx/dex/code/form/Form11x.java
index d656147..b4acc1a 100644
--- a/dx/src/com/android/dx/dex/code/form/Form11x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form11x.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>11x</code>. See the instruction format spec
+ * Instruction format {@code 11x}. See the instruction format spec
* for details.
*/
public final class Form11x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form11x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form12x.java b/dx/src/com/android/dx/dex/code/form/Form12x.java
index 3ed8ce9..c7754be 100644
--- a/dx/src/com/android/dx/dex/code/form/Form12x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form12x.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>12x</code>. See the instruction format spec
+ * Instruction format {@code 12x}. See the instruction format spec
* for details.
*/
public final class Form12x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form12x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form20t.java b/dx/src/com/android/dx/dex/code/form/Form20t.java
index 341bef3..0b5a3b2 100644
--- a/dx/src/com/android/dx/dex/code/form/Form20t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form20t.java
@@ -22,11 +22,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>20t</code>. See the instruction format spec
+ * Instruction format {@code 20t}. See the instruction format spec
* for details.
*/
public final class Form20t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form20t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form21c.java b/dx/src/com/android/dx/dex/code/form/Form21c.java
index 5695e7a..ed1ec3c 100644
--- a/dx/src/com/android/dx/dex/code/form/Form21c.java
+++ b/dx/src/com/android/dx/dex/code/form/Form21c.java
@@ -28,11 +28,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>21c</code>. See the instruction format spec
+ * Instruction format {@code 21c}. See the instruction format spec
* for details.
*/
public final class Form21c extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form21c();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form21h.java b/dx/src/com/android/dx/dex/code/form/Form21h.java
index cf4b471..e0bd751 100644
--- a/dx/src/com/android/dx/dex/code/form/Form21h.java
+++ b/dx/src/com/android/dx/dex/code/form/Form21h.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>21h</code>. See the instruction format spec
+ * Instruction format {@code 21h}. See the instruction format spec
* for details.
*/
public final class Form21h extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form21h();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form21s.java b/dx/src/com/android/dx/dex/code/form/Form21s.java
index df10f80..a03ee43 100644
--- a/dx/src/com/android/dx/dex/code/form/Form21s.java
+++ b/dx/src/com/android/dx/dex/code/form/Form21s.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>21s</code>. See the instruction format spec
+ * Instruction format {@code 21s}. See the instruction format spec
* for details.
*/
public final class Form21s extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form21s();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form21t.java b/dx/src/com/android/dx/dex/code/form/Form21t.java
index 03f2ddf..f0ce644 100644
--- a/dx/src/com/android/dx/dex/code/form/Form21t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form21t.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>21t</code>. See the instruction format spec
+ * Instruction format {@code 21t}. See the instruction format spec
* for details.
*/
public final class Form21t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form21t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form22b.java b/dx/src/com/android/dx/dex/code/form/Form22b.java
index e2a777f..2884fbb 100644
--- a/dx/src/com/android/dx/dex/code/form/Form22b.java
+++ b/dx/src/com/android/dx/dex/code/form/Form22b.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>22b</code>. See the instruction format spec
+ * Instruction format {@code 22b}. See the instruction format spec
* for details.
*/
public final class Form22b extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form22b();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form22c.java b/dx/src/com/android/dx/dex/code/form/Form22c.java
index 547eea8..e77677f 100644
--- a/dx/src/com/android/dx/dex/code/form/Form22c.java
+++ b/dx/src/com/android/dx/dex/code/form/Form22c.java
@@ -27,11 +27,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>22c</code>. See the instruction format spec
+ * Instruction format {@code 22c}. See the instruction format spec
* for details.
*/
public final class Form22c extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form22c();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form22s.java b/dx/src/com/android/dx/dex/code/form/Form22s.java
index 3ed173f..5964217 100644
--- a/dx/src/com/android/dx/dex/code/form/Form22s.java
+++ b/dx/src/com/android/dx/dex/code/form/Form22s.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>22s</code>. See the instruction format spec
+ * Instruction format {@code 22s}. See the instruction format spec
* for details.
*/
public final class Form22s extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form22s();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form22t.java b/dx/src/com/android/dx/dex/code/form/Form22t.java
index 1034b92..1577803 100644
--- a/dx/src/com/android/dx/dex/code/form/Form22t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form22t.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>22t</code>. See the instruction format spec
+ * Instruction format {@code 22t}. See the instruction format spec
* for details.
*/
public final class Form22t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form22t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form22x.java b/dx/src/com/android/dx/dex/code/form/Form22x.java
index ee91e85..b7ce4e7 100644
--- a/dx/src/com/android/dx/dex/code/form/Form22x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form22x.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>22x</code>. See the instruction format spec
+ * Instruction format {@code 22x}. See the instruction format spec
* for details.
*/
public final class Form22x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form22x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form23x.java b/dx/src/com/android/dx/dex/code/form/Form23x.java
index c0a4482..64dd6b0 100644
--- a/dx/src/com/android/dx/dex/code/form/Form23x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form23x.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>23x</code>. See the instruction format spec
+ * Instruction format {@code 23x}. See the instruction format spec
* for details.
*/
public final class Form23x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form23x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form30t.java b/dx/src/com/android/dx/dex/code/form/Form30t.java
index 32e2efa..af0a699 100644
--- a/dx/src/com/android/dx/dex/code/form/Form30t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form30t.java
@@ -22,11 +22,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>30t</code>. See the instruction format spec
+ * Instruction format {@code 30t}. See the instruction format spec
* for details.
*/
public final class Form30t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form30t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form31c.java b/dx/src/com/android/dx/dex/code/form/Form31c.java
index 5837009..0c983c5 100644
--- a/dx/src/com/android/dx/dex/code/form/Form31c.java
+++ b/dx/src/com/android/dx/dex/code/form/Form31c.java
@@ -28,11 +28,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>31c</code>. See the instruction format spec
+ * Instruction format {@code 31c}. See the instruction format spec
* for details.
*/
public final class Form31c extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form31c();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form31i.java b/dx/src/com/android/dx/dex/code/form/Form31i.java
index 2855bcb..c893a12 100644
--- a/dx/src/com/android/dx/dex/code/form/Form31i.java
+++ b/dx/src/com/android/dx/dex/code/form/Form31i.java
@@ -25,11 +25,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>31i</code>. See the instruction format spec
+ * Instruction format {@code 31i}. See the instruction format spec
* for details.
*/
public final class Form31i extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form31i();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form31t.java b/dx/src/com/android/dx/dex/code/form/Form31t.java
index 5472687..682408c 100644
--- a/dx/src/com/android/dx/dex/code/form/Form31t.java
+++ b/dx/src/com/android/dx/dex/code/form/Form31t.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>31t</code>. See the instruction format spec
+ * Instruction format {@code 31t}. See the instruction format spec
* for details.
*/
public final class Form31t extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form31t();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form32x.java b/dx/src/com/android/dx/dex/code/form/Form32x.java
index 9c52d93..4a981ee 100644
--- a/dx/src/com/android/dx/dex/code/form/Form32x.java
+++ b/dx/src/com/android/dx/dex/code/form/Form32x.java
@@ -23,11 +23,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>32x</code>. See the instruction format spec
+ * Instruction format {@code 32x}. See the instruction format spec
* for details.
*/
public final class Form32x extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form32x();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form35c.java b/dx/src/com/android/dx/dex/code/form/Form35c.java
index 6be55fc..411e3c3 100644
--- a/dx/src/com/android/dx/dex/code/form/Form35c.java
+++ b/dx/src/com/android/dx/dex/code/form/Form35c.java
@@ -28,11 +28,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>35c</code>. See the instruction format spec
+ * Instruction format {@code 35c}. See the instruction format spec
* for details.
*/
public final class Form35c extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form35c();
/** Maximal number of operands */
@@ -120,12 +120,12 @@
/**
* Gets the number of words required for the given register list, where
- * category-2 values count as two words. Return <code>-1</code> if the
+ * category-2 values count as two words. Return {@code -1} if the
* list requires more than five words or contains registers that need
* more than a nibble to identify them.
*
- * @param regs non-null; the register list in question
- * @return >= -1; the number of words required, or <code>-1</code>
+ * @param regs {@code non-null;} the register list in question
+ * @return {@code >= -1;} the number of words required, or {@code -1}
* if the list couldn't possibly fit in this format
*/
private static int wordCount(RegisterSpecList regs) {
@@ -161,8 +161,8 @@
* entries. This returns the original list if no modification is
* required
*
- * @param orig non-null; the original list
- * @return non-null; the list with the described transformation
+ * @param orig {@code non-null;} the original list
+ * @return {@code non-null;} the list with the described transformation
*/
private static RegisterSpecList explicitize(RegisterSpecList orig) {
int wordCount = wordCount(orig);
diff --git a/dx/src/com/android/dx/dex/code/form/Form3rc.java b/dx/src/com/android/dx/dex/code/form/Form3rc.java
index 0accbc2..2d185cf 100644
--- a/dx/src/com/android/dx/dex/code/form/Form3rc.java
+++ b/dx/src/com/android/dx/dex/code/form/Form3rc.java
@@ -27,11 +27,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>3rc</code>. See the instruction format spec
+ * Instruction format {@code 3rc}. See the instruction format spec
* for details.
*/
public final class Form3rc extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form3rc();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/Form51l.java b/dx/src/com/android/dx/dex/code/form/Form51l.java
index 09a32f6..9e3ab6a 100644
--- a/dx/src/com/android/dx/dex/code/form/Form51l.java
+++ b/dx/src/com/android/dx/dex/code/form/Form51l.java
@@ -26,11 +26,11 @@
import com.android.dx.util.AnnotatedOutput;
/**
- * Instruction format <code>51l</code>. See the instruction format spec
+ * Instruction format {@code 51l}. See the instruction format spec
* for details.
*/
public final class Form51l extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new Form51l();
/**
diff --git a/dx/src/com/android/dx/dex/code/form/SpecialFormat.java b/dx/src/com/android/dx/dex/code/form/SpecialFormat.java
index 79efd67..8a2e5ed 100644
--- a/dx/src/com/android/dx/dex/code/form/SpecialFormat.java
+++ b/dx/src/com/android/dx/dex/code/form/SpecialFormat.java
@@ -27,10 +27,10 @@
* lists. Most of the overridden methods on this class end up throwing
* exceptions, as code should know (implicitly or explicitly) to avoid
* using this class. The one exception is {@link #isCompatible}, which
- * always returns <code>true</code>.
+ * always returns {@code true}.
*/
public final class SpecialFormat extends InsnFormat {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final InsnFormat THE_ONE = new SpecialFormat();
/**
diff --git a/dx/src/com/android/dx/dex/file/AnnotationItem.java b/dx/src/com/android/dx/dex/file/AnnotationItem.java
index 43ac362..08422bc 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationItem.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationItem.java
@@ -46,20 +46,20 @@
/** the required alignment for instances of this class */
private static final int ALIGNMENT = 1;
- /** non-null; unique instance of {@link #TypeIdSorter} */
+ /** {@code non-null;} unique instance of {@link #TypeIdSorter} */
private static final TypeIdSorter TYPE_ID_SORTER = new TypeIdSorter();
- /** non-null; the annotation to represent */
+ /** {@code non-null;} the annotation to represent */
private final Annotation annotation;
/**
- * null-ok; type reference for the annotation type; set during
+ * {@code null-ok;} type reference for the annotation type; set during
* {@link #addContents}
*/
private TypeIdItem type;
/**
- * null-ok; encoded form, ready for writing to a file; set during
+ * {@code null-ok;} encoded form, ready for writing to a file; set during
* {@link #place0}
*/
private byte[] encodedForm;
@@ -88,7 +88,7 @@
* ignoring all other aspects of the elements. This is only valid
* to use after type id indices are known.
*
- * @param array non-null; array to sort
+ * @param array {@code non-null;} array to sort
*/
public static void sortByTypeIdIndex(AnnotationItem[] array) {
Arrays.sort(array, TYPE_ID_SORTER);
@@ -97,7 +97,7 @@
/**
* Constructs an instance.
*
- * @param annotation non-null; annotation to represent
+ * @param annotation {@code non-null;} annotation to represent
*/
public AnnotationItem(Annotation annotation) {
/*
@@ -167,8 +167,8 @@
* output, that consumes no bytes of output. This is for annotating
* a reference to this instance at the point of the reference.
*
- * @param out non-null; where to output to
- * @param prefix non-null; prefix for each line of output
+ * @param out {@code non-null;} where to output to
+ * @param prefix {@code non-null;} prefix for each line of output
*/
public void annotateTo(AnnotatedOutput out, String prefix) {
out.annotate(0, prefix + "visibility: " +
diff --git a/dx/src/com/android/dx/dex/file/AnnotationSetItem.java b/dx/src/com/android/dx/dex/file/AnnotationSetItem.java
index f03cc08..2ff005a 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationSetItem.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationSetItem.java
@@ -28,14 +28,14 @@
/** the required alignment for instances of this class */
private static final int ALIGNMENT = 4;
- /** the size of an entry int the set: one <code>uint</code> */
+ /** the size of an entry int the set: one {@code uint} */
private static final int ENTRY_WRITE_SIZE = 4;
- /** non-null; the set of annotations */
+ /** {@code non-null;} the set of annotations */
private final Annotations annotations;
/**
- * non-null; set of annotations as individual items in an array.
+ * {@code non-null;} set of annotations as individual items in an array.
* <b>Note:</b> The contents have to get sorted by type id before
* writing.
*/
@@ -44,7 +44,7 @@
/**
* Constructs an instance.
*
- * @param annotations non-null; set of annotations
+ * @param annotations {@code non-null;} set of annotations
*/
public AnnotationSetItem(Annotations annotations) {
super(ALIGNMENT, writeSize(annotations));
@@ -62,8 +62,8 @@
/**
* Gets the write size for the given set.
*
- * @param annotations non-null; the set
- * @return > 0; the write size
+ * @param annotations {@code non-null;} the set
+ * @return {@code > 0;} the write size
*/
private static int writeSize(Annotations annotations) {
// This includes an int size at the start of the list.
@@ -79,7 +79,7 @@
/**
* Gets the underlying annotations of this instance
*
- * @return non-null; the annotations
+ * @return {@code non-null;} the annotations
*/
public Annotations getAnnotations() {
return annotations;
diff --git a/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java b/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java
index 422e2f0..1427e6a 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationSetRefItem.java
@@ -29,13 +29,13 @@
/** write size of this class, in bytes */
private static final int WRITE_SIZE = 4;
- /** non-null; the annotation set to refer to */
+ /** {@code non-null;} the annotation set to refer to */
private AnnotationSetItem annotations;
/**
* Constructs an instance.
*
- * @param annotations non-null; the annotation set to refer to
+ * @param annotations {@code non-null;} the annotation set to refer to
*/
public AnnotationSetRefItem(AnnotationSetItem annotations) {
super(ALIGNMENT, WRITE_SIZE);
diff --git a/dx/src/com/android/dx/dex/file/AnnotationUtils.java b/dx/src/com/android/dx/dex/file/AnnotationUtils.java
index c9d7968..8431d35 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationUtils.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationUtils.java
@@ -38,41 +38,41 @@
* Utility class for dealing with annotations.
*/
public final class AnnotationUtils {
- /** non-null; type for <code>AnnotationDefault</code> annotations */
+ /** {@code non-null;} type for {@code AnnotationDefault} annotations */
private static final CstType ANNOTATION_DEFAULT_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/AnnotationDefault;"));
- /** non-null; type for <code>EnclosingClass</code> annotations */
+ /** {@code non-null;} type for {@code EnclosingClass} annotations */
private static final CstType ENCLOSING_CLASS_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/EnclosingClass;"));
- /** non-null; type for <code>EnclosingMethod</code> annotations */
+ /** {@code non-null;} type for {@code EnclosingMethod} annotations */
private static final CstType ENCLOSING_METHOD_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/EnclosingMethod;"));
- /** non-null; type for <code>InnerClass</code> annotations */
+ /** {@code non-null;} type for {@code InnerClass} annotations */
private static final CstType INNER_CLASS_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/InnerClass;"));
- /** non-null; type for <code>MemberClasses</code> annotations */
+ /** {@code non-null;} type for {@code MemberClasses} annotations */
private static final CstType MEMBER_CLASSES_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/MemberClasses;"));
- /** non-null; type for <code>Signature</code> annotations */
+ /** {@code non-null;} type for {@code Signature} annotations */
private static final CstType SIGNATURE_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/Signature;"));
- /** non-null; type for <code>Throws</code> annotations */
+ /** {@code non-null;} type for {@code Throws} annotations */
private static final CstType THROWS_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/Throws;"));
- /** non-null; the UTF-8 constant <code>"accessFlags"</code> */
+ /** {@code non-null;} the UTF-8 constant {@code "accessFlags"} */
private static final CstUtf8 ACCESS_FLAGS_UTF = new CstUtf8("accessFlags");
- /** non-null; the UTF-8 constant <code>"name"</code> */
+ /** {@code non-null;} the UTF-8 constant {@code "name"} */
private static final CstUtf8 NAME_UTF = new CstUtf8("name");
- /** non-null; the UTF-8 constant <code>"value"</code> */
+ /** {@code non-null;} the UTF-8 constant {@code "value"} */
private static final CstUtf8 VALUE_UTF = new CstUtf8("value");
/**
@@ -83,10 +83,10 @@
}
/**
- * Constructs a standard <code>AnnotationDefault</code> annotation.
+ * Constructs a standard {@code AnnotationDefault} annotation.
*
- * @param defaults non-null; the defaults, itself as an annotation
- * @return non-null; the constructed annotation
+ * @param defaults {@code non-null;} the defaults, itself as an annotation
+ * @return {@code non-null;} the constructed annotation
*/
public static Annotation makeAnnotationDefault(Annotation defaults) {
Annotation result = new Annotation(ANNOTATION_DEFAULT_TYPE, SYSTEM);
@@ -97,10 +97,10 @@
}
/**
- * Constructs a standard <code>EnclosingClass</code> annotation.
+ * Constructs a standard {@code EnclosingClass} annotation.
*
- * @param clazz non-null; the enclosing class
- * @return non-null; the annotation
+ * @param clazz {@code non-null;} the enclosing class
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeEnclosingClass(CstType clazz) {
Annotation result = new Annotation(ENCLOSING_CLASS_TYPE, SYSTEM);
@@ -111,10 +111,10 @@
}
/**
- * Constructs a standard <code>EnclosingMethod</code> annotation.
+ * Constructs a standard {@code EnclosingMethod} annotation.
*
- * @param method non-null; the enclosing method
- * @return non-null; the annotation
+ * @param method {@code non-null;} the enclosing method
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeEnclosingMethod(CstMethodRef method) {
Annotation result = new Annotation(ENCLOSING_METHOD_TYPE, SYSTEM);
@@ -125,12 +125,12 @@
}
/**
- * Constructs a standard <code>InnerClass</code> annotation.
+ * Constructs a standard {@code InnerClass} annotation.
*
- * @param name null-ok; the original name of the class, or
- * <code>null</code> to represent an anonymous class
+ * @param name {@code null-ok;} the original name of the class, or
+ * {@code null} to represent an anonymous class
* @param accessFlags the original access flags
- * @return non-null; the annotation
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeInnerClass(CstUtf8 name, int accessFlags) {
Annotation result = new Annotation(INNER_CLASS_TYPE, SYSTEM);
@@ -145,10 +145,10 @@
}
/**
- * Constructs a standard <code>MemberClasses</code> annotation.
+ * Constructs a standard {@code MemberClasses} annotation.
*
- * @param types non-null; the list of (the types of) the member classes
- * @return non-null; the annotation
+ * @param types {@code non-null;} the list of (the types of) the member classes
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeMemberClasses(TypeList types) {
CstArray array = makeCstArray(types);
@@ -159,10 +159,10 @@
}
/**
- * Constructs a standard <code>Signature</code> annotation.
+ * Constructs a standard {@code Signature} annotation.
*
- * @param signature non-null; the signature string
- * @return non-null; the annotation
+ * @param signature {@code non-null;} the signature string
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeSignature(CstUtf8 signature) {
Annotation result = new Annotation(SIGNATURE_TYPE, SYSTEM);
@@ -221,10 +221,10 @@
}
/**
- * Constructs a standard <code>Throws</code> annotation.
+ * Constructs a standard {@code Throws} annotation.
*
- * @param types non-null; the list of thrown types
- * @return non-null; the annotation
+ * @param types {@code non-null;} the list of thrown types
+ * @return {@code non-null;} the annotation
*/
public static Annotation makeThrows(TypeList types) {
CstArray array = makeCstArray(types);
@@ -237,8 +237,8 @@
/**
* Converts a {@link TypeList} to a {@link CstArray}.
*
- * @param types non-null; the type list
- * @return non-null; the corresponding array constant
+ * @param types {@code non-null;} the type list
+ * @return {@code non-null;} the corresponding array constant
*/
private static CstArray makeCstArray(TypeList types) {
int size = types.size();
diff --git a/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java b/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java
index 4521e4c..d55195f 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationsDirectoryItem.java
@@ -40,16 +40,16 @@
/** write size of a list element, in bytes */
private static final int ELEMENT_SIZE = 8;
- /** null-ok; the class-level annotations, if any */
+ /** {@code null-ok;} the class-level annotations, if any */
private AnnotationSetItem classAnnotations;
- /** null-ok; the annotated fields, if any */
+ /** {@code null-ok;} the annotated fields, if any */
private ArrayList<FieldAnnotationStruct> fieldAnnotations;
- /** null-ok; the annotated methods, if any */
+ /** {@code null-ok;} the annotated methods, if any */
private ArrayList<MethodAnnotationStruct> methodAnnotations;
- /** null-ok; the annotated parameters, if any */
+ /** {@code null-ok;} the annotated parameters, if any */
private ArrayList<ParameterAnnotationStruct> parameterAnnotations;
/**
@@ -73,7 +73,7 @@
/**
* Returns whether this item is empty (has no contents).
*
- * @return <code>true</code> if this item is empty, or <code>false</code>
+ * @return {@code true} if this item is empty, or {@code false}
* if not
*/
public boolean isEmpty() {
@@ -88,8 +88,8 @@
* interning candidates are ones that <i>only</i> have a non-null
* set of class annotations, with no other lists.
*
- * @return <code>true</code> if this is an interning candidate, or
- * <code>false</code> if not
+ * @return {@code true} if this is an interning candidate, or
+ * {@code false} if not
*/
public boolean isInternable() {
return (classAnnotations != null) &&
@@ -132,7 +132,7 @@
* made on the class, per se, as opposed to on one of its members.
* It is only valid to call this method at most once per instance.
*
- * @param annotations non-null; annotations to set for this class
+ * @param annotations {@code non-null;} annotations to set for this class
*/
public void setClassAnnotations(Annotations annotations) {
if (annotations == null) {
@@ -150,8 +150,8 @@
/**
* Adds a field annotations item to this instance.
*
- * @param field non-null; field in question
- * @param annotations non-null; associated annotations to add
+ * @param field {@code non-null;} field in question
+ * @param annotations {@code non-null;} associated annotations to add
*/
public void addFieldAnnotations(CstFieldRef field,
Annotations annotations) {
@@ -166,8 +166,8 @@
/**
* Adds a method annotations item to this instance.
*
- * @param method non-null; method in question
- * @param annotations non-null; associated annotations to add
+ * @param method {@code non-null;} method in question
+ * @param annotations {@code non-null;} associated annotations to add
*/
public void addMethodAnnotations(CstMethodRef method,
Annotations annotations) {
@@ -182,8 +182,8 @@
/**
* Adds a parameter annotations item to this instance.
*
- * @param method non-null; method in question
- * @param list non-null; associated list of annotation sets to add
+ * @param method {@code non-null;} method in question
+ * @param list {@code non-null;} associated list of annotation sets to add
*/
public void addParameterAnnotations(CstMethodRef method,
AnnotationsList list) {
@@ -198,8 +198,8 @@
* Gets the method annotations for a given method, if any. This is
* meant for use by debugging / dumping code.
*
- * @param method non-null; the method
- * @return null-ok; the method annotations, if any
+ * @param method {@code non-null;} the method
+ * @return {@code null-ok;} the method annotations, if any
*/
public Annotations getMethodAnnotations(CstMethodRef method) {
if (methodAnnotations == null) {
@@ -219,8 +219,8 @@
* Gets the parameter annotations for a given method, if any. This is
* meant for use by debugging / dumping code.
*
- * @param method non-null; the method
- * @return null-ok; the parameter annotations, if any
+ * @param method {@code non-null;} the method
+ * @return {@code null-ok;} the parameter annotations, if any
*/
public AnnotationsList getParameterAnnotations(CstMethodRef method) {
if (parameterAnnotations == null) {
@@ -336,11 +336,11 @@
}
/**
- * Gets the list size of the given list, or <code>0</code> if given
- * <code>null</code>.
+ * Gets the list size of the given list, or {@code 0} if given
+ * {@code null}.
*
- * @param list null-ok; the list in question
- * @return >= 0; its size
+ * @param list {@code null-ok;} the list in question
+ * @return {@code >= 0;} its size
*/
private static int listSize(ArrayList<?> list) {
if (list == null) {
@@ -354,7 +354,7 @@
* Prints out the contents of this instance, in a debugging-friendly
* way. This is meant to be called from {@link ClassDefItem#debugPrint}.
*
- * @param out non-null; where to output to
+ * @param out {@code non-null;} where to output to
*/
/*package*/ void debugPrint(PrintWriter out) {
if (classAnnotations != null) {
diff --git a/dx/src/com/android/dx/dex/file/CatchStructs.java b/dx/src/com/android/dx/dex/file/CatchStructs.java
index b7abc3f..64bf243 100644
--- a/dx/src/com/android/dx/dex/file/CatchStructs.java
+++ b/dx/src/com/android/dx/dex/file/CatchStructs.java
@@ -32,27 +32,27 @@
/**
* List of exception handlers (tuples of covered range, catch type,
* handler address) for a particular piece of code. Instances of this
- * class correspond to a <code>try_item[]</code> and a
- * <code>catch_handler_item[]</code>.
+ * class correspond to a {@code try_item[]} and a
+ * {@code catch_handler_item[]}.
*/
public final class CatchStructs {
/**
- * the size of a <code>try_item</code>: a <code>uint</code>
- * and two <code>ushort</code>s
+ * the size of a {@code try_item}: a {@code uint}
+ * and two {@code ushort}s
*/
private static final int TRY_ITEM_WRITE_SIZE = 4 + (2 * 2);
- /** non-null; code that contains the catches */
+ /** {@code non-null;} code that contains the catches */
private final DalvCode code;
/**
- * null-ok; the underlying table; set in
+ * {@code null-ok;} the underlying table; set in
* {@link #finishProcessingIfNecessary}
*/
private CatchTable table;
/**
- * null-ok; the encoded handler list, if calculated; set in
+ * {@code null-ok;} the encoded handler list, if calculated; set in
* {@link #encode}
*/
private byte[] encodedHandlers;
@@ -64,7 +64,7 @@
private int encodedHandlerHeaderSize;
/**
- * null-ok; map from handler lists to byte offsets, if calculated; set in
+ * {@code null-ok;} map from handler lists to byte offsets, if calculated; set in
* {@link #encode}
*/
private TreeMap<CatchHandlerList, Integer> handlerOffsets;
@@ -72,7 +72,7 @@
/**
* Constructs an instance.
*
- * @param code non-null; code that contains the catches
+ * @param code {@code non-null;} code that contains the catches
*/
public CatchStructs(DalvCode code) {
this.code = code;
@@ -94,7 +94,7 @@
/**
* Gets the size of the tries list, in entries.
*
- * @return >= 0; the tries list size
+ * @return {@code >= 0;} the tries list size
*/
public int triesSize() {
finishProcessingIfNecessary();
@@ -104,8 +104,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; prefix to attach to each line of output
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} prefix to attach to each line of output
*/
public void debugPrint(PrintWriter out, String prefix) {
annotateEntries(prefix, out, null);
@@ -114,7 +114,7 @@
/**
* Encodes the handler lists.
*
- * @param file non-null; file this instance is part of
+ * @param file {@code non-null;} file this instance is part of
*/
public void encode(DexFile file) {
finishProcessingIfNecessary();
@@ -179,7 +179,7 @@
/**
* Gets the write size of this instance, in bytes.
*
- * @return >= 0; the write size
+ * @return {@code >= 0;} the write size
*/
public int writeSize() {
return (triesSize() * TRY_ITEM_WRITE_SIZE) +
@@ -189,8 +189,8 @@
/**
* Writes this instance to the given stream.
*
- * @param file non-null; file this instance is part of
- * @param out non-null; where to write to
+ * @param file {@code non-null;} file this instance is part of
+ * @param out {@code non-null;} where to write to
*/
public void writeTo(DexFile file, AnnotatedOutput out) {
finishProcessingIfNecessary();
@@ -225,12 +225,12 @@
/**
* Helper method to annotate or simply print the exception handlers.
- * Only one of <code>printTo</code> or <code>annotateTo</code> should
+ * Only one of {@code printTo} or {@code annotateTo} should
* be non-null.
*
- * @param prefix non-null; prefix for each line
- * @param printTo null-ok; where to print to
- * @param annotateTo null-ok; where to consume bytes and annotate to
+ * @param prefix {@code non-null;} prefix for each line
+ * @param printTo {@code null-ok;} where to print to
+ * @param annotateTo {@code null-ok;} where to consume bytes and annotate to
*/
private void annotateEntries(String prefix, PrintWriter printTo,
AnnotatedOutput annotateTo) {
@@ -299,12 +299,12 @@
* Helper for {@link #annotateEntries} to annotate a catch handler list
* while consuming it.
*
- * @param handlers non-null; handlers to annotate
- * @param offset >= 0; the offset of this handler
- * @param size >= 1; the number of bytes the handlers consume
- * @param prefix non-null; prefix for each line
- * @param printTo null-ok; where to print to
- * @param annotateTo non-null; where to annotate to
+ * @param handlers {@code non-null;} handlers to annotate
+ * @param offset {@code >= 0;} the offset of this handler
+ * @param size {@code >= 1;} the number of bytes the handlers consume
+ * @param prefix {@code non-null;} prefix for each line
+ * @param printTo {@code null-ok;} where to print to
+ * @param annotateTo {@code non-null;} where to annotate to
*/
private static void annotateAndConsumeHandlers(CatchHandlerList handlers,
int offset, int size, String prefix, PrintWriter printTo,
diff --git a/dx/src/com/android/dx/dex/file/ClassDataItem.java b/dx/src/com/android/dx/dex/file/ClassDataItem.java
index 638daed..f437a3e 100644
--- a/dx/src/com/android/dx/dex/file/ClassDataItem.java
+++ b/dx/src/com/android/dx/dex/file/ClassDataItem.java
@@ -38,32 +38,32 @@
* Representation of all the parts of a Dalvik class that are generally
* "inflated" into an in-memory representation at runtime. Instances of
* this class are represented in a compact streamable form in a
- * <code>dex</code> file, as opposed to a random-access form.
+ * {@code dex} file, as opposed to a random-access form.
*/
public final class ClassDataItem extends OffsettedItem {
- /** non-null; what class this data is for, just for listing generation */
+ /** {@code non-null;} what class this data is for, just for listing generation */
private final CstType thisClass;
- /** non-null; list of static fields */
+ /** {@code non-null;} list of static fields */
private final ArrayList<EncodedField> staticFields;
- /** non-null; list of initial values for static fields */
+ /** {@code non-null;} list of initial values for static fields */
private final HashMap<EncodedField, Constant> staticValues;
- /** non-null; list of instance fields */
+ /** {@code non-null;} list of instance fields */
private final ArrayList<EncodedField> instanceFields;
- /** non-null; list of direct methods */
+ /** {@code non-null;} list of direct methods */
private final ArrayList<EncodedMethod> directMethods;
- /** non-null; list of virtual methods */
+ /** {@code non-null;} list of virtual methods */
private final ArrayList<EncodedMethod> virtualMethods;
- /** null-ok; static initializer list; set in {@link #addContents} */
+ /** {@code null-ok;} static initializer list; set in {@link #addContents} */
private CstArray staticValuesConstant;
/**
- * null-ok; encoded form, ready for writing to a file; set during
+ * {@code null-ok;} encoded form, ready for writing to a file; set during
* {@link #place0}
*/
private byte[] encodedForm;
@@ -72,7 +72,7 @@
* Constructs an instance. Its sets of members are initially
* empty.
*
- * @param thisClass non-null; what class this data is for, just
+ * @param thisClass {@code non-null;} what class this data is for, just
* for listing generation
*/
public ClassDataItem(CstType thisClass) {
@@ -106,8 +106,8 @@
/**
* Returns whether this instance is empty.
*
- * @return <code>true</code> if this instance is empty or
- * <code>false</code> if at least one element has been added to it
+ * @return {@code true} if this instance is empty or
+ * {@code false} if at least one element has been added to it
*/
public boolean isEmpty() {
return staticFields.isEmpty() && instanceFields.isEmpty()
@@ -117,8 +117,8 @@
/**
* Adds a static field.
*
- * @param field non-null; the field to add
- * @param value null-ok; initial value for the field, if any
+ * @param field {@code non-null;} the field to add
+ * @param value {@code null-ok;} initial value for the field, if any
*/
public void addStaticField(EncodedField field, Constant value) {
if (field == null) {
@@ -137,7 +137,7 @@
/**
* Adds an instance field.
*
- * @param field non-null; the field to add
+ * @param field {@code non-null;} the field to add
*/
public void addInstanceField(EncodedField field) {
if (field == null) {
@@ -148,9 +148,9 @@
}
/**
- * Adds a direct (<code>static</code> and/or <code>private</code>) method.
+ * Adds a direct ({@code static} and/or {@code private}) method.
*
- * @param method non-null; the method to add
+ * @param method {@code non-null;} the method to add
*/
public void addDirectMethod(EncodedMethod method) {
if (method == null) {
@@ -163,7 +163,7 @@
/**
* Adds a virtual method.
*
- * @param method non-null; the method to add
+ * @param method {@code non-null;} the method to add
*/
public void addVirtualMethod(EncodedMethod method) {
if (method == null) {
@@ -178,7 +178,7 @@
* in any way to the underlying lists contained in this instance, but
* the objects contained in the list are shared.
*
- * @return non-null; list of all methods
+ * @return {@code non-null;} list of all methods
*/
public ArrayList<EncodedMethod> getMethods() {
int sz = directMethods.size() + virtualMethods.size();
@@ -195,7 +195,7 @@
* Prints out the contents of this instance, in a debugging-friendly
* way.
*
- * @param out non-null; where to output to
+ * @param out {@code non-null;} where to output to
* @param verbose whether to be verbose with the output
*/
public void debugPrint(Writer out, boolean verbose) {
@@ -258,9 +258,9 @@
/**
* Gets a {@link CstArray} corresponding to {@link #staticValues} if
- * it contains any non-zero non-<code>null</code> values.
+ * it contains any non-zero non-{@code null} values.
*
- * @return null-ok; the corresponding constant or <code>null</code> if
+ * @return {@code null-ok;} the corresponding constant or {@code null} if
* there are no values to encode
*/
public CstArray getStaticValuesConstant() {
@@ -273,9 +273,9 @@
/**
* Gets a {@link CstArray} corresponding to {@link #staticValues} if
- * it contains any non-zero non-<code>null</code> values.
+ * it contains any non-zero non-{@code null} values.
*
- * @return null-ok; the corresponding constant or <code>null</code> if
+ * @return {@code null-ok;} the corresponding constant or {@code null} if
* there are no values to encode
*/
private CstArray makeStaticValuesConstant() {
@@ -337,8 +337,8 @@
/**
* Writes out the encoded form of this instance.
*
- * @param file non-null; file this instance is part of
- * @param out non-null; where to write to
+ * @param file {@code non-null;} file this instance is part of
+ * @param out {@code non-null;} where to write to
*/
private void encodeOutput(DexFile file, AnnotatedOutput out) {
boolean annotates = out.annotates();
@@ -369,10 +369,10 @@
* Helper for {@link #encodeOutput}, which writes out the given
* size value, annotating it as well (if annotations are enabled).
*
- * @param file non-null; file this instance is part of
- * @param out non-null; where to write to
- * @param label non-null; the label for the purposes of annotation
- * @param size >= 0; the size to write
+ * @param file {@code non-null;} file this instance is part of
+ * @param out {@code non-null;} where to write to
+ * @param label {@code non-null;} the label for the purposes of annotation
+ * @param size {@code >= 0;} the size to write
*/
private static void encodeSize(DexFile file, AnnotatedOutput out,
String label, int size) {
@@ -389,10 +389,10 @@
* list. It also annotates the items (if any and if annotations
* are enabled).
*
- * @param file non-null; file this instance is part of
- * @param out non-null; where to write to
- * @param label non-null; the label for the purposes of annotation
- * @param list non-null; the list in question
+ * @param file {@code non-null;} file this instance is part of
+ * @param out {@code non-null;} where to write to
+ * @param label {@code non-null;} the label for the purposes of annotation
+ * @param list {@code non-null;} the list in question
*/
private static void encodeList(DexFile file, AnnotatedOutput out,
String label, ArrayList<? extends EncodedMember> list) {
diff --git a/dx/src/com/android/dx/dex/file/ClassDefItem.java b/dx/src/com/android/dx/dex/file/ClassDefItem.java
index 5a0b27c..acd8cf5 100644
--- a/dx/src/com/android/dx/dex/file/ClassDefItem.java
+++ b/dx/src/com/android/dx/dex/file/ClassDefItem.java
@@ -45,47 +45,47 @@
/** size of instances when written out to a file, in bytes */
public static final int WRITE_SIZE = 32;
- /** non-null; type constant for this class */
+ /** {@code non-null;} type constant for this class */
private final CstType thisClass;
/** access flags */
private final int accessFlags;
/**
- * null-ok; superclass or <code>null</code> if this class is a/the
+ * {@code null-ok;} superclass or {@code null} if this class is a/the
* root class
*/
private final CstType superclass;
- /** null-ok; list of implemented interfaces */
+ /** {@code null-ok;} list of implemented interfaces */
private TypeListItem interfaces;
- /** null-ok; source file name or <code>null</code> if unknown */
+ /** {@code null-ok;} source file name or {@code null} if unknown */
private final CstUtf8 sourceFile;
- /** non-null; associated class data object */
+ /** {@code non-null;} associated class data object */
private final ClassDataItem classData;
/**
- * null-ok; item wrapper for the static values, initialized
+ * {@code null-ok;} item wrapper for the static values, initialized
* in {@link #addContents}
*/
private EncodedArrayItem staticValuesItem;
- /** non-null; annotations directory */
+ /** {@code non-null;} annotations directory */
private AnnotationsDirectoryItem annotationsDirectory;
/**
* Constructs an instance. Its sets of members and annotations are
* initially empty.
*
- * @param thisClass non-null; type constant for this class
+ * @param thisClass {@code non-null;} type constant for this class
* @param accessFlags access flags
- * @param superclass null-ok; superclass or <code>null</code> if
+ * @param superclass {@code null-ok;} superclass or {@code null} if
* this class is a/the root class
- * @param interfaces non-null; list of implemented interfaces
- * @param sourceFile null-ok; source file name or
- * <code>null</code> if unknown
+ * @param interfaces {@code non-null;} list of implemented interfaces
+ * @param sourceFile {@code null-ok;} source file name or
+ * {@code null} if unknown
*/
public ClassDefItem(CstType thisClass, int accessFlags,
CstType superclass, TypeList interfaces, CstUtf8 sourceFile) {
@@ -223,7 +223,7 @@
/**
* Gets the constant corresponding to this class.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public CstType getThisClass() {
return thisClass;
@@ -241,7 +241,7 @@
/**
* Gets the superclass.
*
- * @return null-ok; the superclass or <code>null</code> if
+ * @return {@code null-ok;} the superclass or {@code null} if
* this class is a/the root class
*/
public CstType getSuperclass() {
@@ -251,7 +251,7 @@
/**
* Gets the list of interfaces implemented.
*
- * @return non-null; the interfaces list
+ * @return {@code non-null;} the interfaces list
*/
public TypeList getInterfaces() {
if (interfaces == null) {
@@ -264,7 +264,7 @@
/**
* Gets the source file name.
*
- * @return null-ok; the source file name or <code>null</code> if unknown
+ * @return {@code null-ok;} the source file name or {@code null} if unknown
*/
public CstUtf8 getSourceFile() {
return sourceFile;
@@ -273,8 +273,8 @@
/**
* Adds a static field.
*
- * @param field non-null; the field to add
- * @param value null-ok; initial value for the field, if any
+ * @param field {@code non-null;} the field to add
+ * @param value {@code null-ok;} initial value for the field, if any
*/
public void addStaticField(EncodedField field, Constant value) {
classData.addStaticField(field, value);
@@ -283,16 +283,16 @@
/**
* Adds an instance field.
*
- * @param field non-null; the field to add
+ * @param field {@code non-null;} the field to add
*/
public void addInstanceField(EncodedField field) {
classData.addInstanceField(field);
}
/**
- * Adds a direct (<code>static</code> and/or <code>private</code>) method.
+ * Adds a direct ({@code static} and/or {@code private}) method.
*
- * @param method non-null; the method to add
+ * @param method {@code non-null;} the method to add
*/
public void addDirectMethod(EncodedMethod method) {
classData.addDirectMethod(method);
@@ -301,7 +301,7 @@
/**
* Adds a virtual method.
*
- * @param method non-null; the method to add
+ * @param method {@code non-null;} the method to add
*/
public void addVirtualMethod(EncodedMethod method) {
classData.addVirtualMethod(method);
@@ -312,7 +312,7 @@
* in any way to the underlying lists contained in this instance, but
* the objects contained in the list are shared.
*
- * @return non-null; list of all methods
+ * @return {@code non-null;} list of all methods
*/
public ArrayList<EncodedMethod> getMethods() {
return classData.getMethods();
@@ -323,7 +323,7 @@
* made on the class, per se, as opposed to on one of its members.
* It is only valid to call this method at most once per instance.
*
- * @param annotations non-null; annotations to set for this class
+ * @param annotations {@code non-null;} annotations to set for this class
*/
public void setClassAnnotations(Annotations annotations) {
annotationsDirectory.setClassAnnotations(annotations);
@@ -332,8 +332,8 @@
/**
* Adds a field annotations item to this class.
*
- * @param field non-null; field in question
- * @param annotations non-null; associated annotations to add
+ * @param field {@code non-null;} field in question
+ * @param annotations {@code non-null;} associated annotations to add
*/
public void addFieldAnnotations(CstFieldRef field,
Annotations annotations) {
@@ -343,8 +343,8 @@
/**
* Adds a method annotations item to this class.
*
- * @param method non-null; method in question
- * @param annotations non-null; associated annotations to add
+ * @param method {@code non-null;} method in question
+ * @param annotations {@code non-null;} associated annotations to add
*/
public void addMethodAnnotations(CstMethodRef method,
Annotations annotations) {
@@ -354,8 +354,8 @@
/**
* Adds a parameter annotations item to this class.
*
- * @param method non-null; method in question
- * @param list non-null; associated list of annotation sets to add
+ * @param method {@code non-null;} method in question
+ * @param list {@code non-null;} associated list of annotation sets to add
*/
public void addParameterAnnotations(CstMethodRef method,
AnnotationsList list) {
@@ -366,8 +366,8 @@
* Gets the method annotations for a given method, if any. This is
* meant for use by debugging / dumping code.
*
- * @param method non-null; the method
- * @return null-ok; the method annotations, if any
+ * @param method {@code non-null;} the method
+ * @return {@code null-ok;} the method annotations, if any
*/
public Annotations getMethodAnnotations(CstMethodRef method) {
return annotationsDirectory.getMethodAnnotations(method);
@@ -377,8 +377,8 @@
* Gets the parameter annotations for a given method, if any. This is
* meant for use by debugging / dumping code.
*
- * @param method non-null; the method
- * @return null-ok; the parameter annotations, if any
+ * @param method {@code non-null;} the method
+ * @return {@code null-ok;} the parameter annotations, if any
*/
public AnnotationsList getParameterAnnotations(CstMethodRef method) {
return annotationsDirectory.getParameterAnnotations(method);
@@ -388,7 +388,7 @@
* Prints out the contents of this instance, in a debugging-friendly
* way.
*
- * @param out non-null; where to output to
+ * @param out {@code non-null;} where to output to
* @param verbose whether to be verbose with the output
*/
public void debugPrint(Writer out, boolean verbose) {
diff --git a/dx/src/com/android/dx/dex/file/ClassDefsSection.java b/dx/src/com/android/dx/dex/file/ClassDefsSection.java
index cf61b47..e8efd57 100644
--- a/dx/src/com/android/dx/dex/file/ClassDefsSection.java
+++ b/dx/src/com/android/dx/dex/file/ClassDefsSection.java
@@ -28,22 +28,22 @@
import java.util.TreeMap;
/**
- * Class definitions list section of a <code>.dex</code> file.
+ * Class definitions list section of a {@code .dex} file.
*/
public final class ClassDefsSection extends UniformItemSection {
/**
- * non-null; map from type constants for classes to {@link
+ * {@code non-null;} map from type constants for classes to {@link
* ClassDefItem} instances that define those classes
*/
private final TreeMap<Type, ClassDefItem> classDefs;
- /** null-ok; ordered list of classes; set in {@link #orderItems} */
+ /** {@code null-ok;} ordered list of classes; set in {@link #orderItems} */
private ArrayList<ClassDefItem> orderedDefs;
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public ClassDefsSection(DexFile file) {
super("class_defs", file, 4);
@@ -84,7 +84,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -105,7 +105,7 @@
* Adds an element to this instance. It is illegal to attempt to add more
* than one class with the same name.
*
- * @param clazz non-null; the class def to add
+ * @param clazz {@code non-null;} the class def to add
*/
public void add(ClassDefItem clazz) {
Type type;
@@ -149,11 +149,11 @@
* Helper for {@link #orderItems}, which recursively assigns indices
* to classes.
*
- * @param type null-ok; type ref to assign, if any
- * @param idx >= 0; the next index to assign
+ * @param type {@code null-ok;} type ref to assign, if any
+ * @param idx {@code >= 0;} the next index to assign
* @param maxDepth maximum recursion depth; if negative, this will
* throw an exception indicating class definition circularity
- * @return >= 0; the next index to assign
+ * @return {@code >= 0;} the next index to assign
*/
private int orderItems0(Type type, int idx, int maxDepth) {
ClassDefItem c = classDefs.get(type);
diff --git a/dx/src/com/android/dx/dex/file/CodeItem.java b/dx/src/com/android/dx/dex/file/CodeItem.java
index dc0bb52..279e6bf 100644
--- a/dx/src/com/android/dx/dex/file/CodeItem.java
+++ b/dx/src/com/android/dx/dex/file/CodeItem.java
@@ -39,7 +39,7 @@
/**
* Representation of all the parts needed for concrete methods in a
- * <code>dex</code> file.
+ * {@code dex} file.
*/
public final class CodeItem extends OffsettedItem {
/** file alignment of this class, in bytes */
@@ -48,26 +48,26 @@
/** write size of the header of this class, in bytes */
private static final int HEADER_SIZE = 16;
- /** non-null; method that this code implements */
+ /** {@code non-null;} method that this code implements */
private final CstMethodRef ref;
- /** non-null; the bytecode instructions and associated data */
+ /** {@code non-null;} the bytecode instructions and associated data */
private final DalvCode code;
- /** null-ok; the catches, if needed; set in {@link #addContents} */
+ /** {@code null-ok;} the catches, if needed; set in {@link #addContents} */
private CatchStructs catches;
- /** whether this instance is for a <code>static</code> method */
+ /** whether this instance is for a {@code static} method */
private final boolean isStatic;
/**
- * non-null; list of possibly-thrown exceptions; just used in
+ * {@code non-null;} list of possibly-thrown exceptions; just used in
* generating debugging output (listings)
*/
private final TypeList throwsList;
/**
- * null-ok; the debug info or <code>null</code> if there is none;
+ * {@code null-ok;} the debug info or {@code null} if there is none;
* set in {@link #addContents}
*/
private DebugInfoItem debugInfo;
@@ -75,11 +75,11 @@
/**
* Constructs an instance.
*
- * @param ref non-null; method that this code implements
- * @param code non-null; the underlying code
- * @param isStatic whether this instance is for a <code>static</code>
+ * @param ref {@code non-null;} method that this code implements
+ * @param code {@code non-null;} the underlying code
+ * @param isStatic whether this instance is for a {@code static}
* method
- * @param throwsList non-null; list of possibly-thrown exceptions,
+ * @param throwsList {@code non-null;} list of possibly-thrown exceptions,
* just used in generating debugging output (listings)
*/
public CodeItem(CstMethodRef ref, DalvCode code, boolean isStatic,
@@ -150,7 +150,7 @@
/**
* Gets the reference to the method this instance implements.
*
- * @return non-null; the method reference
+ * @return {@code non-null;} the method reference
*/
public CstMethodRef getRef() {
return ref;
@@ -159,8 +159,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; per-line prefix to use
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} per-line prefix to use
* @param verbose whether to be verbose with the output
*/
public void debugPrint(PrintWriter out, String prefix, boolean verbose) {
@@ -292,8 +292,8 @@
/**
* Helper for {@link #writeTo0} which writes out the actual bytecode.
*
- * @param file non-null; file we are part of
- * @param out non-null; where to write to
+ * @param file {@code non-null;} file we are part of
+ * @param out {@code non-null;} where to write to
*/
private void writeCodes(DexFile file, AnnotatedOutput out) {
DalvInsnList insns = code.getInsns();
diff --git a/dx/src/com/android/dx/dex/file/DebugInfoConstants.java b/dx/src/com/android/dx/dex/file/DebugInfoConstants.java
index 010acb4..78b6b04 100644
--- a/dx/src/com/android/dx/dex/file/DebugInfoConstants.java
+++ b/dx/src/com/android/dx/dex/file/DebugInfoConstants.java
@@ -110,8 +110,8 @@
* next position entry that is added should be considered the end of
* a method prologue (an appropriate place for a method breakpoint).<p>
*
- * The prologue_end register is cleared by any special (>= OPCODE_BASE)
- * opcode.
+ * The prologue_end register is cleared by any special
+ * ({@code >= OPCODE_BASE}) opcode.
*/
static final int DBG_SET_PROLOGUE_END = 0x07;
@@ -121,8 +121,8 @@
* a method epilogue (an appropriate place to suspend execution before
* method exit).<p>
*
- * The epilogue_begin register is cleared by any special (>= OPCODE_BASE)
- * opcode.
+ * The epilogue_begin register is cleared by any special
+ * ({@code >= OPCODE_BASE}) opcode.
*/
static final int DBG_SET_EPILOGUE_BEGIN = 0x08;
diff --git a/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java b/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java
index 3ffd276..cd20055 100644
--- a/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java
+++ b/dx/src/com/android/dx/dex/file/DebugInfoDecoder.java
@@ -38,7 +38,7 @@
/**
* A decoder for the dex debug info state machine format.
* This code exists mostly as a reference implementation and test for
- * for the <code>DebugInfoEncoder</code>
+ * for the {@code DebugInfoEncoder}
*/
public class DebugInfoDecoder {
/** encoded debug info */
@@ -180,7 +180,7 @@
/**
* Gets the decoded positions list.
- * Valid after calling <code>decode</code>.
+ * Valid after calling {@code decode}.
*
* @return positions list in ascending address order.
*/
@@ -190,7 +190,7 @@
/**
* Gets the decoded locals list, in ascending start-address order.
- * Valid after calling <code>decode</code>.
+ * Valid after calling {@code decode}.
*
* @return locals list in ascending address order.
*/
@@ -227,7 +227,7 @@
/**
* Gets the register that begins the method's parameter range (including
* the 'this' parameter for non-static methods). The range continues until
- * <code>regSize</code>
+ * {@code regSize}
*
* @return register as noted above.
*/
@@ -416,9 +416,9 @@
* encoder.
*
* @param info encoded debug info
- * @param file non-null; file to refer to during decoding
- * @param ref non-null; method whose info is being decoded
- * @param code non-null; original code object that was encoded
+ * @param file {@code non-null;} file to refer to during decoding
+ * @param ref {@code non-null;} method whose info is being decoded
+ * @param code {@code non-null;} original code object that was encoded
* @param isStatic whether the method is static
*/
public static void validateEncode(byte[] info, DexFile file,
diff --git a/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java b/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java
index 780e18d..3f722ea 100644
--- a/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java
+++ b/dx/src/com/android/dx/dex/file/DebugInfoEncoder.java
@@ -46,19 +46,19 @@
* <li> signed LEB128: initial value for line register.
* <li> n instances of signed LEB128: string indicies (offset by 1)
* for each method argument in left-to-right order
- * with <code>this</code> excluded. A value of '0' indicates "no name"
+ * with {@code this} excluded. A value of '0' indicates "no name"
* <li> A sequence of special or normal opcodes as defined in
- * <code>DebugInfoConstants</code>.
- * <li> A single terminating <code>OP_END_SEQUENCE</code>
+ * {@code DebugInfoConstants}.
+ * <li> A single terminating {@code OP_END_SEQUENCE}
* </ol>
*/
public final class DebugInfoEncoder {
private static final boolean DEBUG = false;
- /** null-ok; positions (line numbers) to encode */
+ /** {@code null-ok;} positions (line numbers) to encode */
private final PositionList positions;
- /** null-ok; local variables to encode */
+ /** {@code null-ok;} local variables to encode */
private final LocalList locals;
private final ByteArrayAnnotatedOutput output;
@@ -96,9 +96,9 @@
/**
* Creates an instance.
*
- * @param pl null-ok; positions (line numbers) to encode
- * @param ll null-ok; local variables to encode
- * @param file null-ok; may only be <code>null</code> if simply using
+ * @param pl {@code null-ok;} positions (line numbers) to encode
+ * @param ll {@code null-ok;} local variables to encode
+ * @param file {@code null-ok;} may only be {@code null} if simply using
* this class to do a debug print
* @param codeSize
* @param regSize
@@ -122,7 +122,7 @@
}
/**
- * Annotates or writes a message to the <code>debugPrint</code> writer
+ * Annotates or writes a message to the {@code debugPrint} writer
* if applicable.
*
* @param length the number of bytes associated with this message
@@ -146,8 +146,8 @@
* Converts this (PositionList, LocalList) pair into a state machine
* sequence.
*
- * @return encoded byte sequence without padding and
- * terminated with a <code>'\00'</code>
+ * @return {@code non-null;} encoded byte sequence without padding and
+ * terminated with a {@code 0x00} byte
*/
public byte[] convert() {
try {
@@ -169,15 +169,15 @@
/**
* Converts and produces annotations on a stream. Does not write
- * actual bits to the <code>AnnotatedOutput</code>.
+ * actual bits to the {@code AnnotatedOutput}.
*
- * @param prefix null-ok; prefix to attach to each line of output
- * @param debugPrint null-ok; if specified, an alternate output for
+ * @param prefix {@code null-ok;} prefix to attach to each line of output
+ * @param debugPrint {@code null-ok;} if specified, an alternate output for
* annotations
- * @param out null-ok; if specified, where annotations should go
+ * @param out {@code null-ok;} if specified, where annotations should go
* @param consume whether to claim to have consumed output for
- * <code>out</code>
- * @return output sequence
+ * {@code out}
+ * @return {@code non-null;} encoded output
*/
public byte[] convertAndAnnotate(String prefix, PrintWriter debugPrint,
AnnotatedOutput out, boolean consume) {
@@ -272,7 +272,7 @@
* address.
*
* @param curl Current index in locals
- * @return new value for <code>curl</code>
+ * @return new value for {@code curl}
* @throws IOException
*/
private int emitLocalsAtAddress(int curl)
@@ -338,11 +338,11 @@
}
/**
- * Emits all positions that occur at the current <code>address</code>
+ * Emits all positions that occur at the current {@code address}
*
* @param curp Current index in sortedPositions
* @param sortedPositions positions, sorted by ascending address
- * @return new value for <code>curp</code>
+ * @return new value for {@code curp}
* @throws IOException
*/
private int emitPositionsAtAddress(int curp,
@@ -507,7 +507,7 @@
/**
* Gets the register that begins the method's parameter range (including
* the 'this' parameter for non-static methods). The range continues until
- * <code>regSize</code>
+ * {@code regSize}
*
* @return register as noted above
*/
@@ -521,7 +521,7 @@
* from the input list and sorted by ascending register in the
* returned list.
*
- * @return list of non-<code>this</code> method argument locals,
+ * @return list of non-{@code this} method argument locals,
* sorted by ascending register
*/
private ArrayList<LocalList.Entry> extractMethodArguments() {
@@ -566,8 +566,8 @@
* Returns a string representation of this LocalList entry that is
* appropriate for emitting as an annotation.
*
- * @param e non-null; entry
- * @return non-null; annotation string
+ * @param e {@code non-null;} entry
+ * @return {@code non-null;} annotation string
*/
private String entryAnnotationString(LocalList.Entry e) {
StringBuilder sb = new StringBuilder();
@@ -633,7 +633,7 @@
* null symbol is used in some cases by the parameter name list
* at the beginning of the sequence.
*
- * @param string null-ok; string to emit
+ * @param string {@code null-ok;} string to emit
* @throws IOException
*/
private void emitStringIndex(CstUtf8 string) throws IOException {
@@ -654,7 +654,7 @@
* Emits a type index as an unsigned LEB128. The actual value written
* is shifted by 1, so that the '0' value is reserved for "null".
*
- * @param type null-ok; type to emit
+ * @param type {@code null-ok;} type to emit
* @throws IOException
*/
private void emitTypeIndex(CstType type) throws IOException {
@@ -739,7 +739,7 @@
/**
* Emits a {@link DebugInfoConstants#DBG_END_LOCAL DBG_END_LOCAL} sequence.
*
- * @param entry entry non-null; entry associated with end.
+ * @param entry {@code entry non-null;} entry associated with end.
* @throws IOException
*/
private void emitLocalEnd(LocalList.Entry entry)
@@ -823,10 +823,11 @@
* Essentially the same as described in "DWARF Debugging Format Version 3"
* section 6.2.5.1.
*
- * @param deltaLines >= DBG_LINE_BASE and <= DBG_LINE_BASE +
- * DBG_LINE_RANGE, the line change to encode
- * @param deltaAddress >= 0; the address change to encode
- * @return <= 0xff if in range, otherwise parameters are out of range
+ * @param deltaLines {@code >= DBG_LINE_BASE, <= DBG_LINE_BASE +
+ * DBG_LINE_RANGE;} the line change to encode
+ * @param deltaAddress {@code >= 0;} the address change to encode
+ * @return {@code <= 0xff} if in range, otherwise parameters are out
+ * of range
*/
private static int computeOpcode(int deltaLines, int deltaAddress) {
if (deltaLines < DBG_LINE_BASE
@@ -867,7 +868,7 @@
* Emits an {@link DebugInfoConstants#DBG_ADVANCE_PC DBG_ADVANCE_PC}
* sequence.
*
- * @param deltaAddress >= 0 amount to change program counter by
+ * @param deltaAddress {@code >= 0;} amount to change program counter by
* @throws IOException
*/
private void emitAdvancePc(int deltaAddress) throws IOException {
@@ -890,8 +891,9 @@
/**
* Emits an unsigned LEB128 value.
*
- * @param n >= 0 vallue to emit. Note that, although this can represent
- * integers larger than Integer.MAX_VALUE, we currently don't allow that.
+ * @param n {@code >= 0;} value to emit. Note that, although this can
+ * represent integers larger than Integer.MAX_VALUE, we currently don't
+ * allow that.
* @throws IOException
*/
private void emitUnsignedLeb128(int n) throws IOException {
diff --git a/dx/src/com/android/dx/dex/file/DebugInfoItem.java b/dx/src/com/android/dx/dex/file/DebugInfoItem.java
index 0e4329b..1c32bd7 100644
--- a/dx/src/com/android/dx/dex/file/DebugInfoItem.java
+++ b/dx/src/com/android/dx/dex/file/DebugInfoItem.java
@@ -34,7 +34,7 @@
private static final boolean ENABLE_ENCODER_SELF_CHECK = false;
- /** non-null; the code this item represents */
+ /** {@code non-null;} the code this item represents */
private final DalvCode code;
private byte[] encoded;
@@ -93,9 +93,9 @@
* directly after a code dump (with the real local list actually
* existing elsewhere in the output).
*
- * @param file non-null; the file to use for referencing other sections
- * @param out non-null; where to annotate to
- * @param prefix null-ok; prefix to attach to each line of output
+ * @param file {@code non-null;} the file to use for referencing other sections
+ * @param out {@code non-null;} where to annotate to
+ * @param prefix {@code null-ok;} prefix to attach to each line of output
*/
public void annotateTo(DexFile file, AnnotatedOutput out, String prefix) {
encode(file, prefix, null, out, false);
@@ -104,8 +104,8 @@
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
- * @param prefix non-null; prefix to attach to each line of output
+ * @param out {@code non-null;} where to dump
+ * @param prefix {@code non-null;} prefix to attach to each line of output
*/
public void debugPrint(PrintWriter out, String prefix) {
encode(null, prefix, out, null, false);
@@ -130,14 +130,14 @@
/**
* Performs debug info encoding.
*
- * @param file null-ok; file to refer to during encoding
- * @param prefix null-ok; prefix to attach to each line of output
- * @param debugPrint null-ok; if specified, an alternate output for
+ * @param file {@code null-ok;} file to refer to during encoding
+ * @param prefix {@code null-ok;} prefix to attach to each line of output
+ * @param debugPrint {@code null-ok;} if specified, an alternate output for
* annotations
- * @param out null-ok; if specified, where annotations should go
+ * @param out {@code null-ok;} if specified, where annotations should go
* @param consume whether to claim to have consumed output for
- * <code>out</code>
- * @return non-null; the encoded array
+ * {@code out}
+ * @return {@code non-null;} the encoded array
*/
private byte[] encode(DexFile file, String prefix, PrintWriter debugPrint,
AnnotatedOutput out, boolean consume) {
@@ -161,14 +161,14 @@
/**
* Helper for {@link #encode} to do most of the work.
*
- * @param file null-ok; file to refer to during encoding
- * @param prefix null-ok; prefix to attach to each line of output
- * @param debugPrint null-ok; if specified, an alternate output for
+ * @param file {@code null-ok;} file to refer to during encoding
+ * @param prefix {@code null-ok;} prefix to attach to each line of output
+ * @param debugPrint {@code null-ok;} if specified, an alternate output for
* annotations
- * @param out null-ok; if specified, where annotations should go
+ * @param out {@code null-ok;} if specified, where annotations should go
* @param consume whether to claim to have consumed output for
- * <code>out</code>
- * @return non-null; the encoded array
+ * {@code out}
+ * @return {@code non-null;} the encoded array
*/
private byte[] encode0(DexFile file, String prefix, PrintWriter debugPrint,
AnnotatedOutput out, boolean consume) {
diff --git a/dx/src/com/android/dx/dex/file/DexFile.java b/dx/src/com/android/dx/dex/file/DexFile.java
index 8a4075d..a829fed 100644
--- a/dx/src/com/android/dx/dex/file/DexFile.java
+++ b/dx/src/com/android/dx/dex/file/DexFile.java
@@ -38,67 +38,67 @@
import static com.android.dx.dex.file.MixedItemSection.SortType;
/**
- * Representation of an entire <code>.dex</code> (Dalvik EXecutable)
+ * Representation of an entire {@code .dex} (Dalvik EXecutable)
* file, which itself consists of a set of Dalvik classes.
*/
public final class DexFile {
- /** non-null; word data section */
+ /** {@code non-null;} word data section */
private final MixedItemSection wordData;
/**
- * non-null; type lists section. This is word data, but separating
+ * {@code non-null;} type lists section. This is word data, but separating
* it from {@link #wordData} helps break what would otherwise be a
* circular dependency between the that and {@link #protoIds}.
*/
private final MixedItemSection typeLists;
/**
- * non-null; map section. The map needs to be in a section by itself
+ * {@code non-null;} map section. The map needs to be in a section by itself
* for the self-reference mechanics to work in a reasonably
* straightforward way. See {@link MapItem#addMap} for more detail.
*/
private final MixedItemSection map;
- /** non-null; string data section */
+ /** {@code non-null;} string data section */
private final MixedItemSection stringData;
- /** non-null; string identifiers section */
+ /** {@code non-null;} string identifiers section */
private final StringIdsSection stringIds;
- /** non-null; type identifiers section */
+ /** {@code non-null;} type identifiers section */
private final TypeIdsSection typeIds;
- /** non-null; prototype identifiers section */
+ /** {@code non-null;} prototype identifiers section */
private final ProtoIdsSection protoIds;
- /** non-null; field identifiers section */
+ /** {@code non-null;} field identifiers section */
private final FieldIdsSection fieldIds;
- /** non-null; method identifiers section */
+ /** {@code non-null;} method identifiers section */
private final MethodIdsSection methodIds;
- /** non-null; class definitions section */
+ /** {@code non-null;} class definitions section */
private final ClassDefsSection classDefs;
- /** non-null; class data section */
+ /** {@code non-null;} class data section */
private final MixedItemSection classData;
- /** non-null; byte data section */
+ /** {@code non-null;} byte data section */
private final MixedItemSection byteData;
- /** non-null; file header */
+ /** {@code non-null;} file header */
private final HeaderSection header;
/**
- * non-null; array of sections in the order they will appear in the
+ * {@code non-null;} array of sections in the order they will appear in the
* final output file
*/
private final Section[] sections;
- /** >= -1; total file size or <code>-1</code> if unknown */
+ /** {@code >= -1;} total file size or {@code -1} if unknown */
private int fileSize;
- /** >= 40; maximum width of the file dump */
+ /** {@code >= 40;} maximum width of the file dump */
private int dumpWidth;
/**
@@ -137,7 +137,7 @@
* Adds a class to this instance. It is illegal to attempt to add more
* than one class with the same name.
*
- * @param clazz non-null; the class to add
+ * @param clazz {@code non-null;} the class to add
*/
public void add(ClassDefItem clazz) {
classDefs.add(clazz);
@@ -146,8 +146,8 @@
/**
* Gets the class definition with the given name, if any.
*
- * @param name non-null; the class name to look for
- * @return null-ok; the class with the given name, or <code>null</code>
+ * @param name {@code non-null;} the class name to look for
+ * @return {@code null-ok;} the class with the given name, or {@code null}
* if there is no such class
*/
public ClassDefItem getClassOrNull(String name) {
@@ -164,8 +164,8 @@
* Writes the contents of this instance as either a binary or a
* human-readable form, or both.
*
- * @param out null-ok; where to write to
- * @param humanOut null-ok; where to write human-oriented output to
+ * @param out {@code null-ok;} where to write to
+ * @param humanOut {@code null-ok;} where to write human-oriented output to
* @param verbose whether to be verbose when writing human-oriented output
*/
public void writeTo(OutputStream out, Writer humanOut, boolean verbose)
@@ -183,12 +183,12 @@
}
/**
- * Returns the contents of this instance as a <code>.dex</code> file,
- * in <code>byte[]</code> form.
+ * Returns the contents of this instance as a {@code .dex} file,
+ * in {@code byte[]} form.
*
- * @param humanOut null-ok; where to write human-oriented output to
+ * @param humanOut {@code null-ok;} where to write human-oriented output to
* @param verbose whether to be verbose when writing human-oriented output
- * @return non-null; a <code>.dex</code> file for this instance
+ * @return {@code non-null;} a {@code .dex} file for this instance
*/
public byte[] toDex(Writer humanOut, boolean verbose)
throws IOException {
@@ -205,7 +205,7 @@
/**
* Sets the maximum width of the human-oriented dump of the instance.
*
- * @param dumpWidth >= 40; the width
+ * @param dumpWidth {@code >= 40;} the width
*/
public void setDumpWidth(int dumpWidth) {
if (dumpWidth < 40) {
@@ -221,7 +221,7 @@
* <p>This is package-scope in order to allow
* the {@link HeaderSection} to set itself up properly.</p>
*
- * @return >= 0; the total file size
+ * @return {@code >= 0;} the total file size
* @throws RuntimeException thrown if the file size is not yet known
*/
/*package*/ int getFileSize() {
@@ -239,7 +239,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the string data section
+ * @return {@code non-null;} the string data section
*/
/*package*/ MixedItemSection getStringData() {
return stringData;
@@ -252,7 +252,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the word data section
+ * @return {@code non-null;} the word data section
*/
/*package*/ MixedItemSection getWordData() {
return wordData;
@@ -265,7 +265,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the word data section
+ * @return {@code non-null;} the word data section
*/
/*package*/ MixedItemSection getTypeLists() {
return typeLists;
@@ -277,7 +277,7 @@
* <p>This is package-scope in order to allow the header section
* to query it.</p>
*
- * @return non-null; the map section
+ * @return {@code non-null;} the map section
*/
/*package*/ MixedItemSection getMap() {
return map;
@@ -290,7 +290,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the string identifiers section
+ * @return {@code non-null;} the string identifiers section
*/
/*package*/ StringIdsSection getStringIds() {
return stringIds;
@@ -303,7 +303,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the class definitions section
+ * @return {@code non-null;} the class definitions section
*/
/*package*/ ClassDefsSection getClassDefs() {
return classDefs;
@@ -316,7 +316,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the class data section
+ * @return {@code non-null;} the class data section
*/
/*package*/ MixedItemSection getClassData() {
return classData;
@@ -329,7 +329,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the class identifiers section
+ * @return {@code non-null;} the class identifiers section
*/
/*package*/ TypeIdsSection getTypeIds() {
return typeIds;
@@ -342,7 +342,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the prototype identifiers section
+ * @return {@code non-null;} the prototype identifiers section
*/
/*package*/ ProtoIdsSection getProtoIds() {
return protoIds;
@@ -355,7 +355,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the field identifiers section
+ * @return {@code non-null;} the field identifiers section
*/
/*package*/ FieldIdsSection getFieldIds() {
return fieldIds;
@@ -368,7 +368,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the method identifiers section
+ * @return {@code non-null;} the method identifiers section
*/
/*package*/ MethodIdsSection getMethodIds() {
return methodIds;
@@ -381,7 +381,7 @@
* the various {@link Item} instances to add items to the
* instance.</p>
*
- * @return non-null; the byte data section
+ * @return {@code non-null;} the byte data section
*/
/*package*/ MixedItemSection getByteData() {
return byteData;
@@ -394,7 +394,7 @@
* <p>This is package-scope in order to allow the header section
* to query it.</p>
*
- * @return non-null; the section
+ * @return {@code non-null;} the section
*/
/*package*/ Section getFirstDataSection() {
return wordData;
@@ -407,7 +407,7 @@
* <p>This is package-scope in order to allow the header section
* to query it.</p>
*
- * @return non-null; the section
+ * @return {@code non-null;} the section
*/
/*package*/ Section getLastDataSection() {
return map;
@@ -418,7 +418,7 @@
* instance, or do nothing if the given constant isn't the sort
* that should be interned.
*
- * @param cst non-null; constant to possibly intern
+ * @param cst {@code non-null;} constant to possibly intern
*/
/*package*/ void internIfAppropriate(Constant cst) {
if (cst instanceof CstString) {
@@ -441,13 +441,13 @@
/**
* Gets the {@link IndexedItem} corresponding to the given constant,
* if it is a constant that has such a correspondence, or return
- * <code>null</code> if it isn't such a constant. This will throw
+ * {@code null} if it isn't such a constant. This will throw
* an exception if the given constant <i>should</i> have been found
* but wasn't.
*
- * @param cst non-null; the constant to look up
- * @return null-ok; its corresponding item, if it has a corresponding
- * item, or <code>null</code> if it's not that sort of constant
+ * @param cst {@code non-null;} the constant to look up
+ * @return {@code null-ok;} its corresponding item, if it has a corresponding
+ * item, or {@code null} if it's not that sort of constant
*/
/*package*/ IndexedItem findItemOrNull(Constant cst) {
IndexedItem item;
@@ -466,12 +466,12 @@
}
/**
- * Returns the contents of this instance as a <code>.dex</code> file,
+ * Returns the contents of this instance as a {@code .dex} file,
* in a {@link ByteArrayAnnotatedOutput} instance.
*
* @param annotate whether or not to keep annotations
* @param verbose if annotating, whether to be verbose
- * @return non-null; a <code>.dex</code> file for this instance
+ * @return {@code non-null;} a {@code .dex} file for this instance
*/
private ByteArrayAnnotatedOutput toDex0(boolean annotate,
boolean verbose) {
@@ -586,7 +586,7 @@
/**
* Generates and returns statistics for all the items in the file.
*
- * @return non-null; the statistics
+ * @return {@code non-null;} the statistics
*/
public Statistics getStatistics() {
Statistics stats = new Statistics();
@@ -599,10 +599,10 @@
}
/**
- * Calculates the signature for the <code>.dex</code> file in the
+ * Calculates the signature for the {@code .dex} file in the
* given array, and modify the array to contain it.
*
- * @param bytes non-null; the bytes of the file
+ * @param bytes {@code non-null;} the bytes of the file
*/
private static void calcSignature(byte[] bytes) {
MessageDigest md;
@@ -627,10 +627,10 @@
}
/**
- * Calculates the checksum for the <code>.dex</code> file in the
+ * Calculates the checksum for the {@code .dex} file in the
* given array, and modify the array to contain it.
*
- * @param bytes non-null; the bytes of the file
+ * @param bytes {@code non-null;} the bytes of the file
*/
private static void calcChecksum(byte[] bytes) {
Adler32 a32 = new Adler32();
diff --git a/dx/src/com/android/dx/dex/file/EncodedArrayItem.java b/dx/src/com/android/dx/dex/file/EncodedArrayItem.java
index 9ec72fa..c55c6f5 100644
--- a/dx/src/com/android/dx/dex/file/EncodedArrayItem.java
+++ b/dx/src/com/android/dx/dex/file/EncodedArrayItem.java
@@ -36,11 +36,11 @@
/** the required alignment for instances of this class */
private static final int ALIGNMENT = 1;
- /** non-null; the array to represent */
+ /** {@code non-null;} the array to represent */
private final CstArray array;
/**
- * null-ok; encoded form, ready for writing to a file; set during
+ * {@code null-ok;} encoded form, ready for writing to a file; set during
* {@link #place0}
*/
private byte[] encodedForm;
@@ -48,7 +48,7 @@
/**
* Constructs an instance.
*
- * @param array non-null; array to represent
+ * @param array {@code non-null;} array to represent
*/
public EncodedArrayItem(CstArray array) {
/*
diff --git a/dx/src/com/android/dx/dex/file/EncodedField.java b/dx/src/com/android/dx/dex/file/EncodedField.java
index 62a5789..146a604 100644
--- a/dx/src/com/android/dx/dex/file/EncodedField.java
+++ b/dx/src/com/android/dx/dex/file/EncodedField.java
@@ -30,13 +30,13 @@
*/
public final class EncodedField extends EncodedMember
implements Comparable<EncodedField> {
- /** non-null; constant for the field */
+ /** {@code non-null;} constant for the field */
private final CstFieldRef field;
/**
* Constructs an instance.
*
- * @param field non-null; constant for the field
+ * @param field {@code non-null;} constant for the field
* @param accessFlags access flags
*/
public EncodedField(CstFieldRef field, int accessFlags) {
@@ -122,7 +122,7 @@
/**
* Gets the constant for the field.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public CstFieldRef getRef() {
return field;
diff --git a/dx/src/com/android/dx/dex/file/EncodedMember.java b/dx/src/com/android/dx/dex/file/EncodedMember.java
index 3ae0d09..68119f3 100644
--- a/dx/src/com/android/dx/dex/file/EncodedMember.java
+++ b/dx/src/com/android/dx/dex/file/EncodedMember.java
@@ -51,14 +51,14 @@
/**
* Gets the name.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public abstract CstUtf8 getName();
/**
* Does a human-friendly dump of this instance.
*
- * @param out non-null; where to dump
+ * @param out {@code non-null;} where to dump
* @param verbose whether to be verbose with the output
*/
public abstract void debugPrint(PrintWriter out, boolean verbose);
@@ -66,20 +66,20 @@
/**
* Populates a {@link DexFile} with items from within this instance.
*
- * @param file non-null; the file to populate
+ * @param file {@code non-null;} the file to populate
*/
public abstract void addContents(DexFile file);
/**
* Encodes this instance to the given output.
*
- * @param file non-null; file this instance is part of
- * @param out non-null; where to write to
- * @param lastIndex >= 0; the previous member index value encoded, or
- * <code>0</code> if this is the first element to encode
- * @param dumpSeq >= 0; sequence number of this instance for
+ * @param file {@code non-null;} file this instance is part of
+ * @param out {@code non-null;} where to write to
+ * @param lastIndex {@code >= 0;} the previous member index value encoded, or
+ * {@code 0} if this is the first element to encode
+ * @param dumpSeq {@code >= 0;} sequence number of this instance for
* annotation purposes
- * @return >= 0; the member index value that was encoded
+ * @return {@code >= 0;} the member index value that was encoded
*/
public abstract int encode(DexFile file, AnnotatedOutput out,
int lastIndex, int dumpSeq);
diff --git a/dx/src/com/android/dx/dex/file/EncodedMethod.java b/dx/src/com/android/dx/dex/file/EncodedMethod.java
index 319fbb7..dff1a07 100644
--- a/dx/src/com/android/dx/dex/file/EncodedMethod.java
+++ b/dx/src/com/android/dx/dex/file/EncodedMethod.java
@@ -32,23 +32,23 @@
*/
public final class EncodedMethod extends EncodedMember
implements Comparable<EncodedMethod> {
- /** non-null; constant for the method */
+ /** {@code non-null;} constant for the method */
private final CstMethodRef method;
/**
- * null-ok; code for the method, if the method is neither
- * <code>abstract</code> nor <code>native</code>
+ * {@code null-ok;} code for the method, if the method is neither
+ * {@code abstract} nor {@code native}
*/
private final CodeItem code;
/**
* Constructs an instance.
*
- * @param method non-null; constant for the method
+ * @param method {@code non-null;} constant for the method
* @param accessFlags access flags
- * @param code null-ok; code for the method, if it is neither
- * <code>abstract</code> nor <code>native</code>
- * @param throwsList non-null; list of possibly-thrown exceptions,
+ * @param code {@code null-ok;} code for the method, if it is neither
+ * {@code abstract} nor {@code native}
+ * @param throwsList {@code non-null;} list of possibly-thrown exceptions,
* just used in generating debugging output (listings)
*/
public EncodedMethod(CstMethodRef method, int accessFlags,
@@ -148,7 +148,7 @@
/**
* Gets the constant for the method.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public final CstMethodRef getRef() {
return method;
diff --git a/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java b/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java
index e6169bd..6a76ca9 100644
--- a/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java
+++ b/dx/src/com/android/dx/dex/file/FieldAnnotationStruct.java
@@ -27,17 +27,17 @@
*/
public final class FieldAnnotationStruct
implements ToHuman, Comparable<FieldAnnotationStruct> {
- /** non-null; the field in question */
+ /** {@code non-null;} the field in question */
private final CstFieldRef field;
- /** non-null; the associated annotations */
+ /** {@code non-null;} the associated annotations */
private AnnotationSetItem annotations;
/**
* Constructs an instance.
*
- * @param field non-null; the field in question
- * @param annotations non-null; the associated annotations
+ * @param field {@code non-null;} the field in question
+ * @param annotations {@code non-null;} the associated annotations
*/
public FieldAnnotationStruct(CstFieldRef field,
AnnotationSetItem annotations) {
@@ -105,7 +105,7 @@
/**
* Gets the field this item is for.
*
- * @return non-null; the field
+ * @return {@code non-null;} the field
*/
public CstFieldRef getField() {
return field;
@@ -114,7 +114,7 @@
/**
* Gets the associated annotations.
*
- * @return non-null; the annotations
+ * @return {@code non-null;} the annotations
*/
public Annotations getAnnotations() {
return annotations.getAnnotations();
diff --git a/dx/src/com/android/dx/dex/file/FieldIdItem.java b/dx/src/com/android/dx/dex/file/FieldIdItem.java
index d098d52..d6d01d5 100644
--- a/dx/src/com/android/dx/dex/file/FieldIdItem.java
+++ b/dx/src/com/android/dx/dex/file/FieldIdItem.java
@@ -25,7 +25,7 @@
/**
* Constructs an instance.
*
- * @param field non-null; the constant for the field
+ * @param field {@code non-null;} the constant for the field
*/
public FieldIdItem(CstFieldRef field) {
super(field);
@@ -49,7 +49,7 @@
/**
* Gets the field constant.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public CstFieldRef getFieldRef() {
return (CstFieldRef) getRef();
diff --git a/dx/src/com/android/dx/dex/file/FieldIdsSection.java b/dx/src/com/android/dx/dex/file/FieldIdsSection.java
index fddf55f..59ef229 100644
--- a/dx/src/com/android/dx/dex/file/FieldIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/FieldIdsSection.java
@@ -25,11 +25,11 @@
import java.util.TreeMap;
/**
- * Field refs list section of a <code>.dex</code> file.
+ * Field refs list section of a {@code .dex} file.
*/
public final class FieldIdsSection extends MemberIdsSection {
/**
- * non-null; map from field constants to {@link
+ * {@code non-null;} map from field constants to {@link
* FieldIdItem} instances
*/
private final TreeMap<CstFieldRef, FieldIdItem> fieldIds;
@@ -37,7 +37,7 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public FieldIdsSection(DexFile file) {
super("field_ids", file);
@@ -72,7 +72,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -92,8 +92,8 @@
/**
* Interns an element into this instance.
*
- * @param field non-null; the reference to intern
- * @return non-null; the interned reference
+ * @param field {@code non-null;} the reference to intern
+ * @return {@code non-null;} the interned reference
*/
public FieldIdItem intern(CstFieldRef field) {
if (field == null) {
@@ -116,8 +116,8 @@
* Gets the index of the given reference, which must have been added
* to this instance.
*
- * @param ref non-null; the reference to look up
- * @return >= 0; the reference's index
+ * @param ref {@code non-null;} the reference to look up
+ * @return {@code >= 0;} the reference's index
*/
public int indexOf(CstFieldRef ref) {
if (ref == null) {
diff --git a/dx/src/com/android/dx/dex/file/HeaderItem.java b/dx/src/com/android/dx/dex/file/HeaderItem.java
index 55c1f1c..6593859 100644
--- a/dx/src/com/android/dx/dex/file/HeaderItem.java
+++ b/dx/src/com/android/dx/dex/file/HeaderItem.java
@@ -21,11 +21,11 @@
import com.android.dx.util.Hex;
/**
- * File header section of a <code>.dex</code> file.
+ * File header section of a {@code .dex} file.
*/
public final class HeaderItem extends IndexedItem {
/**
- * non-null; the file format magic number, represented as the
+ * {@code non-null;} the file format magic number, represented as the
* low-order bytes of a string
*/
private static final String MAGIC = "dex\n035\0";
diff --git a/dx/src/com/android/dx/dex/file/HeaderSection.java b/dx/src/com/android/dx/dex/file/HeaderSection.java
index 9022e0f..5bc6278 100644
--- a/dx/src/com/android/dx/dex/file/HeaderSection.java
+++ b/dx/src/com/android/dx/dex/file/HeaderSection.java
@@ -23,16 +23,16 @@
import java.util.List;
/**
- * File header section of a <code>.dex</code> file.
+ * File header section of a {@code .dex} file.
*/
public final class HeaderSection extends UniformItemSection {
- /** non-null; the list of the one item in the section */
+ /** {@code non-null;} the list of the one item in the section */
private final List<HeaderItem> list;
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public HeaderSection(DexFile file) {
super(null, file, 4);
diff --git a/dx/src/com/android/dx/dex/file/IdItem.java b/dx/src/com/android/dx/dex/file/IdItem.java
index 8342514..5d7c9e3 100644
--- a/dx/src/com/android/dx/dex/file/IdItem.java
+++ b/dx/src/com/android/dx/dex/file/IdItem.java
@@ -23,7 +23,7 @@
*/
public abstract class IdItem extends IndexedItem {
/**
- * non-null; the type constant for the defining class of
+ * {@code non-null;} the type constant for the defining class of
* the reference
*/
private final CstType type;
@@ -31,7 +31,7 @@
/**
* Constructs an instance.
*
- * @param type non-null; the type constant for the defining
+ * @param type {@code non-null;} the type constant for the defining
* class of the reference
*/
public IdItem(CstType type) {
@@ -53,7 +53,7 @@
* Gets the type constant for the defining class of the
* reference.
*
- * @return non-null; the type constant
+ * @return {@code non-null;} the type constant
*/
public final CstType getDefiningClass() {
return type;
diff --git a/dx/src/com/android/dx/dex/file/IndexedItem.java b/dx/src/com/android/dx/dex/file/IndexedItem.java
index 9bf7fd2..32d69ea 100644
--- a/dx/src/com/android/dx/dex/file/IndexedItem.java
+++ b/dx/src/com/android/dx/dex/file/IndexedItem.java
@@ -20,7 +20,7 @@
* An item in a Dalvik file which is referenced by index.
*/
public abstract class IndexedItem extends Item {
- /** >= -1; assigned index of the item, or <code>-1</code> if not
+ /** {@code >= -1;} assigned index of the item, or {@code -1} if not
* yet assigned */
private int index;
@@ -34,7 +34,7 @@
/**
* Gets whether or not this instance has been assigned an index.
*
- * @return <code>true</code> iff this instance has been assigned an index
+ * @return {@code true} iff this instance has been assigned an index
*/
public final boolean hasIndex() {
return (index >= 0);
@@ -43,7 +43,7 @@
/**
* Gets the item index.
*
- * @return >= 0; the index
+ * @return {@code >= 0;} the index
* @throws RuntimeException thrown if the item index is not yet assigned
*/
public final int getIndex() {
@@ -56,10 +56,10 @@
/**
* Sets the item index. This method may only ever be called once
- * per instance, and this will throw a <code>RuntimeException</code> if
+ * per instance, and this will throw a {@code RuntimeException} if
* called a second (or subsequent) time.
*
- * @param index >= 0; the item index
+ * @param index {@code >= 0;} the item index
*/
public final void setIndex(int index) {
if (this.index != -1) {
@@ -73,7 +73,7 @@
* Gets the index of this item as a string, suitable for including in
* annotations.
*
- * @return non-null; the index string
+ * @return {@code non-null;} the index string
*/
public final String indexString() {
return '[' + Integer.toHexString(index) + ']';
diff --git a/dx/src/com/android/dx/dex/file/Item.java b/dx/src/com/android/dx/dex/file/Item.java
index 3708d45..057f218 100644
--- a/dx/src/com/android/dx/dex/file/Item.java
+++ b/dx/src/com/android/dx/dex/file/Item.java
@@ -33,7 +33,7 @@
/**
* Returns the item type for this instance.
*
- * @return non-null; the item type
+ * @return {@code non-null;} the item type
*/
public abstract ItemType itemType();
@@ -41,7 +41,7 @@
* Returns the human name for the particular type of item this
* instance is.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public final String typeName() {
return itemType().toHuman();
@@ -50,7 +50,7 @@
/**
* Gets the size of this instance when written, in bytes.
*
- * @return >= 0; the write size
+ * @return {@code >= 0;} the write size
*/
public abstract int writeSize();
@@ -62,7 +62,7 @@
* <p><b>Note:</b> Subclasses must override this to do something
* appropriate.</p>
*
- * @param file non-null; the file to populate
+ * @param file {@code non-null;} the file to populate
*/
public abstract void addContents(DexFile file);
@@ -73,8 +73,8 @@
* note the written offset and will also throw an exception if this
* instance has already been written.
*
- * @param file non-null; the file to use for reference
- * @param out non-null; where to write to
+ * @param file {@code non-null;} the file to use for reference
+ * @param out {@code non-null;} where to write to
*/
public abstract void writeTo(DexFile file, AnnotatedOutput out);
}
diff --git a/dx/src/com/android/dx/dex/file/ItemType.java b/dx/src/com/android/dx/dex/file/ItemType.java
index ffa6573..83843b7 100644
--- a/dx/src/com/android/dx/dex/file/ItemType.java
+++ b/dx/src/com/android/dx/dex/file/ItemType.java
@@ -48,17 +48,17 @@
/** value when represented in a {@link MapItem} */
private final int mapValue;
- /** non-null; name of the type */
+ /** {@code non-null;} name of the type */
private final String typeName;
- /** non-null; the short human name */
+ /** {@code non-null;} the short human name */
private final String humanName;
/**
* Constructs an instance.
*
* @param mapValue value when represented in a {@link MapItem}
- * @param typeName non-null; name of the type
+ * @param typeName {@code non-null;} name of the type
*/
private ItemType(int mapValue, String typeName) {
this.mapValue = mapValue;
@@ -84,7 +84,7 @@
/**
* Gets the type name.
*
- * @return non-null; the type name
+ * @return {@code non-null;} the type name
*/
public String getTypeName() {
return typeName;
diff --git a/dx/src/com/android/dx/dex/file/MapItem.java b/dx/src/com/android/dx/dex/file/MapItem.java
index 5e7465c..c728dd7 100644
--- a/dx/src/com/android/dx/dex/file/MapItem.java
+++ b/dx/src/com/android/dx/dex/file/MapItem.java
@@ -28,29 +28,29 @@
/** file alignment of this class, in bytes */
private static final int ALIGNMENT = 4;
- /** write size of this class, in bytes: three <code>uint</code>s */
+ /** write size of this class, in bytes: three {@code uint}s */
private static final int WRITE_SIZE = (4 * 3);
- /** non-null; item type this instance covers */
+ /** {@code non-null;} item type this instance covers */
private final ItemType type;
- /** non-null; section this instance covers */
+ /** {@code non-null;} section this instance covers */
private final Section section;
/**
- * null-ok; first item covered or <code>null</code> if this is
+ * {@code null-ok;} first item covered or {@code null} if this is
* a self-reference
*/
private final Item firstItem;
/**
- * null-ok; last item covered or <code>null</code> if this is
+ * {@code null-ok;} last item covered or {@code null} if this is
* a self-reference
*/
private final Item lastItem;
/**
- * > 0; count of items covered; <code>1</code> if this
+ * {@code > 0;} count of items covered; {@code 1} if this
* is a self-reference
*/
private final int itemCount;
@@ -60,8 +60,8 @@
* the contents of the given array of sections, adding it to the
* given map section.
*
- * @param sections non-null; the sections
- * @param mapSection non-null; the section that the resulting map
+ * @param sections {@code non-null;} the sections
+ * @param mapSection {@code non-null;} the section that the resulting map
* should be added to; it should be empty on entry to this method
*/
public static void addMap(Section[] sections,
@@ -115,11 +115,11 @@
/**
* Constructs an instance.
*
- * @param type non-null; item type this instance covers
- * @param section non-null; section this instance covers
- * @param firstItem non-null; first item covered
- * @param lastItem non-null; last item covered
- * @param itemCount > 0; count of items covered
+ * @param type {@code non-null;} item type this instance covers
+ * @param section {@code non-null;} section this instance covers
+ * @param firstItem {@code non-null;} first item covered
+ * @param lastItem {@code non-null;} last item covered
+ * @param itemCount {@code > 0;} count of items covered
*/
private MapItem(ItemType type, Section section, Item firstItem,
Item lastItem, int itemCount) {
@@ -154,9 +154,9 @@
/**
* Constructs a self-referential instance. This instance is meant to
- * represent the section containing the <code>map_list</code>.
+ * represent the section containing the {@code map_list}.
*
- * @param section non-null; section this instance covers
+ * @param section {@code non-null;} section this instance covers
*/
private MapItem(Section section) {
super(ALIGNMENT, WRITE_SIZE);
diff --git a/dx/src/com/android/dx/dex/file/MemberIdItem.java b/dx/src/com/android/dx/dex/file/MemberIdItem.java
index d437152..574d413 100644
--- a/dx/src/com/android/dx/dex/file/MemberIdItem.java
+++ b/dx/src/com/android/dx/dex/file/MemberIdItem.java
@@ -29,13 +29,13 @@
/** size of instances when written out to a file, in bytes */
public static final int WRITE_SIZE = 8;
- /** non-null; the constant for the member */
+ /** {@code non-null;} the constant for the member */
private final CstMemberRef cst;
/**
* Constructs an instance.
*
- * @param cst non-null; the constant for the member
+ * @param cst {@code non-null;} the constant for the member
*/
public MemberIdItem(CstMemberRef cst) {
super(cst.getDefiningClass());
@@ -86,7 +86,7 @@
* this item, in order that it may be written out. Subclasses must
* override this to get whatever it is they need to store.
*
- * @param file non-null; the file being written
+ * @param file {@code non-null;} the file being written
* @return the index in question
*/
protected abstract int getTypoidIdx(DexFile file);
@@ -96,14 +96,14 @@
* this item, for listing-generating purposes. Subclasses must override
* this.
*
- * @return non-null; the name in question
+ * @return {@code non-null;} the name in question
*/
protected abstract String getTypoidName();
/**
* Gets the member constant.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public final CstMemberRef getRef() {
return cst;
diff --git a/dx/src/com/android/dx/dex/file/MemberIdsSection.java b/dx/src/com/android/dx/dex/file/MemberIdsSection.java
index 885b559..20b1605 100644
--- a/dx/src/com/android/dx/dex/file/MemberIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/MemberIdsSection.java
@@ -17,15 +17,15 @@
package com.android.dx.dex.file;
/**
- * Member (field or method) refs list section of a <code>.dex</code> file.
+ * Member (field or method) refs list section of a {@code .dex} file.
*/
public abstract class MemberIdsSection extends UniformItemSection {
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param name null-ok; the name of this instance, for annotation
+ * @param name {@code null-ok;} the name of this instance, for annotation
* purposes
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public MemberIdsSection(String name, DexFile file) {
super(name, file, 4);
diff --git a/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java b/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java
index 175c1d2..3c254a1 100644
--- a/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java
+++ b/dx/src/com/android/dx/dex/file/MethodAnnotationStruct.java
@@ -27,17 +27,17 @@
*/
public final class MethodAnnotationStruct
implements ToHuman, Comparable<MethodAnnotationStruct> {
- /** non-null; the method in question */
+ /** {@code non-null;} the method in question */
private final CstMethodRef method;
- /** non-null; the associated annotations */
+ /** {@code non-null;} the associated annotations */
private AnnotationSetItem annotations;
/**
* Constructs an instance.
*
- * @param method non-null; the method in question
- * @param annotations non-null; the associated annotations
+ * @param method {@code non-null;} the method in question
+ * @param annotations {@code non-null;} the associated annotations
*/
public MethodAnnotationStruct(CstMethodRef method,
AnnotationSetItem annotations) {
@@ -105,7 +105,7 @@
/**
* Gets the method this item is for.
*
- * @return non-null; the method
+ * @return {@code non-null;} the method
*/
public CstMethodRef getMethod() {
return method;
@@ -114,7 +114,7 @@
/**
* Gets the associated annotations.
*
- * @return non-null; the annotations
+ * @return {@code non-null;} the annotations
*/
public Annotations getAnnotations() {
return annotations.getAnnotations();
diff --git a/dx/src/com/android/dx/dex/file/MethodIdItem.java b/dx/src/com/android/dx/dex/file/MethodIdItem.java
index 5d78e96..bbd6c93 100644
--- a/dx/src/com/android/dx/dex/file/MethodIdItem.java
+++ b/dx/src/com/android/dx/dex/file/MethodIdItem.java
@@ -25,7 +25,7 @@
/**
* Constructs an instance.
*
- * @param method non-null; the constant for the method
+ * @param method {@code non-null;} the constant for the method
*/
public MethodIdItem(CstBaseMethodRef method) {
super(method);
@@ -49,7 +49,7 @@
/**
* Gets the method constant.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public CstBaseMethodRef getMethodRef() {
return (CstBaseMethodRef) getRef();
diff --git a/dx/src/com/android/dx/dex/file/MethodIdsSection.java b/dx/src/com/android/dx/dex/file/MethodIdsSection.java
index 6ba7cac..f3e7dee 100644
--- a/dx/src/com/android/dx/dex/file/MethodIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/MethodIdsSection.java
@@ -25,11 +25,11 @@
import java.util.TreeMap;
/**
- * Method refs list section of a <code>.dex</code> file.
+ * Method refs list section of a {@code .dex} file.
*/
public final class MethodIdsSection extends MemberIdsSection {
/**
- * non-null; map from method constants to {@link
+ * {@code non-null;} map from method constants to {@link
* MethodIdItem} instances
*/
private final TreeMap<CstBaseMethodRef, MethodIdItem> methodIds;
@@ -37,7 +37,7 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public MethodIdsSection(DexFile file) {
super("method_ids", file);
@@ -72,7 +72,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -92,8 +92,8 @@
/**
* Interns an element into this instance.
*
- * @param method non-null; the reference to intern
- * @return non-null; the interned reference
+ * @param method {@code non-null;} the reference to intern
+ * @return {@code non-null;} the interned reference
*/
public MethodIdItem intern(CstBaseMethodRef method) {
if (method == null) {
@@ -116,8 +116,8 @@
* Gets the index of the given reference, which must have been added
* to this instance.
*
- * @param ref non-null; the reference to look up
- * @return >= 0; the reference's index
+ * @param ref {@code non-null;} the reference to look up
+ * @return {@code >= 0;} the reference's index
*/
public int indexOf(CstBaseMethodRef ref) {
if (ref == null) {
diff --git a/dx/src/com/android/dx/dex/file/MixedItemSection.java b/dx/src/com/android/dx/dex/file/MixedItemSection.java
index f03a9a3..0929fe7 100644
--- a/dx/src/com/android/dx/dex/file/MixedItemSection.java
+++ b/dx/src/com/android/dx/dex/file/MixedItemSection.java
@@ -31,7 +31,7 @@
import java.util.TreeMap;
/**
- * A section of a <code>.dex</code> file which consists of a sequence of
+ * A section of a {@code .dex} file which consists of a sequence of
* {@link OffsettedItem} objects, which may each be of a different concrete
* class and/or size.
*
@@ -50,7 +50,7 @@
INSTANCE;
};
- /** non-null; sorter which sorts instances by type */
+ /** {@code non-null;} sorter which sorts instances by type */
private static final Comparator<OffsettedItem> TYPE_SORTER =
new Comparator<OffsettedItem>() {
public int compare(OffsettedItem item1, OffsettedItem item2) {
@@ -60,17 +60,17 @@
}
};
- /** non-null; the items in this part */
+ /** {@code non-null;} the items in this part */
private final ArrayList<OffsettedItem> items;
- /** non-null; items that have been explicitly interned */
+ /** {@code non-null;} items that have been explicitly interned */
private final HashMap<OffsettedItem, OffsettedItem> interns;
- /** non-null; how to sort the items */
+ /** {@code non-null;} how to sort the items */
private final SortType sort;
/**
- * >= -1; the current size of this part, in bytes, or <code>-1</code>
+ * {@code >= -1;} the current size of this part, in bytes, or {@code -1}
* if not yet calculated
*/
private int writeSize;
@@ -78,10 +78,10 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param name null-ok; the name of this instance, for annotation
+ * @param name {@code null-ok;} the name of this instance, for annotation
* purposes
- * @param file non-null; file that this instance is part of
- * @param alignment > 0; alignment requirement for the final output;
+ * @param file {@code non-null;} file that this instance is part of
+ * @param alignment {@code > 0;} alignment requirement for the final output;
* must be a power of 2
* @param sort how the items should be sorted in the final output
*/
@@ -118,7 +118,7 @@
/**
* Gets the size of this instance, in items.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int size() {
return items.size();
@@ -127,7 +127,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -164,7 +164,7 @@
* same item to more than one instance, nor to add the same items
* multiple times to a single instance.
*
- * @param item non-null; the item to add
+ * @param item {@code non-null;} the item to add
*/
public void add(OffsettedItem item) {
throwIfPrepared();
@@ -187,8 +187,8 @@
* (which may not be the one passed in). This will add the item if no
* equal item has been added.
*
- * @param item non-null; the item to intern
- * @return non-null; the equivalent interned instance
+ * @param item {@code non-null;} the item to intern
+ * @return {@code non-null;} the equivalent interned instance
*/
public <T extends OffsettedItem> T intern(T item) {
throwIfPrepared();
@@ -207,8 +207,8 @@
/**
* Gets an item which was previously interned.
*
- * @param item non-null; the item to look for
- * @return non-null; the equivalent already-interned instance
+ * @param item {@code non-null;} the item to look for
+ * @return {@code non-null;} the equivalent already-interned instance
*/
public <T extends OffsettedItem> T get(T item) {
throwIfNotPrepared();
@@ -227,9 +227,9 @@
* given type. If there are none, this writes nothing. If there are any,
* then the index is preceded by the given intro string.
*
- * @param out non-null; where to write to
- * @param itemType non-null; the item type of interest
- * @param intro non-null; the introductory string for non-empty indices
+ * @param out {@code non-null;} where to write to
+ * @param itemType {@code non-null;} the item type of interest
+ * @param intro {@code non-null;} the introductory string for non-empty indices
*/
public void writeIndexAnnotation(AnnotatedOutput out, ItemType itemType,
String intro) {
@@ -285,7 +285,7 @@
/**
* Places all the items in this instance at particular offsets. This
* will call {@link OffsettedItem#place} on each item. If an item
- * does not know its write size before the call to <code>place</code>,
+ * does not know its write size before the call to {@code place},
* it is that call which is responsible for setting the write size.
* This method may only be called once per instance; subsequent calls
* will throw an exception.
diff --git a/dx/src/com/android/dx/dex/file/OffsettedItem.java b/dx/src/com/android/dx/dex/file/OffsettedItem.java
index 030c370..18bc439 100644
--- a/dx/src/com/android/dx/dex/file/OffsettedItem.java
+++ b/dx/src/com/android/dx/dex/file/OffsettedItem.java
@@ -24,32 +24,32 @@
*/
public abstract class OffsettedItem extends Item
implements Comparable<OffsettedItem> {
- /** > 0; alignment requirement */
+ /** {@code > 0;} alignment requirement */
private final int alignment;
- /** >= -1; the size of this instance when written, in bytes, or
- * <code>-1</code> if not yet known */
+ /** {@code >= -1;} the size of this instance when written, in bytes, or
+ * {@code -1} if not yet known */
private int writeSize;
/**
- * null-ok; section the item was added to, or <code>null</code> if
+ * {@code null-ok;} section the item was added to, or {@code null} if
* not yet added
*/
private Section addedTo;
/**
- * >= -1; assigned offset of the item from the start of its section,
- * or <code>-1</code> if not yet assigned
+ * {@code >= -1;} assigned offset of the item from the start of its section,
+ * or {@code -1} if not yet assigned
*/
private int offset;
/**
- * Gets the absolute offset of the given item, returning <code>0</code>
- * if handed <code>null</code>.
+ * Gets the absolute offset of the given item, returning {@code 0}
+ * if handed {@code null}.
*
- * @param item null-ok; the item in question
- * @return >= 0; the item's absolute offset, or <code>0</code>
- * if <code>item == null</code>
+ * @param item {@code null-ok;} the item in question
+ * @return {@code >= 0;} the item's absolute offset, or {@code 0}
+ * if {@code item == null}
*/
public static int getAbsoluteOffsetOr0(OffsettedItem item) {
if (item == null) {
@@ -62,10 +62,10 @@
/**
* Constructs an instance. The offset is initially unassigned.
*
- * @param alignment > 0; output alignment requirement; must be a
+ * @param alignment {@code > 0;} output alignment requirement; must be a
* power of 2
- * @param writeSize >= -1; the size of this instance when written,
- * in bytes, or <code>-1</code> if not immediately known
+ * @param writeSize {@code >= -1;} the size of this instance when written,
+ * in bytes, or {@code -1} if not immediately known
*/
public OffsettedItem(int alignment, int writeSize) {
Section.validateAlignment(alignment);
@@ -131,7 +131,7 @@
* per instance, and only if the size was unknown upon instance
* creation.
*
- * @param writeSize > 0; the write size, in bytes
+ * @param writeSize {@code > 0;} the write size, in bytes
*/
public final void setWriteSize(int writeSize) {
if (writeSize < 0) {
@@ -182,7 +182,7 @@
* Gets the relative item offset. The offset is from the start of
* the section which the instance was written to.
*
- * @return >= 0; the offset
+ * @return {@code >= 0;} the offset
* @throws RuntimeException thrown if the offset is not yet known
*/
public final int getRelativeOffset() {
@@ -197,7 +197,7 @@
* Gets the absolute item offset. The offset is from the start of
* the file which the instance was written to.
*
- * @return >= 0; the offset
+ * @return {@code >= 0;} the offset
* @throws RuntimeException thrown if the offset is not yet known
*/
public final int getAbsoluteOffset() {
@@ -213,10 +213,10 @@
* the given offset. It is only valid to call this method once per
* instance.
*
- * @param addedTo non-null; the section this instance has been added to
- * @param offset >= 0; the desired offset from the start of the
+ * @param addedTo {@code non-null;} the section this instance has been added to
+ * @param offset {@code >= 0;} the desired offset from the start of the
* section where this instance was placed
- * @return >= 0; the offset that this instance should be placed at
+ * @return {@code >= 0;} the offset that this instance should be placed at
* in order to meet its alignment constraint
*/
public final int place(Section addedTo, int offset) {
@@ -247,7 +247,7 @@
* Gets the alignment requirement of this instance. An instance should
* only be written when so aligned.
*
- * @return > 0; the alignment requirement; must be a power of 2
+ * @return {@code > 0;} the alignment requirement; must be a power of 2
*/
public final int getAlignment() {
return alignment;
@@ -257,7 +257,7 @@
* Gets the absolute offset of this item as a string, suitable for
* including in annotations.
*
- * @return non-null; the offset string
+ * @return {@code non-null;} the offset string
*/
public final String offsetString() {
return '[' + Integer.toHexString(getAbsoluteOffset()) + ']';
@@ -266,7 +266,7 @@
/**
* Gets a short human-readable string representing this instance.
*
- * @return non-null; the human form
+ * @return {@code non-null;} the human form
*/
public abstract String toHuman();
@@ -277,8 +277,8 @@
* class needs to actually sort, then it should override this
* method.
*
- * @param other non-null; instance to compare to
- * @return <code>-1</code>, <code>0</code>, or <code>1</code>, depending
+ * @param other {@code non-null;} instance to compare to
+ * @return {@code -1}, {@code 0}, or {@code 1}, depending
* on the sort order of this instance and the other
*/
protected int compareTo0(OffsettedItem other) {
@@ -293,8 +293,8 @@
* know its write size up-front, then this method is responsible
* for setting it.
*
- * @param addedTo non-null; the section this instance has been added to
- * @param offset >= 0; the offset from the start of the
+ * @param addedTo {@code non-null;} the section this instance has been added to
+ * @param offset {@code >= 0;} the offset from the start of the
* section where this instance was placed
*/
protected void place0(Section addedTo, int offset) {
@@ -306,8 +306,8 @@
* the given data section. This is called by {@link #writeTo},
* which will have taken care of ensuring alignment.
*
- * @param file non-null; the file to use for reference
- * @param out non-null; where to write to
+ * @param file {@code non-null;} the file to use for reference
+ * @param out {@code non-null;} where to write to
*/
protected abstract void writeTo0(DexFile file, AnnotatedOutput out);
}
diff --git a/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java b/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java
index 0c2d286..46d0450 100644
--- a/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java
+++ b/dx/src/com/android/dx/dex/file/ParameterAnnotationStruct.java
@@ -30,20 +30,20 @@
*/
public final class ParameterAnnotationStruct
implements ToHuman, Comparable<ParameterAnnotationStruct> {
- /** non-null; the method in question */
+ /** {@code non-null;} the method in question */
private final CstMethodRef method;
- /** non-null; the associated annotations list */
+ /** {@code non-null;} the associated annotations list */
private final AnnotationsList annotationsList;
- /** non-null; the associated annotations list, as an item */
+ /** {@code non-null;} the associated annotations list, as an item */
private final UniformListItem<AnnotationSetRefItem> annotationsItem;
/**
* Constructs an instance.
*
- * @param method non-null; the method in question
- * @param annotationsList non-null; the associated annotations list
+ * @param method {@code non-null;} the method in question
+ * @param annotationsList {@code non-null;} the associated annotations list
*/
public ParameterAnnotationStruct(CstMethodRef method,
AnnotationsList annotationsList) {
@@ -144,7 +144,7 @@
/**
* Gets the method this item is for.
*
- * @return non-null; the method
+ * @return {@code non-null;} the method
*/
public CstMethodRef getMethod() {
return method;
@@ -153,7 +153,7 @@
/**
* Gets the associated annotations list.
*
- * @return non-null; the annotations list
+ * @return {@code non-null;} the annotations list
*/
public AnnotationsList getAnnotationsList() {
return annotationsList;
diff --git a/dx/src/com/android/dx/dex/file/ProtoIdItem.java b/dx/src/com/android/dx/dex/file/ProtoIdItem.java
index a144c30..afc227c 100644
--- a/dx/src/com/android/dx/dex/file/ProtoIdItem.java
+++ b/dx/src/com/android/dx/dex/file/ProtoIdItem.java
@@ -31,14 +31,14 @@
/** size of instances when written out to a file, in bytes */
public static final int WRITE_SIZE = 12;
- /** non-null; the wrapped prototype */
+ /** {@code non-null;} the wrapped prototype */
private final Prototype prototype;
- /** non-null; the short-form of the prototype */
+ /** {@code non-null;} the short-form of the prototype */
private final CstUtf8 shortForm;
/**
- * null-ok; the list of parameter types or <code>null</code> if this
+ * {@code null-ok;} the list of parameter types or {@code null} if this
* prototype has no parameters
*/
private TypeListItem parameterTypes;
@@ -46,7 +46,7 @@
/**
* Constructs an instance.
*
- * @param prototype non-null; the constant for the prototype
+ * @param prototype {@code non-null;} the constant for the prototype
*/
public ProtoIdItem(Prototype prototype) {
if (prototype == null) {
@@ -64,8 +64,8 @@
/**
* Creates the short-form of the given prototype.
*
- * @param prototype non-null; the prototype
- * @return non-null; the short form
+ * @param prototype {@code non-null;} the prototype
+ * @return {@code non-null;} the short form
*/
private static CstUtf8 makeShortForm(Prototype prototype) {
StdTypeList parameters = prototype.getParameterTypes();
@@ -84,7 +84,7 @@
/**
* Gets the short-form character for the given type.
*
- * @param type non-null; the type
+ * @param type {@code non-null;} the type
* @return the corresponding short-form character
*/
private static char shortFormCharFor(Type type) {
diff --git a/dx/src/com/android/dx/dex/file/ProtoIdsSection.java b/dx/src/com/android/dx/dex/file/ProtoIdsSection.java
index 852ab9d..8a95434 100644
--- a/dx/src/com/android/dx/dex/file/ProtoIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/ProtoIdsSection.java
@@ -26,18 +26,18 @@
/**
* Proto (method prototype) identifiers list section of a
- * <code>.dex</code> file.
+ * {@code .dex} file.
*/
public final class ProtoIdsSection extends UniformItemSection {
/**
- * non-null; map from method prototypes to {@link ProtoIdItem} instances
+ * {@code non-null;} map from method prototypes to {@link ProtoIdItem} instances
*/
private final TreeMap<Prototype, ProtoIdItem> protoIds;
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public ProtoIdsSection(DexFile file) {
super("proto_ids", file, 4);
@@ -60,7 +60,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -84,8 +84,8 @@
/**
* Interns an element into this instance.
*
- * @param prototype non-null; the prototype to intern
- * @return non-null; the interned reference
+ * @param prototype {@code non-null;} the prototype to intern
+ * @return {@code non-null;} the interned reference
*/
public ProtoIdItem intern(Prototype prototype) {
if (prototype == null) {
@@ -108,8 +108,8 @@
* Gets the index of the given prototype, which must have
* been added to this instance.
*
- * @param prototype non-null; the prototype to look up
- * @return >= 0; the reference's index
+ * @param prototype {@code non-null;} the prototype to look up
+ * @return {@code >= 0;} the reference's index
*/
public int indexOf(Prototype prototype) {
if (prototype == null) {
diff --git a/dx/src/com/android/dx/dex/file/Section.java b/dx/src/com/android/dx/dex/file/Section.java
index 9f7657c..f5b43af 100644
--- a/dx/src/com/android/dx/dex/file/Section.java
+++ b/dx/src/com/android/dx/dex/file/Section.java
@@ -21,22 +21,22 @@
import java.util.Collection;
/**
- * A section of a <code>.dex</code> file. Each section consists of a list
+ * A section of a {@code .dex} file. Each section consists of a list
* of items of some sort or other.
*/
public abstract class Section {
- /** null-ok; name of this part, for annotation purposes */
+ /** {@code null-ok;} name of this part, for annotation purposes */
private final String name;
- /** non-null; file that this instance is part of */
+ /** {@code non-null;} file that this instance is part of */
private final DexFile file;
- /** > 0; alignment requirement for the final output;
+ /** {@code > 0;} alignment requirement for the final output;
* must be a power of 2 */
private final int alignment;
- /** >= -1; offset from the start of the file to this part, or
- * <code>-1</code> if not yet known */
+ /** {@code >= -1;} offset from the start of the file to this part, or
+ * {@code -1} if not yet known */
private int fileOffset;
/** whether {@link #prepare} has been called successfully on this
@@ -47,7 +47,7 @@
* Validates an alignment.
*
* @param alignment the alignment
- * @throws IllegalArgumentException thrown if <code>alignment</code>
+ * @throws IllegalArgumentException thrown if {@code alignment}
* isn't a positive power of 2
*/
public static void validateAlignment(int alignment) {
@@ -60,10 +60,10 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param name null-ok; the name of this instance, for annotation
+ * @param name {@code null-ok;} the name of this instance, for annotation
* purposes
- * @param file non-null; file that this instance is part of
- * @param alignment > 0; alignment requirement for the final output;
+ * @param file {@code non-null;} file that this instance is part of
+ * @param alignment {@code > 0;} alignment requirement for the final output;
* must be a power of 2
*/
public Section(String name, DexFile file, int alignment) {
@@ -83,7 +83,7 @@
/**
* Gets the file that this instance is part of.
*
- * @return non-null; the file
+ * @return {@code non-null;} the file
*/
public final DexFile getFile() {
return file;
@@ -92,7 +92,7 @@
/**
* Gets the alignment for this instance's final output.
*
- * @return > 0; the alignment
+ * @return {@code > 0;} the alignment
*/
public final int getAlignment() {
return alignment;
@@ -102,7 +102,7 @@
* Gets the offset from the start of the file to this part. This
* throws an exception if the offset has not yet been set.
*
- * @return >= 0; the file offset
+ * @return {@code >= 0;} the file offset
*/
public final int getFileOffset() {
if (fileOffset < 0) {
@@ -116,9 +116,9 @@
* Sets the file offset. It is only valid to call this method once
* once per instance.
*
- * @param fileOffset >= 0; the desired offset from the start of the
+ * @param fileOffset {@code >= 0;} the desired offset from the start of the
* file where this for this instance
- * @return >= 0; the offset that this instance should be placed at
+ * @return {@code >= 0;} the offset that this instance should be placed at
* in order to meet its alignment constraint
*/
public final int setFileOffset(int fileOffset) {
@@ -141,7 +141,7 @@
/**
* Writes this instance to the given raw data object.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public final void writeTo(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -174,8 +174,8 @@
* once this instance has been assigned a file offset (via {@link
* #setFileOffset}).
*
- * @param relative >= 0; the relative offset
- * @return >= 0; the corresponding absolute file offset
+ * @param relative {@code >= 0;} the relative offset
+ * @return {@code >= 0;} the corresponding absolute file offset
*/
public final int getAbsoluteOffset(int relative) {
if (relative < 0) {
@@ -198,8 +198,8 @@
* <p><b>Note:</b> Subclasses must implement this as appropriate for
* their contents.</p>
*
- * @param item non-null; the item in question
- * @return >= 0; the item's absolute file offset
+ * @param item {@code non-null;} the item in question
+ * @return {@code >= 0;} the item's absolute file offset
*/
public abstract int getAbsoluteItemOffset(Item item);
@@ -219,7 +219,7 @@
* Gets the collection of all the items in this section.
* It is not valid to attempt to change the returned list.
*
- * @return non-null; the items
+ * @return {@code non-null;} the items
*/
public abstract Collection<? extends Item> items();
@@ -231,7 +231,7 @@
/**
* Gets the size of this instance when output, in bytes.
*
- * @return >= 0; the size of this instance, in bytes
+ * @return {@code >= 0;} the size of this instance, in bytes
*/
public abstract int writeSize();
@@ -258,7 +258,7 @@
/**
* Aligns the output of the given data to the alignment of this instance.
*
- * @param out non-null; the output to align
+ * @param out {@code non-null;} the output to align
*/
protected final void align(AnnotatedOutput out) {
out.alignTo(alignment);
@@ -267,19 +267,19 @@
/**
* Writes this instance to the given raw data object. This gets
* called by {@link #writeTo} after aligning the cursor of
- * <code>out</code> and verifying that either the assigned file
- * offset matches the actual cursor <code>out</code> or that the
+ * {@code out} and verifying that either the assigned file
+ * offset matches the actual cursor {@code out} or that the
* file offset was not previously assigned, in which case it gets
- * assigned to <code>out</code>'s cursor.
+ * assigned to {@code out}'s cursor.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
protected abstract void writeTo0(AnnotatedOutput out);
/**
* Returns the name of this section, for annotation purposes.
*
- * @return null-ok; name of this part, for annotation purposes
+ * @return {@code null-ok;} name of this part, for annotation purposes
*/
protected final String getName() {
return name;
diff --git a/dx/src/com/android/dx/dex/file/Statistics.java b/dx/src/com/android/dx/dex/file/Statistics.java
index b11ab6e..9a2efb3 100644
--- a/dx/src/com/android/dx/dex/file/Statistics.java
+++ b/dx/src/com/android/dx/dex/file/Statistics.java
@@ -26,7 +26,7 @@
* Statistics about the contents of a file.
*/
public final class Statistics {
- /** non-null; data about each type of item */
+ /** {@code non-null;} data about each type of item */
private final HashMap<String, Data> dataMap;
/**
@@ -39,7 +39,7 @@
/**
* Adds the given item to the statistics.
*
- * @param item non-null; the item to add
+ * @param item {@code non-null;} the item to add
*/
public void add(Item item) {
String typeName = item.typeName();
@@ -55,7 +55,7 @@
/**
* Adds the given list of items to the statistics.
*
- * @param list non-null; the list of items to add
+ * @param list {@code non-null;} the list of items to add
*/
public void addAll(Section list) {
Collection<? extends Item> items = list.items();
@@ -67,7 +67,7 @@
/**
* Writes the statistics as an annotation.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public final void writeAnnotation(AnnotatedOutput out) {
if (dataMap.size() == 0) {
@@ -109,26 +109,26 @@
* Statistical data about a particular class.
*/
private static class Data {
- /** non-null; name to use as a label */
+ /** {@code non-null;} name to use as a label */
private final String name;
- /** >= 0; number of instances */
+ /** {@code >= 0;} number of instances */
private int count;
- /** >= 0; total size of instances in bytes */
+ /** {@code >= 0;} total size of instances in bytes */
private int totalSize;
- /** >= 0; largest size of any individual item */
+ /** {@code >= 0;} largest size of any individual item */
private int largestSize;
- /** >= 0; smallest size of any individual item */
+ /** {@code >= 0;} smallest size of any individual item */
private int smallestSize;
/**
* Constructs an instance for the given item.
*
- * @param item non-null; item in question
- * @param name non-null; type name to use
+ * @param item {@code non-null;} item in question
+ * @param name {@code non-null;} type name to use
*/
public Data(Item item, String name) {
int size = item.writeSize();
@@ -143,7 +143,7 @@
/**
* Incorporates a new item. This assumes the type name matches.
*
- * @param item non-null; item to incorporate
+ * @param item {@code non-null;} item to incorporate
*/
public void add(Item item) {
int size = item.writeSize();
@@ -163,7 +163,7 @@
/**
* Writes this instance as an annotation.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public void writeAnnotation(AnnotatedOutput out) {
out.annotate(toHuman());
diff --git a/dx/src/com/android/dx/dex/file/StringDataItem.java b/dx/src/com/android/dx/dex/file/StringDataItem.java
index 49eea57..b9eeb9b 100644
--- a/dx/src/com/android/dx/dex/file/StringDataItem.java
+++ b/dx/src/com/android/dx/dex/file/StringDataItem.java
@@ -26,13 +26,13 @@
* Representation of string data for a particular string, in a Dalvik file.
*/
public final class StringDataItem extends OffsettedItem {
- /** non-null; the string value */
+ /** {@code non-null;} the string value */
private final CstUtf8 value;
/**
* Constructs an instance.
*
- * @param value non-null; the string value
+ * @param value {@code non-null;} the string value
*/
public StringDataItem(CstUtf8 value) {
super(1, writeSize(value));
@@ -43,8 +43,8 @@
/**
* Gets the write size for a given value.
*
- * @param value non-null; the string value
- * @return >= 2 the write size, in bytes
+ * @param value {@code non-null;} the string value
+ * @return {@code >= 2}; the write size, in bytes
*/
private static int writeSize(CstUtf8 value) {
int utf16Size = value.getUtf16Size();
diff --git a/dx/src/com/android/dx/dex/file/StringIdItem.java b/dx/src/com/android/dx/dex/file/StringIdItem.java
index e80a7f8..401a0be 100644
--- a/dx/src/com/android/dx/dex/file/StringIdItem.java
+++ b/dx/src/com/android/dx/dex/file/StringIdItem.java
@@ -28,16 +28,16 @@
/** size of instances when written out to a file, in bytes */
public static final int WRITE_SIZE = 4;
- /** non-null; the string value */
+ /** {@code non-null;} the string value */
private final CstUtf8 value;
- /** null-ok; associated string data object, if known */
+ /** {@code null-ok;} associated string data object, if known */
private StringDataItem data;
/**
* Constructs an instance.
*
- * @param value non-null; the string value
+ * @param value {@code non-null;} the string value
*/
public StringIdItem(CstUtf8 value) {
if (value == null) {
@@ -110,7 +110,7 @@
/**
* Gets the string value.
*
- * @return non-null; the value
+ * @return {@code non-null;} the value
*/
public CstUtf8 getValue() {
return value;
@@ -119,7 +119,7 @@
/**
* Gets the associated data object for this instance, if known.
*
- * @return null-ok; the associated data object or <code>null</code>
+ * @return {@code null-ok;} the associated data object or {@code null}
* if not yet known
*/
public StringDataItem getData() {
diff --git a/dx/src/com/android/dx/dex/file/StringIdsSection.java b/dx/src/com/android/dx/dex/file/StringIdsSection.java
index 17fbb57..b2e8683 100644
--- a/dx/src/com/android/dx/dex/file/StringIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/StringIdsSection.java
@@ -27,12 +27,12 @@
import java.util.TreeMap;
/**
- * Strings list section of a <code>.dex</code> file.
+ * Strings list section of a {@code .dex} file.
*/
public final class StringIdsSection
extends UniformItemSection {
/**
- * non-null; map from string constants to {@link
+ * {@code non-null;} map from string constants to {@link
* StringIdItem} instances
*/
private final TreeMap<CstUtf8, StringIdItem> strings;
@@ -40,7 +40,7 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public StringIdsSection(DexFile file) {
super("string_ids", file, 4);
@@ -79,7 +79,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -99,9 +99,9 @@
/**
* Interns an element into this instance.
*
- * @param string non-null; the string to intern, as a regular Java
- * <code>String</code>
- * @return non-null; the interned string
+ * @param string {@code non-null;} the string to intern, as a regular Java
+ * {@code String}
+ * @return {@code non-null;} the interned string
*/
public StringIdItem intern(String string) {
CstUtf8 utf8 = new CstUtf8(string);
@@ -111,8 +111,8 @@
/**
* Interns an element into this instance.
*
- * @param string non-null; the string to intern, as a {@link CstString}
- * @return non-null; the interned string
+ * @param string {@code non-null;} the string to intern, as a {@link CstString}
+ * @return {@code non-null;} the interned string
*/
public StringIdItem intern(CstString string) {
CstUtf8 utf8 = string.getString();
@@ -122,8 +122,8 @@
/**
* Interns an element into this instance.
*
- * @param string non-null; the string to intern, as a constant
- * @return non-null; the interned string
+ * @param string {@code non-null;} the string to intern, as a constant
+ * @return {@code non-null;} the interned string
*/
public StringIdItem intern(CstUtf8 string) {
return intern(new StringIdItem(string));
@@ -132,8 +132,8 @@
/**
* Interns an element into this instance.
*
- * @param string non-null; the string to intern
- * @return non-null; the interned string
+ * @param string {@code non-null;} the string to intern
+ * @return {@code non-null;} the interned string
*/
public StringIdItem intern(StringIdItem string) {
if (string == null) {
@@ -156,7 +156,7 @@
/**
* Interns the components of a name-and-type into this instance.
*
- * @param nat non-null; the name-and-type
+ * @param nat {@code non-null;} the name-and-type
*/
public void intern(CstNat nat) {
intern(nat.getName());
@@ -167,8 +167,8 @@
* Gets the index of the given string, which must have been added
* to this instance.
*
- * @param string non-null; the string to look up
- * @return >= 0; the string's index
+ * @param string {@code non-null;} the string to look up
+ * @return {@code >= 0;} the string's index
*/
public int indexOf(CstUtf8 string) {
if (string == null) {
@@ -190,8 +190,8 @@
* Gets the index of the given string, which must have been added
* to this instance.
*
- * @param string non-null; the string to look up
- * @return >= 0; the string's index
+ * @param string {@code non-null;} the string to look up
+ * @return {@code >= 0;} the string's index
*/
public int indexOf(CstString string) {
return indexOf(string.getString());
diff --git a/dx/src/com/android/dx/dex/file/TypeIdItem.java b/dx/src/com/android/dx/dex/file/TypeIdItem.java
index f3402e6..01b1417 100644
--- a/dx/src/com/android/dx/dex/file/TypeIdItem.java
+++ b/dx/src/com/android/dx/dex/file/TypeIdItem.java
@@ -31,7 +31,7 @@
/**
* Constructs an instance.
*
- * @param type non-null; the constant for the type
+ * @param type {@code non-null;} the constant for the type
*/
public TypeIdItem(CstType type) {
super(type);
diff --git a/dx/src/com/android/dx/dex/file/TypeIdsSection.java b/dx/src/com/android/dx/dex/file/TypeIdsSection.java
index 296263f..b1b9c58 100644
--- a/dx/src/com/android/dx/dex/file/TypeIdsSection.java
+++ b/dx/src/com/android/dx/dex/file/TypeIdsSection.java
@@ -26,18 +26,18 @@
import java.util.TreeMap;
/**
- * Type identifiers list section of a <code>.dex</code> file.
+ * Type identifiers list section of a {@code .dex} file.
*/
public final class TypeIdsSection extends UniformItemSection {
/**
- * non-null; map from types to {@link TypeIdItem} instances
+ * {@code non-null;} map from types to {@link TypeIdItem} instances
*/
private final TreeMap<Type, TypeIdItem> typeIds;
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param file non-null; file that this instance is part of
+ * @param file {@code non-null;} file that this instance is part of
*/
public TypeIdsSection(DexFile file) {
super("type_ids", file, 4);
@@ -73,7 +73,7 @@
/**
* Writes the portion of the file header that refers to this instance.
*
- * @param out non-null; where to write
+ * @param out {@code non-null;} where to write
*/
public void writeHeaderPart(AnnotatedOutput out) {
throwIfNotPrepared();
@@ -97,8 +97,8 @@
/**
* Interns an element into this instance.
*
- * @param type non-null; the type to intern
- * @return non-null; the interned reference
+ * @param type {@code non-null;} the type to intern
+ * @return {@code non-null;} the interned reference
*/
public TypeIdItem intern(Type type) {
if (type == null) {
@@ -120,8 +120,8 @@
/**
* Interns an element into this instance.
*
- * @param type non-null; the type to intern
- * @return non-null; the interned reference
+ * @param type {@code non-null;} the type to intern
+ * @return {@code non-null;} the interned reference
*/
public TypeIdItem intern(CstType type) {
if (type == null) {
@@ -145,8 +145,8 @@
* Gets the index of the given type, which must have
* been added to this instance.
*
- * @param type non-null; the type to look up
- * @return >= 0; the reference's index
+ * @param type {@code non-null;} the type to look up
+ * @return {@code >= 0;} the reference's index
*/
public int indexOf(Type type) {
if (type == null) {
@@ -168,8 +168,8 @@
* Gets the index of the given type, which must have
* been added to this instance.
*
- * @param type non-null; the type to look up
- * @return >= 0; the reference's index
+ * @param type {@code non-null;} the type to look up
+ * @return {@code >= 0;} the reference's index
*/
public int indexOf(CstType type) {
if (type == null) {
diff --git a/dx/src/com/android/dx/dex/file/TypeListItem.java b/dx/src/com/android/dx/dex/file/TypeListItem.java
index 6557ca4..3278aef 100644
--- a/dx/src/com/android/dx/dex/file/TypeListItem.java
+++ b/dx/src/com/android/dx/dex/file/TypeListItem.java
@@ -36,13 +36,13 @@
/** header size in bytes */
private static final int HEADER_SIZE = 4;
- /** non-null; the actual list */
+ /** {@code non-null;} the actual list */
private final TypeList list;
/**
* Constructs an instance.
*
- * @param list non-null; the actual list
+ * @param list {@code non-null;} the actual list
*/
public TypeListItem(TypeList list) {
super(ALIGNMENT, (list.size() * ELEMENT_SIZE) + HEADER_SIZE);
@@ -81,7 +81,7 @@
/**
* Gets the underlying list.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public TypeList getList() {
return list;
diff --git a/dx/src/com/android/dx/dex/file/UniformItemSection.java b/dx/src/com/android/dx/dex/file/UniformItemSection.java
index 602bc2d..e182438 100644
--- a/dx/src/com/android/dx/dex/file/UniformItemSection.java
+++ b/dx/src/com/android/dx/dex/file/UniformItemSection.java
@@ -22,7 +22,7 @@
import java.util.Collection;
/**
- * A section of a <code>.dex</code> file which consists of a sequence of
+ * A section of a {@code .dex} file which consists of a sequence of
* {@link Item} objects. Each of the items must have the same size in
* the output.
*/
@@ -30,10 +30,10 @@
/**
* Constructs an instance. The file offset is initially unknown.
*
- * @param name null-ok; the name of this instance, for annotation
+ * @param name {@code null-ok;} the name of this instance, for annotation
* purposes
- * @param file non-null; file that this instance is part of
- * @param alignment > 0; alignment requirement for the final output;
+ * @param file {@code non-null;} file that this instance is part of
+ * @param alignment {@code > 0;} alignment requirement for the final output;
* must be a power of 2
*/
public UniformItemSection(String name, DexFile file, int alignment) {
@@ -60,8 +60,8 @@
* if this instance isn't the sort that maps constants to {@link
* IndexedItem} instances.
*
- * @param cst non-null; constant to look for
- * @return non-null; the corresponding item found in this instance
+ * @param cst {@code non-null;} constant to look for
+ * @return {@code non-null;} the corresponding item found in this instance
*/
public abstract IndexedItem get(Constant cst);
diff --git a/dx/src/com/android/dx/dex/file/UniformListItem.java b/dx/src/com/android/dx/dex/file/UniformListItem.java
index 3af3942..3c1f4d3 100644
--- a/dx/src/com/android/dx/dex/file/UniformListItem.java
+++ b/dx/src/com/android/dx/dex/file/UniformListItem.java
@@ -28,8 +28,8 @@
* alignment.
*
* <p>This class inherits its alignment from its items, bumped up to
- * <code>4</code> if the items have a looser alignment requirement. If
- * it is more than <code>4</code>, then there will be a gap after the
+ * {@code 4} if the items have a looser alignment requirement. If
+ * it is more than {@code 4}, then there will be a gap after the
* output list size (which is four bytes) and before the first item.</p>
*
* @param <T> type of element contained in an instance
@@ -39,18 +39,18 @@
/** the size of the list header */
private static final int HEADER_SIZE = 4;
- /** non-null; the item type */
+ /** {@code non-null;} the item type */
private final ItemType itemType;
- /** non-null; the contents */
+ /** {@code non-null;} the contents */
private final List<T> items;
/**
* Constructs an instance. It is illegal to modify the given list once
* it is used to construct an instance of this class.
*
- * @param itemType non-null; the type of the item
- * @param items non-null and non-empty; list of items to represent
+ * @param itemType {@code non-null;} the type of the item
+ * @param items {@code non-null and non-empty;} list of items to represent
*/
public UniformListItem(ItemType itemType, List<T> items) {
super(getAlignment(items), writeSize(items));
@@ -68,8 +68,8 @@
* requirement implied by the given list. See the header comment for
* more details.
*
- * @param items non-null; list of items being represented
- * @return >= 4; the alignment requirement
+ * @param items {@code non-null;} list of items being represented
+ * @return {@code >= 4;} the alignment requirement
*/
private static int getAlignment(List<? extends OffsettedItem> items) {
try {
@@ -87,8 +87,8 @@
/**
* Calculates the write size for the given list.
*
- * @param items non-null; the list in question
- * @return >= 0; the write size
+ * @param items {@code non-null;} the list in question
+ * @return {@code >= 0;} the write size
*/
private static int writeSize(List<? extends OffsettedItem> items) {
/*
@@ -148,7 +148,7 @@
/**
* Gets the underlying list of items.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public final List<T> getItems() {
return items;
@@ -204,7 +204,7 @@
/**
* Get the size of the header of this list.
*
- * @return >= 0; the header size
+ * @return {@code >= 0;} the header size
*/
private int headerSize() {
/*
diff --git a/dx/src/com/android/dx/dex/file/ValueEncoder.java b/dx/src/com/android/dx/dex/file/ValueEncoder.java
index 02a3419..66cd1a5 100644
--- a/dx/src/com/android/dx/dex/file/ValueEncoder.java
+++ b/dx/src/com/android/dx/dex/file/ValueEncoder.java
@@ -43,69 +43,69 @@
import java.util.Collection;
/**
- * Handler for writing out <code>encoded_values</code> and parts
+ * Handler for writing out {@code encoded_values} and parts
* thereof.
*/
public final class ValueEncoder {
- /** annotation value type constant: <code>byte</code> */
+ /** annotation value type constant: {@code byte} */
private static final int VALUE_BYTE = 0x00;
- /** annotation value type constant: <code>short</code> */
+ /** annotation value type constant: {@code short} */
private static final int VALUE_SHORT = 0x02;
- /** annotation value type constant: <code>char</code> */
+ /** annotation value type constant: {@code char} */
private static final int VALUE_CHAR = 0x03;
- /** annotation value type constant: <code>int</code> */
+ /** annotation value type constant: {@code int} */
private static final int VALUE_INT = 0x04;
- /** annotation value type constant: <code>long</code> */
+ /** annotation value type constant: {@code long} */
private static final int VALUE_LONG = 0x06;
- /** annotation value type constant: <code>float</code> */
+ /** annotation value type constant: {@code float} */
private static final int VALUE_FLOAT = 0x10;
- /** annotation value type constant: <code>double</code> */
+ /** annotation value type constant: {@code double} */
private static final int VALUE_DOUBLE = 0x11;
- /** annotation value type constant: <code>string</code> */
+ /** annotation value type constant: {@code string} */
private static final int VALUE_STRING = 0x17;
- /** annotation value type constant: <code>type</code> */
+ /** annotation value type constant: {@code type} */
private static final int VALUE_TYPE = 0x18;
- /** annotation value type constant: <code>field</code> */
+ /** annotation value type constant: {@code field} */
private static final int VALUE_FIELD = 0x19;
- /** annotation value type constant: <code>method</code> */
+ /** annotation value type constant: {@code method} */
private static final int VALUE_METHOD = 0x1a;
- /** annotation value type constant: <code>enum</code> */
+ /** annotation value type constant: {@code enum} */
private static final int VALUE_ENUM = 0x1b;
- /** annotation value type constant: <code>array</code> */
+ /** annotation value type constant: {@code array} */
private static final int VALUE_ARRAY = 0x1c;
- /** annotation value type constant: <code>annotation</code> */
+ /** annotation value type constant: {@code annotation} */
private static final int VALUE_ANNOTATION = 0x1d;
- /** annotation value type constant: <code>null</code> */
+ /** annotation value type constant: {@code null} */
private static final int VALUE_NULL = 0x1e;
- /** annotation value type constant: <code>boolean</code> */
+ /** annotation value type constant: {@code boolean} */
private static final int VALUE_BOOLEAN = 0x1f;
- /** non-null; file being written */
+ /** {@code non-null;} file being written */
private final DexFile file;
- /** non-null; output stream to write to */
+ /** {@code non-null;} output stream to write to */
private final AnnotatedOutput out;
/**
* Construct an instance.
*
- * @param file non-null; file being written
- * @param out non-null; output stream to write to
+ * @param file {@code non-null;} file being written
+ * @param out {@code non-null;} output stream to write to
*/
public ValueEncoder(DexFile file, AnnotatedOutput out) {
if (file == null) {
@@ -123,7 +123,7 @@
/**
* Writes out the encoded form of the given constant.
*
- * @param cst non-null; the constant to write
+ * @param cst {@code non-null;} the constant to write
*/
public void writeConstant(Constant cst) {
int type = constantToValueType(cst);
@@ -209,8 +209,8 @@
/**
* Gets the value type for the given constant.
*
- * @param cst non-null; the constant
- * @return the value type; one of the <code>VALUE_*</code> constants
+ * @param cst {@code non-null;} the constant
+ * @return the value type; one of the {@code VALUE_*} constants
* defined by this class
*/
private static int constantToValueType(Constant cst) {
@@ -257,15 +257,15 @@
/**
* Writes out the encoded form of the given array, that is, as
- * an <code>encoded_array</code> and not including a
- * <code>value_type</code> prefix. If the output stream keeps
- * (debugging) annotations and <code>topLevel</code> is
- * <code>true</code>, then this method will write (debugging)
+ * an {@code encoded_array} and not including a
+ * {@code value_type} prefix. If the output stream keeps
+ * (debugging) annotations and {@code topLevel} is
+ * {@code true}, then this method will write (debugging)
* annotations.
*
- * @param array non-null; array instance to write
- * @param topLevel <code>true</code> iff the given annotation is the
- * top-level annotation or <code>false</code> if it is a sub-annotation
+ * @param array {@code non-null;} array instance to write
+ * @param topLevel {@code true} iff the given annotation is the
+ * top-level annotation or {@code false} if it is a sub-annotation
* of some other annotation
*/
public void writeArray(CstArray array, boolean topLevel) {
@@ -295,15 +295,15 @@
/**
* Writes out the encoded form of the given annotation, that is,
- * as an <code>encoded_annotation</code> and not including a
- * <code>value_type</code> prefix. If the output stream keeps
- * (debugging) annotations and <code>topLevel</code> is
- * <code>true</code>, then this method will write (debugging)
+ * as an {@code encoded_annotation} and not including a
+ * {@code value_type} prefix. If the output stream keeps
+ * (debugging) annotations and {@code topLevel} is
+ * {@code true}, then this method will write (debugging)
* annotations.
*
- * @param annotation non-null; annotation instance to write
- * @param topLevel <code>true</code> iff the given annotation is the
- * top-level annotation or <code>false</code> if it is a sub-annotation
+ * @param annotation {@code non-null;} annotation instance to write
+ * @param topLevel {@code true} iff the given annotation is the
+ * top-level annotation or {@code false} if it is a sub-annotation
* of some other annotation
*/
public void writeAnnotation(Annotation annotation, boolean topLevel) {
@@ -361,8 +361,8 @@
* Gets the colloquial type name and human form of the type of the
* given constant, when used as an encoded value.
*
- * @param cst non-null; the constant
- * @return non-null; its type name and human form
+ * @param cst {@code non-null;} the constant
+ * @return {@code non-null;} its type name and human form
*/
public static String constantToHuman(Constant cst) {
int type = constantToValueType(cst);
@@ -385,7 +385,7 @@
* for any signed integral type.
*
* @param type the type constant
- * @param value <code>long</code> bits of the value
+ * @param value {@code long} bits of the value
*/
private void writeSignedIntegralValue(int type, long value) {
/*
@@ -422,7 +422,7 @@
* for any unsigned integral type.
*
* @param type the type constant
- * @param value <code>long</code> bits of the value
+ * @param value {@code long} bits of the value
*/
private void writeUnsignedIntegralValue(int type, long value) {
// Figure out how many bits are needed to represent the value.
@@ -453,7 +453,7 @@
* right-zero-extended value.
*
* @param type the type constant
- * @param value <code>long</code> bits of the value
+ * @param value {@code long} bits of the value
*/
private void writeRightZeroExtendedValue(int type, long value) {
// Figure out how many bits are needed to represent the value.
@@ -484,12 +484,12 @@
/**
- * Helper for <code>addContents()</code> methods, which adds
+ * Helper for {@code addContents()} methods, which adds
* contents for a particular {@link Annotation}, calling itself
* recursively should it encounter a nested annotation.
*
- * @param file non-null; the file to add to
- * @param annotation non-null; the annotation to add contents for
+ * @param file {@code non-null;} the file to add to
+ * @param annotation {@code non-null;} the annotation to add contents for
*/
public static void addContents(DexFile file, Annotation annotation) {
TypeIdsSection typeIds = file.getTypeIds();
@@ -504,14 +504,14 @@
}
/**
- * Helper for <code>addContents()</code> methods, which adds
+ * Helper for {@code addContents()} methods, which adds
* contents for a particular constant, calling itself recursively
* should it encounter a {@link CstArray} and calling {@link
* #addContents(DexFile,Annotation)} recursively should it
* encounter a {@link CstAnnotation}.
*
- * @param file non-null; the file to add to
- * @param cst non-null; the constant to add contents for
+ * @param file {@code non-null;} the file to add to
+ * @param cst {@code non-null;} the constant to add contents for
*/
public static void addContents(DexFile file, Constant cst) {
TypeIdsSection typeIds = file.getTypeIds();
diff --git a/dx/src/com/android/dx/rop/annotation/Annotation.java b/dx/src/com/android/dx/rop/annotation/Annotation.java
index b7cf164..6154c61 100644
--- a/dx/src/com/android/dx/rop/annotation/Annotation.java
+++ b/dx/src/com/android/dx/rop/annotation/Annotation.java
@@ -41,20 +41,20 @@
*/
public final class Annotation extends MutabilityControl
implements Comparable<Annotation>, ToHuman {
- /** non-null; type of the annotation */
+ /** {@code non-null;} type of the annotation */
private final CstType type;
- /** non-null; the visibility of the annotation */
+ /** {@code non-null;} the visibility of the annotation */
private final AnnotationVisibility visibility;
- /** non-null; map from names to {@link NameValuePair} instances */
+ /** {@code non-null;} map from names to {@link NameValuePair} instances */
private final TreeMap<CstUtf8, NameValuePair> elements;
/**
* Construct an instance. It initially contains no elements.
*
- * @param type non-null; type of the annotation
- * @param visibility non-null; the visibility of the annotation
+ * @param type {@code non-null;} type of the annotation
+ * @param visibility {@code non-null;} the visibility of the annotation
*/
public Annotation(CstType type, AnnotationVisibility visibility) {
if (type == null) {
@@ -165,7 +165,7 @@
/**
* Gets the type of this instance.
*
- * @return non-null; the type
+ * @return {@code non-null;} the type
*/
public CstType getType() {
return type;
@@ -174,7 +174,7 @@
/**
* Gets the visibility of this instance.
*
- * @return non-null; the visibility
+ * @return {@code non-null;} the visibility
*/
public AnnotationVisibility getVisibility() {
return visibility;
@@ -185,7 +185,7 @@
* If there is a preexisting element with the same name, it will be
* replaced by this method.
*
- * @param pair non-null; the (name, value) pair to place into this instance
+ * @param pair {@code non-null;} the (name, value) pair to place into this instance
*/
public void put(NameValuePair pair) {
throwIfImmutable();
@@ -202,7 +202,7 @@
* It is an error to call this method if there is a preexisting element
* with the same name.
*
- * @param pair non-null; the (name, value) pair to add to this instance
+ * @param pair {@code non-null;} the (name, value) pair to add to this instance
*/
public void add(NameValuePair pair) {
throwIfImmutable();
@@ -224,7 +224,7 @@
* Gets the set of name-value pairs contained in this instance. The
* result is always unmodifiable.
*
- * @return non-null; the set of name-value pairs
+ * @return {@code non-null;} the set of name-value pairs
*/
public Collection<NameValuePair> getNameValuePairs() {
return Collections.unmodifiableCollection(elements.values());
diff --git a/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java b/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java
index c53fcd8..26246bb 100644
--- a/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java
+++ b/dx/src/com/android/dx/rop/annotation/AnnotationVisibility.java
@@ -27,13 +27,13 @@
SYSTEM("system"),
EMBEDDED("embedded");
- /** non-null; the human-oriented string representation */
+ /** {@code non-null;} the human-oriented string representation */
private final String human;
/**
* Constructs an instance.
*
- * @param human non-null; the human-oriented string representation
+ * @param human {@code non-null;} the human-oriented string representation
*/
private AnnotationVisibility(String human) {
this.human = human;
diff --git a/dx/src/com/android/dx/rop/annotation/Annotations.java b/dx/src/com/android/dx/rop/annotation/Annotations.java
index c1da883..dcb74a1 100644
--- a/dx/src/com/android/dx/rop/annotation/Annotations.java
+++ b/dx/src/com/android/dx/rop/annotation/Annotations.java
@@ -29,14 +29,14 @@
*/
public final class Annotations extends MutabilityControl
implements Comparable<Annotations> {
- /** non-null; immutable empty instance */
+ /** {@code non-null;} immutable empty instance */
public static final Annotations EMPTY = new Annotations();
static {
EMPTY.setImmutable();
}
- /** non-null; map from types to annotations */
+ /** {@code non-null;} map from types to annotations */
private final TreeMap<CstType, Annotation> annotations;
/**
@@ -44,9 +44,9 @@
* two given instances. The two instances must contain disjoint sets
* of types.
*
- * @param a1 non-null; an instance
- * @param a2 non-null; the other instance
- * @return non-null; the combination
+ * @param a1 {@code non-null;} an instance
+ * @param a2 {@code non-null;} the other instance
+ * @return {@code non-null;} the combination
* @throws IllegalArgumentException thrown if there is a duplicate type
*/
public static Annotations combine(Annotations a1, Annotations a2) {
@@ -64,9 +64,9 @@
* given instance with the given additional annotation. The latter's
* type must not already appear in the former.
*
- * @param annotations non-null; the instance to augment
- * @param annotation non-null; the additional annotation
- * @return non-null; the combination
+ * @param annotations {@code non-null;} the instance to augment
+ * @param annotation {@code non-null;} the additional annotation
+ * @return {@code non-null;} the combination
* @throws IllegalArgumentException thrown if there is a duplicate type
*/
public static Annotations combine(Annotations annotations,
@@ -152,7 +152,7 @@
/**
* Gets the number of elements in this instance.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int size() {
return annotations.size();
@@ -162,7 +162,7 @@
* Adds an element to this instance. There must not already be an
* element of the same type.
*
- * @param annotation non-null; the element to add
+ * @param annotation {@code non-null;} the element to add
* @throws IllegalArgumentException thrown if there is a duplicate type
*/
public void add(Annotation annotation) {
@@ -186,7 +186,7 @@
* Adds all of the elements of the given instance to this one. The
* instances must not have any duplicate types.
*
- * @param toAdd non-null; the annotations to add
+ * @param toAdd {@code non-null;} the annotations to add
* @throws IllegalArgumentException thrown if there is a duplicate type
*/
public void addAll(Annotations toAdd) {
@@ -205,7 +205,7 @@
* Gets the set of annotations contained in this instance. The
* result is always unmodifiable.
*
- * @return non-null; the set of annotations
+ * @return {@code non-null;} the set of annotations
*/
public Collection<Annotation> getAnnotations() {
return Collections.unmodifiableCollection(annotations.values());
diff --git a/dx/src/com/android/dx/rop/annotation/AnnotationsList.java b/dx/src/com/android/dx/rop/annotation/AnnotationsList.java
index 43a07ba..0f4207b 100644
--- a/dx/src/com/android/dx/rop/annotation/AnnotationsList.java
+++ b/dx/src/com/android/dx/rop/annotation/AnnotationsList.java
@@ -23,7 +23,7 @@
*/
public final class AnnotationsList
extends FixedSizeList {
- /** non-null; immutable empty instance */
+ /** {@code non-null;} immutable empty instance */
public static final AnnotationsList EMPTY = new AnnotationsList(0);
/**
@@ -32,9 +32,9 @@
* same number of elements, and each pair of elements must contain
* disjoint sets of types.
*
- * @param list1 non-null; an instance
- * @param list2 non-null; the other instance
- * @return non-null; the combination
+ * @param list1 {@code non-null;} an instance
+ * @param list2 {@code non-null;} the other instance
+ * @return {@code non-null;} the combination
*/
public static AnnotationsList combine(AnnotationsList list1,
AnnotationsList list2) {
@@ -57,7 +57,7 @@
}
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -68,10 +68,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Annotations get(int n) {
return (Annotations) get0(n);
@@ -81,8 +81,8 @@
* Sets the element at the given index. The given element must be
* immutable.
*
- * @param n >= 0, < size(); which index
- * @param a null-ok; the element to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param a {@code null-ok;} the element to set at {@code n}
*/
public void set(int n, Annotations a) {
a.throwIfMutable();
diff --git a/dx/src/com/android/dx/rop/annotation/NameValuePair.java b/dx/src/com/android/dx/rop/annotation/NameValuePair.java
index dadabaa..7137a60 100644
--- a/dx/src/com/android/dx/rop/annotation/NameValuePair.java
+++ b/dx/src/com/android/dx/rop/annotation/NameValuePair.java
@@ -24,17 +24,17 @@
* A (name, value) pair. These are used as the contents of an annotation.
*/
public final class NameValuePair implements Comparable<NameValuePair> {
- /** non-null; the name */
+ /** {@code non-null;} the name */
private final CstUtf8 name;
- /** non-null; the value */
+ /** {@code non-null;} the value */
private final Constant value;
/**
* Construct an instance.
*
- * @param name non-null; the name
- * @param value non-null; the value
+ * @param name {@code non-null;} the name
+ * @param value {@code non-null;} the value
*/
public NameValuePair(CstUtf8 name, Constant value) {
if (name == null) {
@@ -95,7 +95,7 @@
/**
* Gets the name.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public CstUtf8 getName() {
return name;
@@ -104,7 +104,7 @@
/**
* Gets the value.
*
- * @return non-null; the valute
+ * @return {@code non-null;} the value
*/
public Constant getValue() {
return value;
diff --git a/dx/src/com/android/dx/rop/code/AccessFlags.java b/dx/src/com/android/dx/rop/code/AccessFlags.java
index 265cfa6..b76b610 100644
--- a/dx/src/com/android/dx/rop/code/AccessFlags.java
+++ b/dx/src/com/android/dx/rop/code/AccessFlags.java
@@ -23,8 +23,8 @@
* related utilities. Although, at the rop layer, flags are generally
* ignored, this is the layer of communication, and as such, this
* package is where these definitions belong. The flag definitions are
- * identical to Java access flags, but <code>ACC_SUPER</code> isn't
- * used at all in translated code, and <code>ACC_SYNCHRONIZED</code>
+ * identical to Java access flags, but {@code ACC_SUPER} isn't
+ * used at all in translated code, and {@code ACC_SYNCHRONIZED}
* is only used in a very limited way.
*/
public final class AccessFlags {
@@ -44,13 +44,13 @@
public static final int ACC_FINAL = 0x0010;
/**
- * synchronized method; only valid in dex files for <code>native</code>
+ * synchronized method; only valid in dex files for {@code native}
* methods
*/
public static final int ACC_SYNCHRONIZED = 0x0020;
/**
- * class with new-style <code>invokespecial</code> for superclass
+ * class with new-style {@code invokespecial} for superclass
* method access
*/
public static final int ACC_SUPER = 0x0020;
@@ -77,7 +77,7 @@
public static final int ACC_ABSTRACT = 0x0400;
/**
- * method with strict floating point (<code>strictfp</code>)
+ * method with strict floating point ({@code strictfp})
* behavior
*/
public static final int ACC_STRICT = 0x0800;
@@ -98,7 +98,7 @@
public static final int ACC_CONSTRUCTOR = 0x10000;
/**
- * method was declared <code>synchronized</code>; has no effect on
+ * method was declared {@code synchronized}; has no effect on
* execution (other than inspecting this flag, per se)
*/
public static final int ACC_DECLARED_SYNCHRONIZED = 0x20000;
@@ -147,7 +147,7 @@
* as defined on classes (not fields or methods).
*
* @param flags the flags
- * @return non-null; human-oriented string
+ * @return {@code non-null;} human-oriented string
*/
public static String classString(int flags) {
return humanHelper(flags, CLASS_FLAGS, CONV_CLASS);
@@ -158,7 +158,7 @@
* as defined on inner classes.
*
* @param flags the flags
- * @return non-null; human-oriented string
+ * @return {@code non-null;} human-oriented string
*/
public static String innerClassString(int flags) {
return humanHelper(flags, INNER_CLASS_FLAGS, CONV_CLASS);
@@ -169,7 +169,7 @@
* as defined on fields (not classes or methods).
*
* @param flags the flags
- * @return non-null; human-oriented string
+ * @return {@code non-null;} human-oriented string
*/
public static String fieldString(int flags) {
return humanHelper(flags, FIELD_FLAGS, CONV_FIELD);
@@ -180,106 +180,106 @@
* as defined on methods (not classes or fields).
*
* @param flags the flags
- * @return non-null; human-oriented string
+ * @return {@code non-null;} human-oriented string
*/
public static String methodString(int flags) {
return humanHelper(flags, METHOD_FLAGS, CONV_METHOD);
}
/**
- * Returns whether the flag <code>ACC_PUBLIC</code> is on in the given
+ * Returns whether the flag {@code ACC_PUBLIC} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_PUBLIC</code> flag
+ * @return the value of the {@code ACC_PUBLIC} flag
*/
public static boolean isPublic(int flags) {
return (flags & ACC_PUBLIC) != 0;
}
/**
- * Returns whether the flag <code>ACC_PROTECTED</code> is on in the given
+ * Returns whether the flag {@code ACC_PROTECTED} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_PROTECTED</code> flag
+ * @return the value of the {@code ACC_PROTECTED} flag
*/
public static boolean isProtected(int flags) {
return (flags & ACC_PROTECTED) != 0;
}
/**
- * Returns whether the flag <code>ACC_PRIVATE</code> is on in the given
+ * Returns whether the flag {@code ACC_PRIVATE} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_PRIVATE</code> flag
+ * @return the value of the {@code ACC_PRIVATE} flag
*/
public static boolean isPrivate(int flags) {
return (flags & ACC_PRIVATE) != 0;
}
/**
- * Returns whether the flag <code>ACC_STATIC</code> is on in the given
+ * Returns whether the flag {@code ACC_STATIC} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_STATIC</code> flag
+ * @return the value of the {@code ACC_STATIC} flag
*/
public static boolean isStatic(int flags) {
return (flags & ACC_STATIC) != 0;
}
/**
- * Returns whether the flag <code>ACC_SYNCHRONIZED</code> is on in
+ * Returns whether the flag {@code ACC_SYNCHRONIZED} is on in
* the given flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_SYNCHRONIZED</code> flag
+ * @return the value of the {@code ACC_SYNCHRONIZED} flag
*/
public static boolean isSynchronized(int flags) {
return (flags & ACC_SYNCHRONIZED) != 0;
}
/**
- * Returns whether the flag <code>ACC_ABSTRACT</code> is on in the given
+ * Returns whether the flag {@code ACC_ABSTRACT} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_ABSTRACT</code> flag
+ * @return the value of the {@code ACC_ABSTRACT} flag
*/
public static boolean isAbstract(int flags) {
return (flags & ACC_ABSTRACT) != 0;
}
/**
- * Returns whether the flag <code>ACC_NATIVE</code> is on in the given
+ * Returns whether the flag {@code ACC_NATIVE} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_NATIVE</code> flag
+ * @return the value of the {@code ACC_NATIVE} flag
*/
public static boolean isNative(int flags) {
return (flags & ACC_NATIVE) != 0;
}
/**
- * Returns whether the flag <code>ACC_ANNOTATION</code> is on in the given
+ * Returns whether the flag {@code ACC_ANNOTATION} is on in the given
* flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_ANNOTATION</code> flag
+ * @return the value of the {@code ACC_ANNOTATION} flag
*/
public static boolean isAnnotation(int flags) {
return (flags & ACC_ANNOTATION) != 0;
}
/**
- * Returns whether the flag <code>ACC_DECLARED_SYNCHRONIZED</code> is
+ * Returns whether the flag {@code ACC_DECLARED_SYNCHRONIZED} is
* on in the given flags.
*
* @param flags the flags to check
- * @return the value of the <code>ACC_DECLARED_SYNCHRONIZED</code> flag
+ * @return the value of the {@code ACC_DECLARED_SYNCHRONIZED} flag
*/
public static boolean isDeclaredSynchronized(int flags) {
return (flags & ACC_DECLARED_SYNCHRONIZED) != 0;
@@ -291,8 +291,8 @@
*
* @param flags the defined flags
* @param mask mask for the "defined" bits
- * @param what what the flags represent (one of <code>CONV_*</code>)
- * @return non-null; human-oriented string
+ * @param what what the flags represent (one of {@code CONV_*})
+ * @return {@code non-null;} human-oriented string
*/
private static String humanHelper(int flags, int mask, int what) {
StringBuffer sb = new StringBuffer(80);
diff --git a/dx/src/com/android/dx/rop/code/BasicBlock.java b/dx/src/com/android/dx/rop/code/BasicBlock.java
index 66db5aa..7bb2d9b 100644
--- a/dx/src/com/android/dx/rop/code/BasicBlock.java
+++ b/dx/src/com/android/dx/rop/code/BasicBlock.java
@@ -25,34 +25,34 @@
* Basic block of register-based instructions.
*/
public final class BasicBlock implements LabeledItem {
- /** >= 0; target label for this block */
+ /** {@code >= 0;} target label for this block */
private final int label;
- /** non-null; list of instructions in this block */
+ /** {@code non-null;} list of instructions in this block */
private final InsnList insns;
/**
- * non-null; full list of successors that this block may
+ * {@code non-null;} full list of successors that this block may
* branch to
*/
private final IntList successors;
/**
- * >= -1; the primary / standard-flow / "default" successor, or
- * <code>-1</code> if this block has no successors (that is, it
+ * {@code >= -1;} the primary / standard-flow / "default" successor, or
+ * {@code -1} if this block has no successors (that is, it
* exits the function/method)
*/
private final int primarySuccessor;
/**
- * Constructs an instance. The predecessor set is set to <code>null</code>.
+ * Constructs an instance. The predecessor set is set to {@code null}.
*
- * @param label >= 0; target label for this block
- * @param insns non-null; list of instructions in this block
- * @param successors non-null; full list of successors that this
+ * @param label {@code >= 0;} target label for this block
+ * @param insns {@code non-null;} list of instructions in this block
+ * @param successors {@code non-null;} full list of successors that this
* block may branch to
- * @param primarySuccessor >= -1; the primary / standard-flow /
- * "default" successor, or <code>-1</code> if this block has no
+ * @param primarySuccessor {@code >= -1;} the primary / standard-flow /
+ * "default" successor, or {@code -1} if this block has no
* successors (that is, it exits the function/method or is an
* unconditional throw)
*/
@@ -116,7 +116,7 @@
* {@inheritDoc}
*
* Instances of this class compare by identity. That is,
- * <code>x.equals(y)</code> is only true if <code>x == y</code>.
+ * {@code x.equals(y)} is only true if {@code x == y}.
*/
@Override
public boolean equals(Object other) {
@@ -137,7 +137,7 @@
/**
* Gets the target label of this block.
*
- * @return >= 0; the label
+ * @return {@code >= 0;} the label
*/
public int getLabel() {
return label;
@@ -146,7 +146,7 @@
/**
* Gets the list of instructions inside this block.
*
- * @return non-null; the instruction list
+ * @return {@code non-null;} the instruction list
*/
public InsnList getInsns() {
return insns;
@@ -155,7 +155,7 @@
/**
* Gets the list of successors that this block may branch to.
*
- * @return non-null; the successors list
+ * @return {@code non-null;} the successors list
*/
public IntList getSuccessors() {
return successors;
@@ -164,7 +164,7 @@
/**
* Gets the primary successor of this block.
*
- * @return >= -1; the primary successor, or <code>-1</code> if this
+ * @return {@code >= -1;} the primary successor, or {@code -1} if this
* block has no successors at all
*/
public int getPrimarySuccessor() {
@@ -175,7 +175,7 @@
* Gets the secondary successor of this block. It is only valid to call
* this method on blocks that have exactly two successors.
*
- * @return >= 0; the secondary successor
+ * @return {@code >= 0;} the secondary successor
*/
public int getSecondarySuccessor() {
if (successors.size() != 2) {
@@ -193,9 +193,9 @@
/**
* Gets the first instruction of this block. This is just a
- * convenient shorthand for <code>getInsns().get(0)</code>.
+ * convenient shorthand for {@code getInsns().get(0)}.
*
- * @return non-null; the first instruction
+ * @return {@code non-null;} the first instruction
*/
public Insn getFirstInsn() {
return insns.get(0);
@@ -203,9 +203,9 @@
/**
* Gets the last instruction of this block. This is just a
- * convenient shorthand for <code>getInsns().getLast()</code>.
+ * convenient shorthand for {@code getInsns().getLast()}.
*
- * @return non-null; the last instruction
+ * @return {@code non-null;} the last instruction
*/
public Insn getLastInsn() {
return insns.getLast();
@@ -213,9 +213,9 @@
/**
* Returns whether this block might throw an exception. This is
- * just a convenient shorthand for <code>getLastInsn().canThrow()</code>.
+ * just a convenient shorthand for {@code getLastInsn().canThrow()}.
*
- * @return <code>true</code> iff this block might throw an
+ * @return {@code true} iff this block might throw an
* exception
*/
public boolean canThrow() {
@@ -228,7 +228,7 @@
* the block to see if it could throw, and if so, whether it in fact
* has any associated handlers.
*
- * @return <code>true</code> iff this block has any associated
+ * @return {@code true} iff this block has any associated
* exception handlers
*/
public boolean hasExceptionHandlers() {
@@ -241,9 +241,9 @@
* if any. This is just a shorthand for inspecting the last
* instruction in the block to see if it could throw, and if so,
* grabbing the catch list out of it. If not, this returns an
- * empty list (not <code>null</code>).
+ * empty list (not {@code null}).
*
- * @return non-null; the exception handler types associated with
+ * @return {@code non-null;} the exception handler types associated with
* this block
*/
public TypeList getExceptionHandlerTypes() {
@@ -257,7 +257,7 @@
* amount.
*
* @param delta the amount to offset register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public BasicBlock withRegisterOffset(int delta) {
return new BasicBlock(label, insns.withRegisterOffset(delta),
diff --git a/dx/src/com/android/dx/rop/code/BasicBlockList.java b/dx/src/com/android/dx/rop/code/BasicBlockList.java
index 6564318..0627425 100644
--- a/dx/src/com/android/dx/rop/code/BasicBlockList.java
+++ b/dx/src/com/android/dx/rop/code/BasicBlockList.java
@@ -27,14 +27,14 @@
*/
public final class BasicBlockList extends LabeledList {
/**
- * >= -1; the count of registers required by this method or
- * <code>-1</code> if not yet calculated
+ * {@code >= -1;} the count of registers required by this method or
+ * {@code -1} if not yet calculated
*/
private int regCount;
/**
- * Constructs an instance. All indices initially contain <code>null</code>,
- * and the first-block label is initially <code>-1</code>.
+ * Constructs an instance. All indices initially contain {@code null},
+ * and the first-block label is initially {@code -1}.
*
* @param size the size of the list
*/
@@ -45,7 +45,7 @@
}
/**
- * Constructs a mutable copy for <code>getMutableCopy()</code>.
+ * Constructs a mutable copy for {@code getMutableCopy()}.
*
* @param old block to copy
*/
@@ -58,10 +58,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public BasicBlock get(int n) {
return (BasicBlock) get0(n);
@@ -70,8 +70,8 @@
/**
* Sets the basic block at the given index.
*
- * @param n >= 0, < size(); which index
- * @param bb null-ok; the element to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param bb {@code null-ok;} the element to set at {@code n}
*/
public void set(int n, BasicBlock bb) {
super.set(n, bb);
@@ -86,7 +86,7 @@
* instance's instructions (indirectly through {@link BasicBlock}
* instances).
*
- * @return >= 0; the register count
+ * @return {@code >= 0;} the register count
*/
public int getRegCount() {
if (regCount == -1) {
@@ -102,7 +102,7 @@
* Gets the total instruction count for this instance. This is the
* sum of the instruction counts of each block.
*
- * @return >= 0; the total instruction count
+ * @return {@code >= 0;} the total instruction count
*/
public int getInstructionCount() {
int sz = size();
@@ -122,7 +122,7 @@
* Gets the total instruction count for this instance, ignoring
* mark-local instructions which are not actually emitted.
*
- * @return >= 0; the total instruction count
+ * @return {@code >= 0;} the total instruction count
*/
public int getEffectiveInstructionCount() {
int sz = size();
@@ -151,8 +151,8 @@
/**
* Gets the first block in the list with the given label, if any.
*
- * @param label >= 0; the label to look for
- * @return non-null; the so-labelled block
+ * @param label {@code >= 0;} the label to look for
+ * @return {@code non-null;} the so-labelled block
* @throws IllegalArgumentException thrown if the label isn't found
*/
public BasicBlock labelToBlock(int label) {
@@ -169,7 +169,7 @@
/**
* Visits each instruction of each block in the list, in order.
*
- * @param visitor non-null; visitor to use
+ * @param visitor {@code non-null;} visitor to use
*/
public void forEachInsn(Insn.Visitor visitor) {
int sz = size();
@@ -188,7 +188,7 @@
* original.
*
* @param delta the amount to offset register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public BasicBlockList withRegisterOffset(int delta) {
int sz = size();
@@ -211,7 +211,7 @@
/**
* Returns a mutable copy of this list.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public BasicBlockList getMutableCopy() {
return new BasicBlockList(this);
@@ -222,10 +222,10 @@
* only has one successor, then that is the preferred successor.
* Otherwise, if the block has a primay successor, then that is
* the preferred successor. If the block has no successors, then
- * this returns <code>null</code>.
+ * this returns {@code null}.
*
- * @param block non-null; the block in question
- * @return null-ok; the preferred successor, if any
+ * @param block {@code non-null;} the block in question
+ * @return {@code null-ok;} the preferred successor, if any
*/
public BasicBlock preferredSuccessorOf(BasicBlock block) {
int primarySuccessor = block.getPrimarySuccessor();
@@ -252,9 +252,9 @@
* Compares the catches of two blocks for equality. This includes
* both the catch types and target labels.
*
- * @param block1 non-null; one block to compare
- * @param block2 non-null; the other block to compare
- * @return <code>true</code> if the two blocks' non-primary successors
+ * @param block1 {@code non-null;} one block to compare
+ * @param block2 {@code non-null;} the other block to compare
+ * @return {@code true} if the two blocks' non-primary successors
* are identical
*/
public boolean catchesEqual(BasicBlock block1,
@@ -313,7 +313,7 @@
*/
private static class RegCountVisitor
implements Insn.Visitor {
- /** >= 0; register count in-progress */
+ /** {@code >= 0;} register count in-progress */
private int regCount;
/**
@@ -326,7 +326,7 @@
/**
* Gets the register count.
*
- * @return >= 0; the count
+ * @return {@code >= 0;} the count
*/
public int getRegCount() {
return regCount;
@@ -363,9 +363,9 @@
}
/**
- * Helper for all the <code>visit*</code> methods.
+ * Helper for all the {@code visit*} methods.
*
- * @param insn non-null; instruction being visited
+ * @param insn {@code non-null;} instruction being visited
*/
private void visit(Insn insn) {
RegisterSpec result = insn.getResult();
@@ -385,7 +385,7 @@
/**
* Processes the given register spec.
*
- * @param spec non-null; the register spec
+ * @param spec {@code non-null;} the register spec
*/
private void processReg(RegisterSpec spec) {
int reg = spec.getNextReg();
diff --git a/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java b/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java
index a9da109..1ecf02c 100644
--- a/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java
+++ b/dx/src/com/android/dx/rop/code/ConservativeTranslationAdvice.java
@@ -18,11 +18,11 @@
/**
* Implementation of {@link TranslationAdvice} which conservatively answers
- * <code>false</code> to all methods.
+ * {@code false} to all methods.
*/
public final class ConservativeTranslationAdvice
implements TranslationAdvice {
- /** non-null; standard instance of this class */
+ /** {@code non-null;} standard instance of this class */
public static final ConservativeTranslationAdvice THE_ONE =
new ConservativeTranslationAdvice();
diff --git a/dx/src/com/android/dx/rop/code/CstInsn.java b/dx/src/com/android/dx/rop/code/CstInsn.java
index d1cf523..26df1a9 100644
--- a/dx/src/com/android/dx/rop/code/CstInsn.java
+++ b/dx/src/com/android/dx/rop/code/CstInsn.java
@@ -23,17 +23,17 @@
*/
public abstract class CstInsn
extends Insn {
- /** non-null; the constant */
+ /** {@code non-null;} the constant */
private final Constant cst;
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param sources non-null; specs for all the sources
- * @param cst non-null; constant
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param sources {@code non-null;} specs for all the sources
+ * @param cst {@code non-null;} constant
*/
public CstInsn(Rop opcode, SourcePosition position, RegisterSpec result,
RegisterSpecList sources, Constant cst) {
@@ -55,7 +55,7 @@
/**
* Gets the constant.
*
- * @return non-null; the constant
+ * @return {@code non-null;} the constant
*/
public Constant getConstant() {
return cst;
diff --git a/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java b/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java
index 1c23824..8dbc00b 100644
--- a/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java
+++ b/dx/src/com/android/dx/rop/code/DexTranslationAdvice.java
@@ -25,7 +25,7 @@
*/
public final class DexTranslationAdvice
implements TranslationAdvice {
- /** non-null; standard instance of this class */
+ /** {@code non-null;} standard instance of this class */
public static final DexTranslationAdvice THE_ONE =
new DexTranslationAdvice();
@@ -98,8 +98,8 @@
/**
* Calculates the total rop width of the list of SSA registers
*
- * @param sources non-null; list of SSA registers
- * @return >= 0 rop-form width in register units
+ * @param sources {@code non-null;} list of SSA registers
+ * @return {@code >= 0;} rop-form width in register units
*/
private int totalRopWidth(RegisterSpecList sources) {
int sz = sources.size();
diff --git a/dx/src/com/android/dx/rop/code/Exceptions.java b/dx/src/com/android/dx/rop/code/Exceptions.java
index 3ef4879..f99a760 100644
--- a/dx/src/com/android/dx/rop/code/Exceptions.java
+++ b/dx/src/com/android/dx/rop/code/Exceptions.java
@@ -23,78 +23,78 @@
* Common exception types.
*/
public final class Exceptions {
- /** non-null; the type <code>java.lang.ArithmeticException</code> */
+ /** {@code non-null;} the type {@code java.lang.ArithmeticException} */
public static final Type TYPE_ArithmeticException =
Type.intern("Ljava/lang/ArithmeticException;");
/**
- * non-null; the type
- * <code>java.lang.ArrayIndexOutOfBoundsException</code>
+ * {@code non-null;} the type
+ * {@code java.lang.ArrayIndexOutOfBoundsException}
*/
public static final Type TYPE_ArrayIndexOutOfBoundsException =
Type.intern("Ljava/lang/ArrayIndexOutOfBoundsException;");
- /** non-null; the type <code>java.lang.ArrayStoreException</code> */
+ /** {@code non-null;} the type {@code java.lang.ArrayStoreException} */
public static final Type TYPE_ArrayStoreException =
Type.intern("Ljava/lang/ArrayStoreException;");
- /** non-null; the type <code>java.lang.ClassCastException</code> */
+ /** {@code non-null;} the type {@code java.lang.ClassCastException} */
public static final Type TYPE_ClassCastException =
Type.intern("Ljava/lang/ClassCastException;");
- /** non-null; the type <code>java.lang.Error</code> */
+ /** {@code non-null;} the type {@code java.lang.Error} */
public static final Type TYPE_Error = Type.intern("Ljava/lang/Error;");
/**
- * non-null; the type
- * <code>java.lang.IllegalMonitorStateException</code>
+ * {@code non-null;} the type
+ * {@code java.lang.IllegalMonitorStateException}
*/
public static final Type TYPE_IllegalMonitorStateException =
Type.intern("Ljava/lang/IllegalMonitorStateException;");
- /** non-null; the type <code>java.lang.NegativeArraySizeException</code> */
+ /** {@code non-null;} the type {@code java.lang.NegativeArraySizeException} */
public static final Type TYPE_NegativeArraySizeException =
Type.intern("Ljava/lang/NegativeArraySizeException;");
- /** non-null; the type <code>java.lang.NullPointerException</code> */
+ /** {@code non-null;} the type {@code java.lang.NullPointerException} */
public static final Type TYPE_NullPointerException =
Type.intern("Ljava/lang/NullPointerException;");
- /** non-null; the list <code>[java.lang.Error]</code> */
+ /** {@code non-null;} the list {@code [java.lang.Error]} */
public static final StdTypeList LIST_Error = StdTypeList.make(TYPE_Error);
/**
- * non-null; the list <code>[java.lang.Error,
- * java.lang.ArithmeticException]</code>
+ * {@code non-null;} the list {@code[java.lang.Error,
+ * java.lang.ArithmeticException]}
*/
public static final StdTypeList LIST_Error_ArithmeticException =
StdTypeList.make(TYPE_Error, TYPE_ArithmeticException);
/**
- * non-null; the list <code>[java.lang.Error,
- * java.lang.ClassCastException]</code>
+ * {@code non-null;} the list {@code[java.lang.Error,
+ * java.lang.ClassCastException]}
*/
public static final StdTypeList LIST_Error_ClassCastException =
StdTypeList.make(TYPE_Error, TYPE_ClassCastException);
/**
- * non-null; the list <code>[java.lang.Error,
- * java.lang.NegativeArraySizeException]</code>
+ * {@code non-null;} the list {@code [java.lang.Error,
+ * java.lang.NegativeArraySizeException]}
*/
public static final StdTypeList LIST_Error_NegativeArraySizeException =
StdTypeList.make(TYPE_Error, TYPE_NegativeArraySizeException);
/**
- * non-null; the list <code>[java.lang.Error,
- * java.lang.NullPointerException]</code>
+ * {@code non-null;} the list {@code [java.lang.Error,
+ * java.lang.NullPointerException]}
*/
public static final StdTypeList LIST_Error_NullPointerException =
StdTypeList.make(TYPE_Error, TYPE_NullPointerException);
/**
- * non-null; the list <code>[java.lang.Error,
+ * {@code non-null;} the list {@code [java.lang.Error,
* java.lang.NullPointerException,
- * java.lang.ArrayIndexOutOfBoundsException]</code>
+ * java.lang.ArrayIndexOutOfBoundsException]}
*/
public static final StdTypeList LIST_Error_Null_ArrayIndexOutOfBounds =
StdTypeList.make(TYPE_Error,
@@ -102,10 +102,10 @@
TYPE_ArrayIndexOutOfBoundsException);
/**
- * non-null; the list <code>[java.lang.Error,
+ * {@code non-null;} the list {@code [java.lang.Error,
* java.lang.NullPointerException,
* java.lang.ArrayIndexOutOfBoundsException,
- * java.lang.ArrayStoreException]</code>
+ * java.lang.ArrayStoreException]}
*/
public static final StdTypeList LIST_Error_Null_ArrayIndex_ArrayStore =
StdTypeList.make(TYPE_Error,
@@ -114,9 +114,9 @@
TYPE_ArrayStoreException);
/**
- * non-null; the list <code>[java.lang.Error,
+ * {@code non-null;} the list {@code [java.lang.Error,
* java.lang.NullPointerException,
- * java.lang.IllegalMonitorStateException]</code>
+ * java.lang.IllegalMonitorStateException]}
*/
public static final StdTypeList
LIST_Error_Null_IllegalMonitorStateException =
diff --git a/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java b/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java
index 3798afb..0fc7d2b 100644
--- a/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java
+++ b/dx/src/com/android/dx/rop/code/FillArrayDataInsn.java
@@ -42,11 +42,11 @@
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param sources non-null; specs for all the sources
- * @param initValues non-null; list of initial values to fill the array
- * @param cst non-null; type of the new array
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param sources {@code non-null;} specs for all the sources
+ * @param initValues {@code non-null;} list of initial values to fill the array
+ * @param cst {@code non-null;} type of the new array
*/
public FillArrayDataInsn(Rop opcode, SourcePosition position,
RegisterSpecList sources,
@@ -71,7 +71,7 @@
/**
* Return the list of init values
- * @return non-null; list of init values
+ * @return {@code non-null;} list of init values
*/
public ArrayList<Constant> getInitValues() {
return initValues;
@@ -79,7 +79,7 @@
/**
* Return the type of the newly created array
- * @return non-null; array type
+ * @return {@code non-null;} array type
*/
public Constant getConstant() {
return arrayType;
diff --git a/dx/src/com/android/dx/rop/code/Insn.java b/dx/src/com/android/dx/rop/code/Insn.java
index b1ad0ad..77ab9c0 100644
--- a/dx/src/com/android/dx/rop/code/Insn.java
+++ b/dx/src/com/android/dx/rop/code/Insn.java
@@ -30,25 +30,25 @@
* information.
*/
public abstract class Insn implements ToHuman {
- /** non-null; opcode */
+ /** {@code non-null;} opcode */
private final Rop opcode;
- /** non-null; source position */
+ /** {@code non-null;} source position */
private final SourcePosition position;
- /** null-ok; spec for the result of this instruction, if any */
+ /** {@code null-ok;} spec for the result of this instruction, if any */
private final RegisterSpec result;
- /** non-null; specs for all the sources of this instruction */
+ /** {@code non-null;} specs for all the sources of this instruction */
private final RegisterSpecList sources;
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param sources non-null; specs for all the sources
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param sources {@code non-null;} specs for all the sources
*/
public Insn(Rop opcode, SourcePosition position, RegisterSpec result,
RegisterSpecList sources) {
@@ -74,7 +74,7 @@
* {@inheritDoc}
*
* Instances of this class compare by identity. That is,
- * <code>x.equals(y)</code> is only true if <code>x == y</code>.
+ * {@code x.equals(y)} is only true if {@code x == y}.
*/
@Override
public final boolean equals(Object other) {
@@ -102,7 +102,7 @@
/**
* Gets a human-oriented (and slightly lossy) string for this instance.
*
- * @return non-null; the human string form
+ * @return {@code non-null;} the human string form
*/
public String toHuman() {
return toHumanWithInline(getInlineString());
@@ -112,7 +112,7 @@
* Gets an "inline" string portion for toHuman(), if available. This
* is the portion that appears after the Rop opcode
*
- * @return null-ok; if non-null, the inline text for toHuman()
+ * @return {@code null-ok;} if non-null, the inline text for toHuman()
*/
public String getInlineString() {
return null;
@@ -121,7 +121,7 @@
/**
* Gets the opcode.
*
- * @return non-null; the opcode
+ * @return {@code non-null;} the opcode
*/
public final Rop getOpcode() {
return opcode;
@@ -130,17 +130,17 @@
/**
* Gets the source position.
*
- * @return non-null; the source position
+ * @return {@code non-null;} the source position
*/
public final SourcePosition getPosition() {
return position;
}
/**
- * Gets the result spec, if any. A return value of <code>null</code>
+ * Gets the result spec, if any. A return value of {@code null}
* means this instruction returns nothing.
*
- * @return null-ok; the result spec, if any
+ * @return {@code null-ok;} the result spec, if any
*/
public final RegisterSpec getResult() {
return result;
@@ -149,10 +149,10 @@
/**
* Gets the spec of a local variable assignment that occurs at this
* instruction, or null if no local variable assignment occurs. This
- * may be the result register, or for <code>mark-local</code> insns
+ * may be the result register, or for {@code mark-local} insns
* it may be the source.
*
- * @return null-ok; a named register spec or null
+ * @return {@code null-ok;} a named register spec or null
*/
public final RegisterSpec getLocalAssignment() {
RegisterSpec assignment;
@@ -178,7 +178,7 @@
/**
* Gets the source specs.
*
- * @return non-null; the source specs
+ * @return {@code non-null;} the source specs
*/
public final RegisterSpecList getSources() {
return sources;
@@ -186,9 +186,9 @@
/**
* Gets whether this instruction can possibly throw an exception. This
- * is just a convenient wrapper for <code>getOpcode().canThrow()</code>.
+ * is just a convenient wrapper for {@code getOpcode().canThrow()}.
*
- * @return <code>true</code> iff this instruction can possibly throw
+ * @return {@code true} iff this instruction can possibly throw
*/
public final boolean canThrow() {
return opcode.canThrow();
@@ -202,7 +202,7 @@
* exceptions. To determine whether this instruction can throw,
* use {@link #canThrow}.
*
- * @return non-null; the catches list
+ * @return {@code non-null;} the catches list
*/
public abstract TypeList getCatches();
@@ -210,7 +210,7 @@
* Calls the appropriate method on the given visitor, depending on the
* class of this instance. Subclasses must override this.
*
- * @param visitor non-null; the visitor to call on
+ * @param visitor {@code non-null;} the visitor to call on
*/
public abstract void accept(Visitor visitor);
@@ -221,8 +221,8 @@
* throw. To determine whether this instruction can throw, use
* {@link #canThrow}.
*
- * @param type non-null; type to append to the catch list
- * @return non-null; an appropriately-constructed instance
+ * @param type {@code non-null;} type to append to the catch list
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract Insn withAddedCatch(Type type);
@@ -231,7 +231,7 @@
* register references have been offset by the given delta.
*
* @param delta the amount to offset register references by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract Insn withRegisterOffset(int delta);
@@ -239,10 +239,10 @@
* Returns an instance that is just like this one, except that, if
* possible, the insn is converted into a version in which the last
* source (if it is a constant) is represented directly rather than
- * as a register reference. <code>this</code> is returned in cases where
+ * as a register reference. {@code this} is returned in cases where
* the translation is not possible.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Insn withLastSourceLiteral() {
return this;
@@ -251,7 +251,7 @@
/**
* Returns an exact copy of this Insn
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Insn copy() {
return withRegisterOffset(0);
@@ -270,8 +270,8 @@
}
/**
- * Compares Insn contents, since <code>Insn.equals()</code> is defined
- * to be an identity compare. Insn's are <code>contentEquals()</code>
+ * Compares Insn contents, since {@code Insn.equals()} is defined
+ * to be an identity compare. Insn's are {@code contentEquals()}
* if they have the same opcode, registers, source position, and other
* metadata.
*
@@ -290,9 +290,9 @@
* Returns an instance that is just like this one, except
* with new result and source registers.
*
- * @param result null-ok; new result register
- * @param sources non-null; new sources registers
- * @return non-null; an appropriately-constructed instance
+ * @param result {@code null-ok;} new result register
+ * @param sources {@code non-null;} new sources registers
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public abstract Insn withNewRegisters(RegisterSpec result,
RegisterSpecList sources);
@@ -301,8 +301,8 @@
* Returns the string form of this instance, with the given bit added in
* the standard location for an inline argument.
*
- * @param extra null-ok; the inline argument string
- * @return non-null; the string form
+ * @param extra {@code null-ok;} the inline argument string
+ * @return {@code non-null;} the string form
*/
protected final String toStringWithInline(String extra) {
StringBuffer sb = new StringBuffer(80);
@@ -334,8 +334,8 @@
* Returns the human string form of this instance, with the given
* bit added in the standard location for an inline argument.
*
- * @param extra null-ok; the inline argument string
- * @return non-null; the human string form
+ * @param extra {@code null-ok;} the inline argument string
+ * @return {@code non-null;} the human string form
*/
protected final String toHumanWithInline(String extra) {
StringBuffer sb = new StringBuffer(80);
@@ -380,42 +380,42 @@
/**
* Visits a {@link PlainInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitPlainInsn(PlainInsn insn);
/**
* Visits a {@link PlainCstInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitPlainCstInsn(PlainCstInsn insn);
/**
* Visits a {@link SwitchInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitSwitchInsn(SwitchInsn insn);
/**
* Visits a {@link ThrowingCstInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitThrowingCstInsn(ThrowingCstInsn insn);
/**
* Visits a {@link ThrowingInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitThrowingInsn(ThrowingInsn insn);
/**
* Visits a {@link FillArrayDataInsn}.
*
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitFillArrayDataInsn(FillArrayDataInsn insn);
}
diff --git a/dx/src/com/android/dx/rop/code/InsnList.java b/dx/src/com/android/dx/rop/code/InsnList.java
index 34f124c..493f7fc 100644
--- a/dx/src/com/android/dx/rop/code/InsnList.java
+++ b/dx/src/com/android/dx/rop/code/InsnList.java
@@ -24,7 +24,7 @@
public final class InsnList
extends FixedSizeList {
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -35,10 +35,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Insn get(int n) {
return (Insn) get0(n);
@@ -47,8 +47,8 @@
/**
* Sets the instruction at the given index.
*
- * @param n >= 0, < size(); which index
- * @param insn non-null; the instruction to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param insn {@code non-null;} the instruction to set at {@code n}
*/
public void set(int n, Insn insn) {
set0(n, insn);
@@ -56,9 +56,9 @@
/**
* Gets the last instruction. This is just a convenient shorthand for
- * <code>get(size() - 1)</code>.
+ * {@code get(size() - 1)}.
*
- * @return non-null; the last instruction
+ * @return {@code non-null;} the last instruction
*/
public Insn getLast() {
return get(size() - 1);
@@ -67,7 +67,7 @@
/**
* Visits each instruction in the list, in order.
*
- * @param visitor non-null; visitor to use
+ * @param visitor {@code non-null;} visitor to use
*/
public void forEach(Insn.Visitor visitor) {
int sz = size();
@@ -78,9 +78,9 @@
}
/**
- * Compares the contents of this <code>InsnList</code> with another.
+ * Compares the contents of this {@code InsnList} with another.
* The blocks must have the same number of insns, and each Insn must
- * also return true to <code>Insn.contentEquals()</code>.
+ * also return true to {@code Insn.contentEquals()}.
*
* @param b to compare
* @return true in the case described above.
@@ -108,7 +108,7 @@
* original.
*
* @param delta the amount to offset register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public InsnList withRegisterOffset(int delta) {
int sz = size();
diff --git a/dx/src/com/android/dx/rop/code/LocalItem.java b/dx/src/com/android/dx/rop/code/LocalItem.java
index bac6ce2..7d6bebe 100644
--- a/dx/src/com/android/dx/rop/code/LocalItem.java
+++ b/dx/src/com/android/dx/rop/code/LocalItem.java
@@ -22,10 +22,10 @@
* A local variable item: either a name or a signature or both.
*/
public class LocalItem implements Comparable<LocalItem> {
- /** null-ok; local variable name */
+ /** {@code null-ok;} local variable name */
private final CstUtf8 name;
- /** null-ok; local variable signature */
+ /** {@code null-ok;} local variable signature */
private final CstUtf8 signature;
/**
@@ -33,9 +33,9 @@
*
* TODO: intern these
*
- * @param name null-ok; local variable name
- * @param signature null-ok; local variable signature
- * @return non-null; appropriate instance.
+ * @param name {@code null-ok;} local variable name
+ * @param signature {@code null-ok;} local variable signature
+ * @return {@code non-null;} appropriate instance.
*/
public static LocalItem make(CstUtf8 name, CstUtf8 signature) {
if (name == null && signature == null) {
@@ -48,8 +48,8 @@
/**
* Constructs instance.
*
- * @param name null-ok; local variable name
- * @param signature null-ok; local variable signature
+ * @param name {@code null-ok;} local variable name
+ * @param signature {@code null-ok;} local variable signature
*/
private LocalItem(CstUtf8 name, CstUtf8 signature) {
this.name = name;
@@ -126,7 +126,7 @@
/**
* Gets name.
*
- * @return null-ok; name
+ * @return {@code null-ok;} name
*/
public CstUtf8 getName() {
return name;
@@ -135,7 +135,7 @@
/**
* Gets signature.
*
- * @return null-ok; signature
+ * @return {@code null-ok;} signature
*/
public CstUtf8 getSignature() {
return signature;
diff --git a/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java b/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java
index 2d4cbce..14ebbc4 100644
--- a/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java
+++ b/dx/src/com/android/dx/rop/code/LocalVariableExtractor.java
@@ -24,23 +24,23 @@
* a method.
*/
public final class LocalVariableExtractor {
- /** non-null; method being extracted from */
+ /** {@code non-null;} method being extracted from */
private final RopMethod method;
- /** non-null; block list for the method */
+ /** {@code non-null;} block list for the method */
private final BasicBlockList blocks;
- /** non-null; result in-progress */
+ /** {@code non-null;} result in-progress */
private final LocalVariableInfo resultInfo;
- /** non-null; work set indicating blocks needing to be processed */
+ /** {@code non-null;} work set indicating blocks needing to be processed */
private final int[] workSet;
/**
* Extracts out all the local variable information from the given method.
*
- * @param method non-null; the method to extract from
- * @return non-null; the extracted information
+ * @param method {@code non-null;} the method to extract from
+ * @return {@code non-null;} the extracted information
*/
public static LocalVariableInfo extract(RopMethod method) {
LocalVariableExtractor lve = new LocalVariableExtractor(method);
@@ -50,7 +50,7 @@
/**
* Constructs an instance. This method is private. Use {@link #extract}.
*
- * @param method non-null; the method to extract from
+ * @param method {@code non-null;} the method to extract from
*/
private LocalVariableExtractor(RopMethod method) {
if (method == null) {
@@ -69,7 +69,7 @@
/**
* Does the extraction.
*
- * @return non-null; the extracted information
+ * @return {@code non-null;} the extracted information
*/
private LocalVariableInfo doit() {
for (int label = method.getFirstLabel();
@@ -86,7 +86,7 @@
/**
* Processes a single block.
*
- * @param label >= 0; label of the block to process
+ * @param label {@code >= 0;} label of the block to process
*/
private void processBlock(int label) {
RegisterSpecSet primaryState = resultInfo.mutableCopyOfStarts(label);
diff --git a/dx/src/com/android/dx/rop/code/LocalVariableInfo.java b/dx/src/com/android/dx/rop/code/LocalVariableInfo.java
index 29c239b..fa5e7cc 100644
--- a/dx/src/com/android/dx/rop/code/LocalVariableInfo.java
+++ b/dx/src/com/android/dx/rop/code/LocalVariableInfo.java
@@ -27,30 +27,30 @@
*/
public final class LocalVariableInfo
extends MutabilityControl {
- /** >= 0; the register count for the method */
+ /** {@code >= 0;} the register count for the method */
private final int regCount;
/**
- * non-null; {@link RegisterSpecSet} to use when indicating a block
+ * {@code non-null;} {@link RegisterSpecSet} to use when indicating a block
* that has no locals; it is empty and immutable but has an appropriate
* max size for the method
*/
private final RegisterSpecSet emptySet;
/**
- * non-null; array consisting of register sets representing the
+ * {@code non-null;} array consisting of register sets representing the
* sets of variables already assigned upon entry to each block,
* where array indices correspond to block labels
*/
private final RegisterSpecSet[] blockStarts;
- /** non-null; map from instructions to the variable each assigns */
+ /** {@code non-null;} map from instructions to the variable each assigns */
private final HashMap<Insn, RegisterSpec> insnAssignments;
/**
* Constructs an instance.
*
- * @param method non-null; the method being represented by this instance
+ * @param method {@code non-null;} the method being represented by this instance
*/
public LocalVariableInfo(RopMethod method) {
if (method == null) {
@@ -73,8 +73,8 @@
* Sets the register set associated with the start of the block with
* the given label.
*
- * @param label >= 0; the block label
- * @param specs non-null; the register set to associate with the block
+ * @param label {@code >= 0;} the block label
+ * @param specs {@code non-null;} the register set to associate with the block
*/
public void setStarts(int label, RegisterSpecSet specs) {
throwIfImmutable();
@@ -98,12 +98,12 @@
* merge the two sets and call {@link #setStarts} on the result of the
* merge.
*
- * @param label >= 0; the block label
- * @param specs non-null; the register set to merge into the start set
+ * @param label {@code >= 0;} the block label
+ * @param specs {@code non-null;} the register set to merge into the start set
* for the block
- * @return <code>true</code> if the merge resulted in an actual change
+ * @return {@code true} if the merge resulted in an actual change
* to the associated set (including storing one for the first time) or
- * <code>false</code> if there was no change
+ * {@code false} if there was no change
*/
public boolean mergeStarts(int label, RegisterSpecSet specs) {
RegisterSpecSet start = getStarts0(label);
@@ -132,8 +132,8 @@
* with the given label. This returns an empty set with the appropriate
* max size if no set was associated with the block in question.
*
- * @param label >= 0; the block label
- * @return non-null; the associated register set
+ * @param label {@code >= 0;} the block label
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet getStarts(int label) {
RegisterSpecSet result = getStarts0(label);
@@ -144,10 +144,10 @@
/**
* Gets the register set associated with the start of the given
* block. This is just convenient shorthand for
- * <code>getStarts(block.getLabel())</code>.
+ * {@code getStarts(block.getLabel())}.
*
- * @param block non-null; the block in question
- * @return non-null; the associated register set
+ * @param block {@code non-null;} the block in question
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet getStarts(BasicBlock block) {
return getStarts(block.getLabel());
@@ -159,8 +159,8 @@
* newly-allocated empty {@link RegisterSpecSet} of appropriate
* max size if there is not yet any set associated with the block.
*
- * @param label >= 0; the block label
- * @return non-null; the associated register set
+ * @param label {@code >= 0;} the block label
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet mutableCopyOfStarts(int label) {
RegisterSpecSet result = getStarts0(label);
@@ -180,8 +180,8 @@
* simple type and the one in the instruction can be an arbitrary
* {@link TypeBearer} (such as a constant value).
*
- * @param insn non-null; the instruction in question
- * @param spec non-null; the associated register spec
+ * @param insn {@code non-null;} the instruction in question
+ * @param spec {@code non-null;} the associated register spec
*/
public void addAssignment(Insn insn, RegisterSpec spec) {
throwIfImmutable();
@@ -201,8 +201,8 @@
* Gets the named register being assigned by the given instruction, if
* previously stored in this instance.
*
- * @param insn non-null; instruction in question
- * @return null-ok; the named register being assigned, if any
+ * @param insn {@code non-null;} instruction in question
+ * @return {@code null-ok;} the named register being assigned, if any
*/
public RegisterSpec getAssignment(Insn insn) {
return insnAssignments.get(insn);
@@ -211,7 +211,7 @@
/**
* Gets the number of assignments recorded by this instance.
*
- * @return >= 0; the number of assignments
+ * @return {@code >= 0;} the number of assignments
*/
public int getAssignmentCount() {
return insnAssignments.size();
@@ -235,8 +235,8 @@
* Helper method, to get the starts for a label, throwing the
* right exception for range problems.
*
- * @param label >= 0; the block label
- * @return null-ok; associated register set or <code>null</code> if there
+ * @param label {@code >= 0;} the block label
+ * @return {@code null-ok;} associated register set or {@code null} if there
* is none
*/
private RegisterSpecSet getStarts0(int label) {
diff --git a/dx/src/com/android/dx/rop/code/PlainCstInsn.java b/dx/src/com/android/dx/rop/code/PlainCstInsn.java
index 908b3cb..7a3ac38 100644
--- a/dx/src/com/android/dx/rop/code/PlainCstInsn.java
+++ b/dx/src/com/android/dx/rop/code/PlainCstInsn.java
@@ -30,11 +30,11 @@
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param sources non-null; specs for all the sources
- * @param cst non-null; the constant
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param sources {@code non-null;} specs for all the sources
+ * @param cst {@code non-null;} the constant
*/
public PlainCstInsn(Rop opcode, SourcePosition position,
RegisterSpec result, RegisterSpecList sources,
diff --git a/dx/src/com/android/dx/rop/code/PlainInsn.java b/dx/src/com/android/dx/rop/code/PlainInsn.java
index 4c5c9b7..d1db646 100644
--- a/dx/src/com/android/dx/rop/code/PlainInsn.java
+++ b/dx/src/com/android/dx/rop/code/PlainInsn.java
@@ -31,10 +31,10 @@
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param sources non-null; specs for all the sources
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param sources {@code non-null;} specs for all the sources
*/
public PlainInsn(Rop opcode, SourcePosition position,
RegisterSpec result, RegisterSpecList sources) {
@@ -57,10 +57,10 @@
/**
* Constructs a single-source instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param source non-null; spec for the source
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param source {@code non-null;} spec for the source
*/
public PlainInsn(Rop opcode, SourcePosition position, RegisterSpec result,
RegisterSpec source) {
diff --git a/dx/src/com/android/dx/rop/code/RegOps.java b/dx/src/com/android/dx/rop/code/RegOps.java
index f201f68..2084a69 100644
--- a/dx/src/com/android/dx/rop/code/RegOps.java
+++ b/dx/src/com/android/dx/rop/code/RegOps.java
@@ -21,283 +21,279 @@
/**
* All the register-based opcodes, and related utilities.
*
- * <p><b>Note:</b> Opcode descriptions use a rough pseudocode. <code>r</code>
- * is the result register, <code>x</code> is the first argument,
- * <code>y</code> is the second argument, and <code>z</code> is the
+ * <p><b>Note:</b> Opcode descriptions use a rough pseudocode. {@code r}
+ * is the result register, {@code x} is the first argument,
+ * {@code y} is the second argument, and {@code z} is the
* third argument. The expression which describes
* the operation uses Java-ish syntax but is preceded by type indicators for
* each of the values.
*/
public final class RegOps {
- /** <code>nop()</code> */
+ /** {@code nop()} */
public static final int NOP = 1;
- /** <code>T: any type; r,x: T :: r = x;</code> */
+ /** {@code T: any type; r,x: T :: r = x;} */
public static final int MOVE = 2;
- /** <code>T: any type; r,param(x): T :: r = param(x)</code> */
+ /** {@code T: any type; r,param(x): T :: r = param(x)} */
public static final int MOVE_PARAM = 3;
/**
- * <code>T: Throwable; r: T :: r = caught_exception</code>.
+ * {@code T: Throwable; r: T :: r = caught_exception}.
* <b>Note:</b> This opcode should only ever be used in the
* first instruction of a block, and such blocks must be
* the start of an exception handler.
*/
public static final int MOVE_EXCEPTION = 4;
- /** <code>T: any type; r, literal: T :: r = literal;</code> */
+ /** {@code T: any type; r, literal: T :: r = literal;} */
public static final int CONST = 5;
- /** <code>goto <i>label</i></code> */
+ /** {@code goto label} */
public static final int GOTO = 6;
/**
- * <code>T: int or Object; x,y: T :: if (x == y) goto
- * <i>label</i></code>
+ * {@code T: int or Object; x,y: T :: if (x == y) goto
+ * label}
*/
public static final int IF_EQ = 7;
/**
- * <code>T: int or Object; x,y: T :: if (x != y) goto
- * <i>label</i></code>
+ * {@code T: int or Object; x,y: T :: if (x != y) goto
+ * label}
*/
public static final int IF_NE = 8;
- /** <code>x,y: int :: if (x < y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x < y) goto label} */
public static final int IF_LT = 9;
- /** <code>x,y: int :: if (x >= y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x >= y) goto label} */
public static final int IF_GE = 10;
- /** <code>x,y: int :: if (x <= y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x <= y) goto label} */
public static final int IF_LE = 11;
- /** <code>x,y: int :: if (x > y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x > y) goto label} */
public static final int IF_GT = 12;
- /** <code>x: int :: goto <i>table[x]</i></code> */
+ /** {@code x: int :: goto table[x]} */
public static final int SWITCH = 13;
- /** <code>T: any numeric type; r,x,y: T :: r = x + y</code> */
+ /** {@code T: any numeric type; r,x,y: T :: r = x + y} */
public static final int ADD = 14;
- /** <code>T: any numeric type; r,x,y: T :: r = x - y</code> */
+ /** {@code T: any numeric type; r,x,y: T :: r = x - y} */
public static final int SUB = 15;
- /** <code>T: any numeric type; r,x,y: T :: r = x * y</code> */
+ /** {@code T: any numeric type; r,x,y: T :: r = x * y} */
public static final int MUL = 16;
- /** <code>T: any numeric type; r,x,y: T :: r = x / y</code> */
+ /** {@code T: any numeric type; r,x,y: T :: r = x / y} */
public static final int DIV = 17;
/**
- * <code>T: any numeric type; r,x,y: T :: r = x % y</code>
+ * {@code T: any numeric type; r,x,y: T :: r = x % y}
* (Java-style remainder)
*/
public static final int REM = 18;
- /** <code>T: any numeric type; r,x: T :: r = -x</code> */
+ /** {@code T: any numeric type; r,x: T :: r = -x} */
public static final int NEG = 19;
- /** <code>T: any integral type; r,x,y: T :: r = x & y</code> */
+ /** {@code T: any integral type; r,x,y: T :: r = x & y} */
public static final int AND = 20;
- /** <code>T: any integral type; r,x,y: T :: r = x | y</code> */
+ /** {@code T: any integral type; r,x,y: T :: r = x | y} */
public static final int OR = 21;
- /** <code>T: any integral type; r,x,y: T :: r = x ^ y</code> */
+ /** {@code T: any integral type; r,x,y: T :: r = x ^ y} */
public static final int XOR = 22;
/**
- * <code>T: any integral type; r,x: T; y: int :: r = x <<
- * y</code>
+ * {@code T: any integral type; r,x: T; y: int :: r = x << y}
*/
public static final int SHL = 23;
/**
- * <code>T: any integral type; r,x: T; y: int :: r = x >>
- * y</code> (signed right-shift)
+ * {@code T: any integral type; r,x: T; y: int :: r = x >> y}
+ * (signed right-shift)
*/
public static final int SHR = 24;
/**
- * <code>T: any integral type; r,x: T; y: int :: r = x
- * >>> y</code> (unsigned right-shift)
+ * {@code T: any integral type; r,x: T; y: int :: r = x >>> y}
+ * (unsigned right-shift)
*/
public static final int USHR = 25;
- /** <code>T: any integral type; r,x: T :: r = ~x</code> */
+ /** {@code T: any integral type; r,x: T :: r = ~x} */
public static final int NOT = 26;
/**
- * <code>T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0
- * : (x > y) ? 1 : -1</code> (Java-style "cmpl" where a NaN is
+ * {@code T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0
+ * : (x > y) ? 1 : -1} (Java-style "cmpl" where a NaN is
* considered "less than" all other values; also used for integral
* comparisons)
*/
public static final int CMPL = 27;
/**
- * <code>T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0
- * : (x < y) ? -1 : 1</code> (Java-style "cmpg" where a NaN is
+ * {@code T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0
+ * : (x < y) ? -1 : 1} (Java-style "cmpg" where a NaN is
* considered "greater than" all other values)
*/
public static final int CMPG = 28;
/**
- * <code>T: any numeric type; U: any numeric type; r: T; x: U ::
- * r = (T) x</code> (numeric type conversion between the four
+ * {@code T: any numeric type; U: any numeric type; r: T; x: U ::
+ * r = (T) x} (numeric type conversion between the four
* "real" numeric types)
*/
public static final int CONV = 29;
/**
- * <code>r,x: int :: r = (x << 24) >> 24</code> (Java-style
+ * {@code r,x: int :: r = (x << 24) >> 24} (Java-style
* convert int to byte)
*/
public static final int TO_BYTE = 30;
/**
- * <code>r,x: int :: r = x & 0xffff</code> (Java-style
- * convert int to char)
+ * {@code r,x: int :: r = x & 0xffff} (Java-style convert int to char)
*/
public static final int TO_CHAR = 31;
/**
- * <code>r,x: int :: r = (x << 16) >> 16</code> (Java-style
+ * {@code r,x: int :: r = (x << 16) >> 16} (Java-style
* convert int to short)
*/
public static final int TO_SHORT = 32;
- /** <code>T: return type for the method; x: T; return x</code> */
+ /** {@code T: return type for the method; x: T; return x} */
public static final int RETURN = 33;
- /** <code>T: any type; r: int; x: T[]; :: r = x.length</code> */
+ /** {@code T: any type; r: int; x: T[]; :: r = x.length} */
public static final int ARRAY_LENGTH = 34;
- /** <code>x: Throwable :: throw(x)</code> */
+ /** {@code x: Throwable :: throw(x)} */
public static final int THROW = 35;
- /** <code>x: Object :: monitorenter(x)</code> */
+ /** {@code x: Object :: monitorenter(x)} */
public static final int MONITOR_ENTER = 36;
- /** <code>x: Object :: monitorexit(x)</code> */
+ /** {@code x: Object :: monitorexit(x)} */
public static final int MONITOR_EXIT = 37;
- /** <code>T: any type; r: T; x: T[]; y: int :: r = x[y]</code> */
+ /** {@code T: any type; r: T; x: T[]; y: int :: r = x[y]} */
public static final int AGET = 38;
- /** <code>T: any type; x: T; y: T[]; z: int :: x[y] = z</code> */
+ /** {@code T: any type; x: T; y: T[]; z: int :: x[y] = z} */
public static final int APUT = 39;
/**
- * <code>T: any non-array object type :: r =
- * alloc(T)</code> (allocate heap space for an object)
+ * {@code T: any non-array object type :: r =
+ * alloc(T)} (allocate heap space for an object)
*/
public static final int NEW_INSTANCE = 40;
- /** <code>T: any array type; r: T; x: int :: r = new T[x]</code> */
+ /** {@code T: any array type; r: T; x: int :: r = new T[x]} */
public static final int NEW_ARRAY = 41;
/**
- * <code>T: any array type; r: T; x: int; v0..vx: T :: r = new T[x]
- * {v0, ..., vx}</code>
+ * {@code T: any array type; r: T; x: int; v0..vx: T :: r = new T[x]
+ * {v0, ..., vx}}
*/
public static final int FILLED_NEW_ARRAY = 42;
/**
- * <code>T: any object type; x: Object :: (T) x</code> (can
- * throw <code>ClassCastException</code>)
+ * {@code T: any object type; x: Object :: (T) x} (can
+ * throw {@code ClassCastException})
*/
public static final int CHECK_CAST = 43;
/**
- * <code>T: any object type; x: Object :: x instanceof
- * T</code>
+ * {@code T: any object type; x: Object :: x instanceof T}
*/
public static final int INSTANCE_OF = 44;
/**
- * <code>T: any type; r: T; x: Object; f: instance field spec of
- * type T :: r = x.f</code>
+ * {@code T: any type; r: T; x: Object; f: instance field spec of
+ * type T :: r = x.f}
*/
public static final int GET_FIELD = 45;
/**
- * <code>T: any type; r: T; f: static field spec of type T :: r =
- * f</code>
+ * {@code T: any type; r: T; f: static field spec of type T :: r =
+ * f}
*/
public static final int GET_STATIC = 46;
/**
- * <code>T: any type; x: T; y: Object; f: instance field spec of type
- * T :: y.f = x</code>
+ * {@code T: any type; x: T; y: Object; f: instance field spec of type
+ * T :: y.f = x}
*/
public static final int PUT_FIELD = 47;
/**
- * <code>T: any type; f: static field spec of type T; x: T :: f =
- * x</code>
+ * {@code T: any type; f: static field spec of type T; x: T :: f = x}
*/
public static final int PUT_STATIC = 48;
/**
- * <code>Tr, T0, T1...: any types; r: Tr; m: static method spec;
- * y0: T0; y1: T1 ... :: r = m(y0, y1, ...)</code> (call static
+ * {@code Tr, T0, T1...: any types; r: Tr; m: static method spec;
+ * y0: T0; y1: T1 ... :: r = m(y0, y1, ...)} (call static
* method)
*/
public static final int INVOKE_STATIC = 49;
/**
- * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
- * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call normal
+ * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
+ * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call normal
* virtual method)
*/
public static final int INVOKE_VIRTUAL = 50;
/**
- * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
- * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call
+ * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
+ * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call
* superclass virtual method)
*/
public static final int INVOKE_SUPER = 51;
/**
- * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
- * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)</code> (call
+ * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method
+ * spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...)} (call
* direct/special method)
*/
public static final int INVOKE_DIRECT = 52;
/**
- * <code>Tr, T0, T1...: any types; r: Tr; x: Object; m: interface
+ * {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: interface
* (instance) method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1,
- * ...)</code> (call interface method)
+ * ...)} (call interface method)
*/
public static final int INVOKE_INTERFACE = 53;
/**
- * <code> T0: any type; </code> (mark beginning or end of local variable
- * name
+ * {@code T0: any type; name: local variable name :: mark(name,T0)}
+ * (mark beginning or end of local variable name)
*/
public static final int MARK_LOCAL = 54;
/**
- * <code>T: Any type; r: T :: r = return_type</code>.
+ * {@code T: Any type; r: T :: r = return_type}.
* <b>Note:</b> This opcode should only ever be used in the
* first instruction of a block following an invoke-*.
*/
public static final int MOVE_RESULT = 55;
/**
- * <code>T: Any type; r: T :: r = return_type</code>.
+ * {@code T: Any type; r: T :: r = return_type}.
* <b>Note:</b> This opcode should only ever be used in the
* first instruction of a block following a non-invoke throwing insn
*/
public static final int MOVE_RESULT_PSEUDO = 56;
- /** <code>T: Any primitive type; v0..vx: T :: {v0, ..., vx}</code> */
+ /** {@code T: Any primitive type; v0..vx: T :: {v0, ..., vx}} */
public static final int FILL_ARRAY_DATA = 57;
/**
@@ -310,8 +306,8 @@
/**
* Gets the name of the given opcode.
*
- * @param opcode >= 0, <= 255; the opcode
- * @return non-null; its name
+ * @param opcode {@code >= 0, <= 255;} the opcode
+ * @return {@code non-null;} its name
*/
public static String opName(int opcode) {
switch (opcode) {
diff --git a/dx/src/com/android/dx/rop/code/RegisterSpec.java b/dx/src/com/android/dx/rop/code/RegisterSpec.java
index 73af91f..8e819bf 100644
--- a/dx/src/com/android/dx/rop/code/RegisterSpec.java
+++ b/dx/src/com/android/dx/rop/code/RegisterSpec.java
@@ -30,33 +30,33 @@
*/
public final class RegisterSpec
implements TypeBearer, ToHuman, Comparable<RegisterSpec> {
- /** non-null; string to prefix register numbers with */
+ /** {@code non-null;} string to prefix register numbers with */
public static final String PREFIX = "v";
- /** non-null; intern table for instances */
+ /** {@code non-null;} intern table for instances */
private static final HashMap<Object, RegisterSpec> theInterns =
new HashMap<Object, RegisterSpec>(1000);
- /** non-null; common comparison instance used while interning */
+ /** {@code non-null;} common comparison instance used while interning */
private static final ForComparison theInterningItem = new ForComparison();
- /** >= 0; register number */
+ /** {@code >= 0;} register number */
private final int reg;
- /** non-null; type loaded or stored */
+ /** {@code non-null;} type loaded or stored */
private final TypeBearer type;
- /** null-ok; local variable info associated with this register, if any */
+ /** {@code null-ok;} local variable info associated with this register, if any */
private final LocalItem local;
/**
* Intern the given triple as an instance of this class.
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @param local null-ok; the associated local variable, if any
- * @return non-null; an appropriately-constructed instance
+ * @param local {@code null-ok;} the associated local variable, if any
+ * @return {@code non-null;} an appropriately-constructed instance
*/
private static RegisterSpec intern(int reg, TypeBearer type,
LocalItem local) {
@@ -77,10 +77,10 @@
* no variable info. This method is allowed to return shared
* instances (but doesn't necessarily do so).
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpec make(int reg, TypeBearer type) {
return intern(reg, type, null);
@@ -91,11 +91,11 @@
* variable info. This method is allowed to return shared
* instances (but doesn't necessarily do so).
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @param local non-null; the associated local variable
- * @return non-null; an appropriately-constructed instance
+ * @param local {@code non-null;} the associated local variable
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpec make(int reg, TypeBearer type,
LocalItem local) {
@@ -111,12 +111,12 @@
* variable info. This method is allowed to return shared
* instances (but doesn't necessarily do so).
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @param local null-ok; the associated variable info or null for
+ * @param local {@code null-ok;} the associated variable info or null for
* none
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpec makeLocalOptional(
int reg, TypeBearer type, LocalItem local) {
@@ -127,8 +127,8 @@
/**
* Gets the string form for the given register number.
*
- * @param reg >= 0; the register number
- * @return non-null; the string form
+ * @param reg {@code >= 0;} the register number
+ * @return {@code non-null;} the string form
*/
public static String regString(int reg) {
return PREFIX + reg;
@@ -138,10 +138,10 @@
* Constructs an instance. This constructor is private. Use
* {@link #make}.
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @param local null-ok; the associated local variable, if any
+ * @param local {@code null-ok;} the associated local variable, if any
*/
private RegisterSpec(int reg, TypeBearer type, LocalItem local) {
if (reg < 0) {
@@ -178,7 +178,7 @@
* to ignore whatever arbitrary extra stuff might be carried around
* by an outer {@link TypeBearer}.
*
- * @param other null-ok; spec to compare to
+ * @param other {@code null-ok;} spec to compare to
* @return {@code true} iff {@code this} and {@code other} are equal
* in the stated way
*/
@@ -195,7 +195,7 @@
* This is useful to determine if two instances refer to the "same"
* local variable.
*
- * @param other null-ok; spec to compare to
+ * @param other {@code null-ok;} spec to compare to
* @return {@code true} iff {@code this} and {@code other} are equal
* in the stated way
*/
@@ -230,8 +230,8 @@
* Compares by (in priority order) register number, unwrapped type
* (that is types not {@link TypeBearer}s, and local info.
*
- * @param other non-null; spec to compare to
- * @return {@code -1..1}; standard result of comparison
+ * @param other {@code non-null;} spec to compare to
+ * @return {@code -1..1;} standard result of comparison
*/
public int compareTo(RegisterSpec other) {
if (this.reg < other.reg) {
@@ -316,7 +316,7 @@
/**
* Gets the register number.
*
- * @return >= 0; the register number
+ * @return {@code >= 0;} the register number
*/
public int getReg() {
return reg;
@@ -326,7 +326,7 @@
* Gets the type (or actual value) which is loaded from or stored
* to the register associated with this instance.
*
- * @return non-null; the type
+ * @return {@code non-null;} the type
*/
public TypeBearer getTypeBearer() {
return type;
@@ -335,7 +335,7 @@
/**
* Gets the variable info associated with this instance, if any.
*
- * @return null-ok; the variable info, or <code>null</code> if this
+ * @return {@code null-ok;} the variable info, or {@code null} if this
* instance has none
*/
public LocalItem getLocalItem() {
@@ -349,7 +349,7 @@
* be used to determine the minimum required register count
* implied by this instance.
*
- * @return >= 0; the required registers size
+ * @return {@code >= 0;} the required registers size
*/
public int getNextReg() {
return reg + getCategory();
@@ -357,11 +357,11 @@
/**
* Gets the category of this instance's type. This is just a convenient
- * shorthand for <code>getType().getCategory()</code>.
+ * shorthand for {@code getType().getCategory()}.
*
* @see #isCategory1
* @see #isCategory2
- * @return 1..2; the category of this instance's type
+ * @return {@code 1..2;} the category of this instance's type
*/
public int getCategory() {
return type.getType().getCategory();
@@ -369,7 +369,7 @@
/**
* Gets whether this instance's type is category 1. This is just a
- * convenient shorthand for <code>getType().isCategory1()</code>.
+ * convenient shorthand for {@code getType().isCategory1()}.
*
* @see #getCategory
* @see #isCategory2
@@ -381,7 +381,7 @@
/**
* Gets whether this instance's type is category 2. This is just a
- * convenient shorthand for <code>getType().isCategory2()</code>.
+ * convenient shorthand for {@code getType().isCategory2()}.
*
* @see #getCategory
* @see #isCategory1
@@ -394,7 +394,7 @@
/**
* Gets the string form for just the register number of this instance.
*
- * @return non-null; the register string form
+ * @return {@code non-null;} the register string form
*/
public String regString() {
return regString(reg);
@@ -405,28 +405,28 @@
* and the given one, if any. The intersection is defined as follows:
*
* <ul>
- * <li>If <code>other</code> is <code>null</code>, then the result
- * is <code>null</code>.
+ * <li>If {@code other} is {@code null}, then the result
+ * is {@code null}.
* <li>If the register numbers don't match, then the intersection
- * is <code>null</code>. Otherwise, the register number of the
+ * is {@code null}. Otherwise, the register number of the
* intersection is the same as the one in the two instances.</li>
- * <li>If the types returned by <code>getType()</code> are not
- * <code>equals()</code>, then the intersection is null.</li>
- * <li>If the type bearers returned by <code>getTypeBearer()</code>
- * are <code>equals()</code>, then the intersection's type bearer
+ * <li>If the types returned by {@code getType()} are not
+ * {@code equals()}, then the intersection is null.</li>
+ * <li>If the type bearers returned by {@code getTypeBearer()}
+ * are {@code equals()}, then the intersection's type bearer
* is the one from this instance. Otherwise, the intersection's
- * type bearer is the <code>getType()</code> of this instance.</li>
- * <li>If the locals are <code>equals()</code>, then the local info
+ * type bearer is the {@code getType()} of this instance.</li>
+ * <li>If the locals are {@code equals()}, then the local info
* of the intersection is the local info of this instance. Otherwise,
- * the local info of the intersection is <code>null</code>.</li>
+ * the local info of the intersection is {@code null}.</li>
* </ul>
*
- * @param other null-ok; instance to intersect with (or <code>null</code>)
+ * @param other {@code null-ok;} instance to intersect with (or {@code null})
* @param localPrimary whether local variables are primary to the
- * intersection; if <code>true</code>, then the only non-null
+ * intersection; if {@code true}, then the only non-null
* results occur when registers being intersected have equal local
- * infos (or both have <code>null</code> local infos)
- * @return null-ok; the intersection
+ * infos (or both have {@code null} local infos)
+ * @return {@code null-ok;} the intersection
*/
public RegisterSpec intersect(RegisterSpec other, boolean localPrimary) {
if (this == other) {
@@ -471,8 +471,8 @@
* Returns an instance that is identical to this one, except that the
* register number is replaced by the given one.
*
- * @param newReg >= 0; the new register number
- * @return non-null; an appropriately-constructed instance
+ * @param newReg {@code >= 0;} the new register number
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec withReg(int newReg) {
if (reg == newReg) {
@@ -486,8 +486,8 @@
* Returns an instance that is identical to this one, except that
* the type is replaced by the given one.
*
- * @param newType non-null; the new type
- * @return non-null; an appropriately-constructed instance
+ * @param newType {@code non-null;} the new type
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec withType(TypeBearer newType) {
return makeLocalOptional(reg, newType, local);
@@ -498,7 +498,7 @@
* register number is offset by the given amount.
*
* @param delta the amount to offset the register number by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec withOffset(int delta) {
if (delta == 0) {
@@ -514,7 +514,7 @@
* (thereby stripping off non-type information) with any
* initialization information stripped away as well.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec withSimpleType() {
TypeBearer orig = type;
@@ -541,7 +541,7 @@
* Returns an instance that is identical to this one except that the
* local variable is as specified in the parameter.
*
- * @param local null-ok; the local item or null for none
+ * @param local {@code null-ok;} the local item or null for none
* @return an appropriate instance
*/
public RegisterSpec withLocalItem(LocalItem local) {
@@ -559,7 +559,7 @@
* Helper for {@link #toString} and {@link #toHuman}.
*
* @param human whether to be human-oriented
- * @return non-null; the string form
+ * @return {@code non-null;} the string form
*/
private String toString0(boolean human) {
StringBuffer sb = new StringBuffer(40);
@@ -588,27 +588,27 @@
/**
* Holder of register spec data for the purposes of comparison (so that
- * <code>RegisterSpec</code> itself can still keep <code>final</code>
+ * {@code RegisterSpec} itself can still keep {@code final}
* instance variables.
*/
private static class ForComparison {
- /** >= 0; register number */
+ /** {@code >= 0;} register number */
private int reg;
- /** non-null; type loaded or stored */
+ /** {@code non-null;} type loaded or stored */
private TypeBearer type;
- /** null-ok; local variable associated with this register, if any */
+ /** {@code null-ok;} local variable associated with this register, if any */
private LocalItem local;
/**
* Set all the instance variables.
*
- * @param reg >= 0; the register number
- * @param type non-null; the type (or possibly actual value) which
+ * @param reg {@code >= 0;} the register number
+ * @param type {@code non-null;} the type (or possibly actual value) which
* is loaded from or stored to the indicated register
- * @param local null-ok; the associated local variable, if any
- * @return non-null; an appropriately-constructed instance
+ * @param local {@code null-ok;} the associated local variable, if any
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public void set(int reg, TypeBearer type, LocalItem local) {
this.reg = reg;
@@ -617,10 +617,10 @@
}
/**
- * Construct a <code>RegisterSpec</code> of this instance's
+ * Construct a {@code RegisterSpec} of this instance's
* contents.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpec toRegisterSpec() {
return new RegisterSpec(reg, type, local);
diff --git a/dx/src/com/android/dx/rop/code/RegisterSpecList.java b/dx/src/com/android/dx/rop/code/RegisterSpecList.java
index 28657a1..5a02a8d 100644
--- a/dx/src/com/android/dx/rop/code/RegisterSpecList.java
+++ b/dx/src/com/android/dx/rop/code/RegisterSpecList.java
@@ -25,14 +25,14 @@
*/
public final class RegisterSpecList
extends FixedSizeList implements TypeList {
- /** non-null; no-element instance */
+ /** {@code non-null;} no-element instance */
public static final RegisterSpecList EMPTY = new RegisterSpecList(0);
/**
* Makes a single-element instance.
*
- * @param spec non-null; the element
- * @return non-null; an appropriately-constructed instance
+ * @param spec {@code non-null;} the element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpecList make(RegisterSpec spec) {
RegisterSpecList result = new RegisterSpecList(1);
@@ -43,9 +43,9 @@
/**
* Makes a two-element instance.
*
- * @param spec0 non-null; the first element
- * @param spec1 non-null; the second element
- * @return non-null; an appropriately-constructed instance
+ * @param spec0 {@code non-null;} the first element
+ * @param spec1 {@code non-null;} the second element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpecList make(RegisterSpec spec0,
RegisterSpec spec1) {
@@ -58,10 +58,10 @@
/**
* Makes a three-element instance.
*
- * @param spec0 non-null; the first element
- * @param spec1 non-null; the second element
- * @param spec2 non-null; the third element
- * @return non-null; an appropriately-constructed instance
+ * @param spec0 {@code non-null;} the first element
+ * @param spec1 {@code non-null;} the second element
+ * @param spec2 {@code non-null;} the third element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpecList make(RegisterSpec spec0, RegisterSpec spec1,
RegisterSpec spec2) {
@@ -75,11 +75,11 @@
/**
* Makes a four-element instance.
*
- * @param spec0 non-null; the first element
- * @param spec1 non-null; the second element
- * @param spec2 non-null; the third element
- * @param spec3 non-null; the fourth element
- * @return non-null; an appropriately-constructed instance
+ * @param spec0 {@code non-null;} the first element
+ * @param spec1 {@code non-null;} the second element
+ * @param spec2 {@code non-null;} the third element
+ * @param spec3 {@code non-null;} the fourth element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static RegisterSpecList make(RegisterSpec spec0, RegisterSpec spec1,
RegisterSpec spec2,
@@ -93,7 +93,7 @@
}
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -126,10 +126,10 @@
/**
* Gets the indicated element. It is an error to call this with the
* index for an element which was never set; if you do that, this
- * will throw <code>NullPointerException</code>.
+ * will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which element
- * @return non-null; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code non-null;} the indicated element
*/
public RegisterSpec get(int n) {
return (RegisterSpec) get0(n);
@@ -180,8 +180,8 @@
/**
* Sets the element at the given index.
*
- * @param n >= 0, < size(); which element
- * @param spec non-null; the value to store
+ * @param n {@code >= 0, < size();} which element
+ * @param spec {@code non-null;} the value to store
*/
public void set(int n, RegisterSpec spec) {
set0(n, spec);
@@ -193,7 +193,7 @@
* to plus the widest width (largest category) of the type used in
* that register.
*
- * @return >= 0; the required registers size
+ * @return {@code >= 0;} the required registers size
*/
public int getRegistersSize() {
int sz = size();
@@ -217,8 +217,8 @@
* except that it has an additional element prepended to the original.
* Mutability of the result is inherited from the original.
*
- * @param spec non-null; the new first spec (to prepend)
- * @return non-null; an appropriately-constructed instance
+ * @param spec {@code non-null;} the new first spec (to prepend)
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecList withFirst(RegisterSpec spec) {
int sz = size();
@@ -241,7 +241,7 @@
* except that its first element is removed. Mutability of the
* result is inherited from the original.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecList withoutFirst() {
int newSize = size() - 1;
@@ -268,7 +268,7 @@
* except that its last element is removed. Mutability of the
* result is inherited from the original.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecList withoutLast() {
int newSize = size() - 1;
@@ -296,7 +296,7 @@
* of the result is inherited from the original.
*
* @param delta the amount to offset the register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecList withOffset(int delta) {
int sz = size();
@@ -329,7 +329,7 @@
*
* @param base the base register number
* @param duplicateFirst whether to duplicate the first number
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecList withSequentialRegisters(int base,
boolean duplicateFirst) {
diff --git a/dx/src/com/android/dx/rop/code/RegisterSpecSet.java b/dx/src/com/android/dx/rop/code/RegisterSpecSet.java
index adc77c3..68009d9 100644
--- a/dx/src/com/android/dx/rop/code/RegisterSpecSet.java
+++ b/dx/src/com/android/dx/rop/code/RegisterSpecSet.java
@@ -25,23 +25,23 @@
*/
public final class RegisterSpecSet
extends MutabilityControl {
- /** non-null; no-element instance */
+ /** {@code non-null;} no-element instance */
public static final RegisterSpecSet EMPTY = new RegisterSpecSet(0);
/**
- * non-null; array of register specs, where each element is
- * <code>null</code> or is an instance whose <code>reg</code>
+ * {@code non-null;} array of register specs, where each element is
+ * {@code null} or is an instance whose {@code reg}
* matches the array index
*/
private final RegisterSpec[] specs;
- /** >= -1; size of the set or <code>-1</code> if not yet calculated */
+ /** {@code >= -1;} size of the set or {@code -1} if not yet calculated */
private int size;
/**
* Constructs an instance. The instance is initially empty.
*
- * @param maxSize >= 0; the maximum register number (exclusive) that
+ * @param maxSize {@code >= 0;} the maximum register number (exclusive) that
* may be represented in this instance
*/
public RegisterSpecSet(int maxSize) {
@@ -127,7 +127,7 @@
* is also the maximum-plus-one of register numbers that may be
* represented.
*
- * @return >= 0; the maximum size
+ * @return {@code >= 0;} the maximum size
*/
public int getMaxSize() {
return specs.length;
@@ -136,7 +136,7 @@
/**
* Gets the current size of this instance.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int size() {
int result = size;
@@ -160,9 +160,9 @@
/**
* Gets the element with the given register number, if any.
*
- * @param reg >= 0; the desired register number
- * @return null-ok; the element with the given register number or
- * <code>null</code> if there is none
+ * @param reg {@code >= 0;} the desired register number
+ * @return {@code null-ok;} the element with the given register number or
+ * {@code null} if there is none
*/
public RegisterSpec get(int reg) {
try {
@@ -176,11 +176,11 @@
/**
* Gets the element with the same register number as the given
* spec, if any. This is just a convenient shorthand for
- * <code>get(spec.getReg())</code>.
+ * {@code get(spec.getReg())}.
*
- * @param spec non-null; spec with the desired register number
- * @return null-ok; the element with the matching register number or
- * <code>null</code> if there is none
+ * @param spec {@code non-null;} spec with the desired register number
+ * @return {@code null-ok;} the element with the matching register number or
+ * {@code null} if there is none
*/
public RegisterSpec get(RegisterSpec spec) {
return get(spec.getReg());
@@ -192,8 +192,8 @@
* none. This ignores the register number of the given spec but
* matches on everything else.
*
- * @param spec non-null; local to look for
- * @return null-ok; first register found that matches, if any
+ * @param spec {@code non-null;} local to look for
+ * @return {@code null-ok;} first register found that matches, if any
*/
public RegisterSpec findMatchingLocal(RegisterSpec spec) {
int length = specs.length;
@@ -217,8 +217,8 @@
* Returns the spec in this set that's currently associated with a given
* local (name and signature), or {@code null} if there is none.
*
- * @param local non-null; local item to search for
- * @return null-ok; first register found with matching name and signature
+ * @param local {@code non-null;} local item to search for
+ * @return {@code null-ok;} first register found with matching name and signature
*/
public RegisterSpec localItemToSpec(LocalItem local) {
int length = specs.length;
@@ -238,7 +238,7 @@
* Removes a spec from the set. Only the register number
* of the parameter is significant.
*
- * @param toRemove non-null; register to remove.
+ * @param toRemove {@code non-null;} register to remove.
*/
public void remove(RegisterSpec toRemove) {
try {
@@ -258,7 +258,7 @@
* a category-2 register, then the immediately subsequent element
* is nullified.
*
- * @param spec non-null; the register spec to put in the instance
+ * @param spec {@code non-null;} the register spec to put in the instance
*/
public void put(RegisterSpec spec) {
throwIfImmutable();
@@ -293,7 +293,7 @@
/**
* Put the entire contents of the given set into this one.
*
- * @param set non-null; the set to put into this instance
+ * @param set {@code non-null;} the set to put into this instance
*/
public void putAll(RegisterSpecSet set) {
int max = set.getMaxSize();
@@ -312,11 +312,11 @@
* {@link RegisterSpec#intersect} of corresponding elements from
* this instance and the given one where both are non-null.
*
- * @param other non-null; set to intersect with
+ * @param other {@code non-null;} set to intersect with
* @param localPrimary whether local variables are primary to
- * the intersection; if <code>true</code>, then the only non-null
+ * the intersection; if {@code true}, then the only non-null
* result elements occur when registers being intersected have
- * equal names (or both have <code>null</code> names)
+ * equal names (or both have {@code null} names)
*/
public void intersect(RegisterSpecSet other, boolean localPrimary) {
throwIfImmutable();
@@ -352,7 +352,7 @@
* of the result is inherited from the original.
*
* @param delta the amount to offset the register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RegisterSpecSet withOffset(int delta) {
int len = specs.length;
@@ -377,7 +377,7 @@
/**
* Makes and return a mutable copy of this instance.
*
- * @return non-null; the mutable copy
+ * @return {@code non-null;} the mutable copy
*/
public RegisterSpecSet mutableCopy() {
int len = specs.length;
diff --git a/dx/src/com/android/dx/rop/code/Rop.java b/dx/src/com/android/dx/rop/code/Rop.java
index f918e12..fbd9a16 100644
--- a/dx/src/com/android/dx/rop/code/Rop.java
+++ b/dx/src/com/android/dx/rop/code/Rop.java
@@ -25,7 +25,7 @@
* Class that describes all the immutable parts of register-based operations.
*/
public final class Rop {
- /** minimum <code>BRANCH_*</code> value */
+ /** minimum {@code BRANCH_*} value */
public static final int BRANCH_MIN = 1;
/** indicates a non-branching op */
@@ -46,26 +46,26 @@
/** indicates a throw-style branch (both always-throws and may-throw) */
public static final int BRANCH_THROW = 6;
- /** maximum <code>BRANCH_*</code> value */
+ /** maximum {@code BRANCH_*} value */
public static final int BRANCH_MAX = 6;
/** the opcode; one of the constants in {@link RegOps} */
private final int opcode;
/**
- * non-null; result type of this operation; {@link Type#VOID} for
+ * {@code non-null;} result type of this operation; {@link Type#VOID} for
* no-result operations
*/
private final Type result;
- /** non-null; types of all the sources of this operation */
+ /** {@code non-null;} types of all the sources of this operation */
private final TypeList sources;
- /** non-null; list of possible types thrown by this operation */
+ /** {@code non-null;} list of possible types thrown by this operation */
private final TypeList exceptions;
/**
- * the branchingness of this op; one of the <code>BRANCH_*</code>
+ * the branchingness of this op; one of the {@code BRANCH_*}
* constants in this class
*/
private final int branchingness;
@@ -73,7 +73,7 @@
/** whether this is a function/method call op or similar */
private final boolean isCallLike;
- /** null-ok; nickname, if specified (used for debugging) */
+ /** {@code null-ok;} nickname, if specified (used for debugging) */
private final String nickname;
/**
@@ -81,15 +81,15 @@
* public constructors.
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param result non-null; result type of this operation; {@link
+ * @param result {@code non-null;} result type of this operation; {@link
* Type#VOID} for no-result operations
- * @param sources non-null; types of all the sources of this operation
- * @param exceptions non-null; list of possible types thrown by this
+ * @param sources {@code non-null;} types of all the sources of this operation
+ * @param exceptions {@code non-null;} list of possible types thrown by this
* operation
* @param branchingness the branchingness of this op; one of the
- * <code>BRANCH_*</code> constants
+ * {@code BRANCH_*} constants
* @param isCallLike whether the op is a function/method call or similar
- * @param nickname null-ok; optional nickname (used for debugging)
+ * @param nickname {@code null-ok;} optional nickname (used for debugging)
*/
public Rop(int opcode, Type result, TypeList sources,
TypeList exceptions, int branchingness, boolean isCallLike,
@@ -129,14 +129,14 @@
* call-like op (see {@link #isCallLike}).
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param result non-null; result type of this operation; {@link
+ * @param result {@code non-null;} result type of this operation; {@link
* Type#VOID} for no-result operations
- * @param sources non-null; types of all the sources of this operation
- * @param exceptions non-null; list of possible types thrown by this
+ * @param sources {@code non-null;} types of all the sources of this operation
+ * @param exceptions {@code non-null;} list of possible types thrown by this
* operation
* @param branchingness the branchingness of this op; one of the
- * <code>BRANCH_*</code> constants
- * @param nickname null-ok; optional nickname (used for debugging)
+ * {@code BRANCH_*} constants
+ * @param nickname {@code null-ok;} optional nickname (used for debugging)
*/
public Rop(int opcode, Type result, TypeList sources,
TypeList exceptions, int branchingness, String nickname) {
@@ -149,12 +149,12 @@
* call-like op (see {@link #isCallLike}).
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param result non-null; result type of this operation; {@link
+ * @param result {@code non-null;} result type of this operation; {@link
* Type#VOID} for no-result operations
- * @param sources non-null; types of all the sources of this operation
+ * @param sources {@code non-null;} types of all the sources of this operation
* @param branchingness the branchingness of this op; one of the
- * <code>BRANCH_*</code> constants
- * @param nickname null-ok; optional nickname (used for debugging)
+ * {@code BRANCH_*} constants
+ * @param nickname {@code null-ok;} optional nickname (used for debugging)
*/
public Rop(int opcode, Type result, TypeList sources, int branchingness,
String nickname) {
@@ -164,14 +164,14 @@
/**
* Constructs a non-branching no-exception instance. The
- * <code>branchingness</code> is always <code>BRANCH_NONE</code>,
+ * {@code branchingness} is always {@code BRANCH_NONE},
* and it is never a call-like op (see {@link #isCallLike}).
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param result non-null; result type of this operation; {@link
+ * @param result {@code non-null;} result type of this operation; {@link
* Type#VOID} for no-result operations
- * @param sources non-null; types of all the sources of this operation
- * @param nickname null-ok; optional nickname (used for debugging)
+ * @param sources {@code non-null;} types of all the sources of this operation
+ * @param nickname {@code null-ok;} optional nickname (used for debugging)
*/
public Rop(int opcode, Type result, TypeList sources, String nickname) {
this(opcode, result, sources, StdTypeList.EMPTY, Rop.BRANCH_NONE,
@@ -180,16 +180,16 @@
/**
* Constructs a non-empty exceptions instance. Its
- * <code>branchingness</code> is always <code>BRANCH_THROW</code>,
+ * {@code branchingness} is always {@code BRANCH_THROW},
* but it is never a call-like op (see {@link #isCallLike}).
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param result non-null; result type of this operation; {@link
+ * @param result {@code non-null;} result type of this operation; {@link
* Type#VOID} for no-result operations
- * @param sources non-null; types of all the sources of this operation
- * @param exceptions non-null; list of possible types thrown by this
+ * @param sources {@code non-null;} types of all the sources of this operation
+ * @param exceptions {@code non-null;} list of possible types thrown by this
* operation
- * @param nickname null-ok; optional nickname (used for debugging)
+ * @param nickname {@code null-ok;} optional nickname (used for debugging)
*/
public Rop(int opcode, Type result, TypeList sources, TypeList exceptions,
String nickname) {
@@ -200,11 +200,11 @@
/**
* Constructs a non-nicknamed instance with non-empty exceptions, which
* is always a call-like op (see {@link #isCallLike}). Its
- * <code>branchingness</code> is always <code>BRANCH_THROW</code>.
+ * {@code branchingness} is always {@code BRANCH_THROW}.
*
* @param opcode the opcode; one of the constants in {@link RegOps}
- * @param sources non-null; types of all the sources of this operation
- * @param exceptions non-null; list of possible types thrown by this
+ * @param sources {@code non-null;} types of all the sources of this operation
+ * @param exceptions {@code non-null;} list of possible types thrown by this
* operation
*/
public Rop(int opcode, TypeList sources, TypeList exceptions) {
@@ -317,7 +317,7 @@
* Gets the result type. A return value of {@link Type#VOID}
* means this operation returns nothing.
*
- * @return null-ok; the result spec
+ * @return {@code null-ok;} the result spec
*/
public Type getResult() {
return result;
@@ -326,7 +326,7 @@
/**
* Gets the source types.
*
- * @return non-null; the source types
+ * @return {@code non-null;} the source types
*/
public TypeList getSources() {
return sources;
@@ -335,7 +335,7 @@
/**
* Gets the list of exception types that might be thrown.
*
- * @return non-null; the list of exception types
+ * @return {@code non-null;} the list of exception types
*/
public TypeList getExceptions() {
return exceptions;
@@ -353,7 +353,7 @@
/**
* Gets whether this opcode is a function/method call or similar.
*
- * @return <code>true</code> iff this opcode is call-like
+ * @return {@code true} iff this opcode is call-like
*/
public boolean isCallLike() {
return isCallLike;
@@ -384,7 +384,7 @@
* Gets the nickname. If this instance has no nickname, this returns
* the result of calling {@link #toString}.
*
- * @return non-null; the nickname
+ * @return {@code non-null;} the nickname
*/
public String getNickname() {
if (nickname != null) {
@@ -397,9 +397,9 @@
/**
* Gets whether this operation can possibly throw an exception. This
* is just a convenient wrapper for
- * <code>getExceptions().size() != 0</code>.
+ * {@code getExceptions().size() != 0}.
*
- * @return <code>true</code> iff this operation can possibly throw
+ * @return {@code true} iff this operation can possibly throw
*/
public final boolean canThrow() {
return (exceptions.size() != 0);
diff --git a/dx/src/com/android/dx/rop/code/RopMethod.java b/dx/src/com/android/dx/rop/code/RopMethod.java
index 0c0d8f1..3957532 100644
--- a/dx/src/com/android/dx/rop/code/RopMethod.java
+++ b/dx/src/com/android/dx/rop/code/RopMethod.java
@@ -24,20 +24,20 @@
* All of the parts that make up a method at the rop layer.
*/
public final class RopMethod {
- /** non-null; basic block list of the method */
+ /** {@code non-null;} basic block list of the method */
private final BasicBlockList blocks;
- /** >= 0; label for the block which starts the method */
+ /** {@code >= 0;} label for the block which starts the method */
private final int firstLabel;
/**
- * null-ok; array of predecessors for each block, indexed by block
+ * {@code null-ok;} array of predecessors for each block, indexed by block
* label
*/
private IntList[] predecessors;
/**
- * null-ok; the predecessors for the implicit "exit" block, that is
+ * {@code null-ok;} the predecessors for the implicit "exit" block, that is
* the labels for the blocks that return, if calculated
*/
private IntList exitPredecessors;
@@ -45,8 +45,8 @@
/**
* Constructs an instance.
*
- * @param blocks non-null; basic block list of the method
- * @param firstLabel >= 0; the label of the first block to execute
+ * @param blocks {@code non-null;} basic block list of the method
+ * @param firstLabel {@code >= 0;} the label of the first block to execute
*/
public RopMethod(BasicBlockList blocks, int firstLabel) {
if (blocks == null) {
@@ -67,7 +67,7 @@
/**
* Gets the basic block list for this method.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public BasicBlockList getBlocks() {
return blocks;
@@ -77,7 +77,7 @@
* Gets the label for the first block in the method that this list
* represents.
*
- * @return >= 0; the first-block label
+ * @return {@code >= 0;} the first-block label
*/
public int getFirstLabel() {
return firstLabel;
@@ -87,8 +87,8 @@
* Gets the predecessors associated with the given block. This throws
* an exception if there is no block with the given label.
*
- * @param label >= 0; the label of the block in question
- * @return non-null; the predecessors of that block
+ * @param label {@code >= 0;} the label of the block in question
+ * @return {@code non-null;} the predecessors of that block
*/
public IntList labelToPredecessors(int label) {
if (exitPredecessors == null) {
@@ -107,7 +107,7 @@
/**
* Gets the exit predecessors for this instance.
*
- * @return non-null; the exit predecessors
+ * @return {@code non-null;} the exit predecessors
*/
public IntList getExitPredecessors() {
if (exitPredecessors == null) {
@@ -124,7 +124,7 @@
* amount.
*
* @param delta the amount to offset register numbers by
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public RopMethod withRegisterOffset(int delta) {
RopMethod result = new RopMethod(blocks.withRegisterOffset(delta),
diff --git a/dx/src/com/android/dx/rop/code/Rops.java b/dx/src/com/android/dx/rop/code/Rops.java
index b662656..15c2e17 100644
--- a/dx/src/com/android/dx/rop/code/Rops.java
+++ b/dx/src/com/android/dx/rop/code/Rops.java
@@ -30,32 +30,32 @@
* Standard instances of {@link Rop}.
*/
public final class Rops {
- /** <code>nop()</code> */
+ /** {@code nop()} */
public static final Rop NOP =
new Rop(RegOps.NOP, Type.VOID, StdTypeList.EMPTY, "nop");
- /** <code>r,x: int :: r = x;</code> */
+ /** {@code r,x: int :: r = x;} */
public static final Rop MOVE_INT =
new Rop(RegOps.MOVE, Type.INT, StdTypeList.INT, "move-int");
- /** <code>r,x: long :: r = x;</code> */
+ /** {@code r,x: long :: r = x;} */
public static final Rop MOVE_LONG =
new Rop(RegOps.MOVE, Type.LONG, StdTypeList.LONG, "move-long");
- /** <code>r,x: float :: r = x;</code> */
+ /** {@code r,x: float :: r = x;} */
public static final Rop MOVE_FLOAT =
new Rop(RegOps.MOVE, Type.FLOAT, StdTypeList.FLOAT, "move-float");
- /** <code>r,x: double :: r = x;</code> */
+ /** {@code r,x: double :: r = x;} */
public static final Rop MOVE_DOUBLE =
new Rop(RegOps.MOVE, Type.DOUBLE, StdTypeList.DOUBLE, "move-double");
- /** <code>r,x: Object :: r = x;</code> */
+ /** {@code r,x: Object :: r = x;} */
public static final Rop MOVE_OBJECT =
new Rop(RegOps.MOVE, Type.OBJECT, StdTypeList.OBJECT, "move-object");
/**
- * <code>r,x: ReturnAddress :: r = x;</code>
+ * {@code r,x: ReturnAddress :: r = x;}
*
* Note that this rop-form instruction has no dex-form equivilent and
* must be removed before the dex conversion.
@@ -64,756 +64,756 @@
new Rop(RegOps.MOVE, Type.RETURN_ADDRESS,
StdTypeList.RETURN_ADDRESS, "move-return-address");
- /** <code>r,param(x): int :: r = param(x);</code> */
+ /** {@code r,param(x): int :: r = param(x);} */
public static final Rop MOVE_PARAM_INT =
new Rop(RegOps.MOVE_PARAM, Type.INT, StdTypeList.EMPTY,
"move-param-int");
- /** <code>r,param(x): long :: r = param(x);</code> */
+ /** {@code r,param(x): long :: r = param(x);} */
public static final Rop MOVE_PARAM_LONG =
new Rop(RegOps.MOVE_PARAM, Type.LONG, StdTypeList.EMPTY,
"move-param-long");
- /** <code>r,param(x): float :: r = param(x);</code> */
+ /** {@code r,param(x): float :: r = param(x);} */
public static final Rop MOVE_PARAM_FLOAT =
new Rop(RegOps.MOVE_PARAM, Type.FLOAT, StdTypeList.EMPTY,
"move-param-float");
- /** <code>r,param(x): double :: r = param(x);</code> */
+ /** {@code r,param(x): double :: r = param(x);} */
public static final Rop MOVE_PARAM_DOUBLE =
new Rop(RegOps.MOVE_PARAM, Type.DOUBLE, StdTypeList.EMPTY,
"move-param-double");
- /** <code>r,param(x): Object :: r = param(x);</code> */
+ /** {@code r,param(x): Object :: r = param(x);} */
public static final Rop MOVE_PARAM_OBJECT =
new Rop(RegOps.MOVE_PARAM, Type.OBJECT, StdTypeList.EMPTY,
"move-param-object");
- /** <code>r, literal: int :: r = literal;</code> */
+ /** {@code r, literal: int :: r = literal;} */
public static final Rop CONST_INT =
new Rop(RegOps.CONST, Type.INT, StdTypeList.EMPTY, "const-int");
- /** <code>r, literal: long :: r = literal;</code> */
+ /** {@code r, literal: long :: r = literal;} */
public static final Rop CONST_LONG =
new Rop(RegOps.CONST, Type.LONG, StdTypeList.EMPTY, "const-long");
- /** <code>r, literal: float :: r = literal;</code> */
+ /** {@code r, literal: float :: r = literal;} */
public static final Rop CONST_FLOAT =
new Rop(RegOps.CONST, Type.FLOAT, StdTypeList.EMPTY, "const-float");
- /** <code>r, literal: double :: r = literal;</code> */
+ /** {@code r, literal: double :: r = literal;} */
public static final Rop CONST_DOUBLE =
new Rop(RegOps.CONST, Type.DOUBLE, StdTypeList.EMPTY, "const-double");
- /** <code>r, literal: Object :: r = literal;</code> */
+ /** {@code r, literal: Object :: r = literal;} */
public static final Rop CONST_OBJECT =
new Rop(RegOps.CONST, Type.OBJECT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "const-object");
- /** <code>r, literal: Object :: r = literal;</code> */
+ /** {@code r, literal: Object :: r = literal;} */
public static final Rop CONST_OBJECT_NOTHROW =
new Rop(RegOps.CONST, Type.OBJECT, StdTypeList.EMPTY,
"const-object-nothrow");
- /** <code>goto <i>label</i></code> */
+ /** {@code goto label} */
public static final Rop GOTO =
new Rop(RegOps.GOTO, Type.VOID, StdTypeList.EMPTY, Rop.BRANCH_GOTO,
"goto");
- /** <code>x: int :: if (x == 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x == 0) goto label} */
public static final Rop IF_EQZ_INT =
new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-eqz-int");
- /** <code>x: int :: if (x != 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x != 0) goto label} */
public static final Rop IF_NEZ_INT =
new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-nez-int");
- /** <code>x: int :: if (x < 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x < 0) goto label} */
public static final Rop IF_LTZ_INT =
new Rop(RegOps.IF_LT, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-ltz-int");
- /** <code>x: int :: if (x >= 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x >= 0) goto label} */
public static final Rop IF_GEZ_INT =
new Rop(RegOps.IF_GE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-gez-int");
- /** <code>x: int :: if (x <= 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x <= 0) goto label} */
public static final Rop IF_LEZ_INT =
new Rop(RegOps.IF_LE, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-lez-int");
- /** <code>x: int :: if (x > 0) goto <i>label</i></code> */
+ /** {@code x: int :: if (x > 0) goto label} */
public static final Rop IF_GTZ_INT =
new Rop(RegOps.IF_GT, Type.VOID, StdTypeList.INT, Rop.BRANCH_IF,
"if-gtz-int");
- /** <code>x: Object :: if (x == null) goto <i>label</i></code> */
+ /** {@code x: Object :: if (x == null) goto label} */
public static final Rop IF_EQZ_OBJECT =
new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.OBJECT, Rop.BRANCH_IF,
"if-eqz-object");
- /** <code>x: Object :: if (x != null) goto <i>label</i></code> */
+ /** {@code x: Object :: if (x != null) goto label} */
public static final Rop IF_NEZ_OBJECT =
new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.OBJECT, Rop.BRANCH_IF,
"if-nez-object");
- /** <code>x,y: int :: if (x == y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x == y) goto label} */
public static final Rop IF_EQ_INT =
new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-eq-int");
- /** <code>x,y: int :: if (x != y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x != y) goto label} */
public static final Rop IF_NE_INT =
new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-ne-int");
- /** <code>x,y: int :: if (x < y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x < y) goto label} */
public static final Rop IF_LT_INT =
new Rop(RegOps.IF_LT, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-lt-int");
- /** <code>x,y: int :: if (x >= y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x >= y) goto label} */
public static final Rop IF_GE_INT =
new Rop(RegOps.IF_GE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-ge-int");
- /** <code>x,y: int :: if (x <= y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x <= y) goto label} */
public static final Rop IF_LE_INT =
new Rop(RegOps.IF_LE, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-le-int");
- /** <code>x,y: int :: if (x > y) goto <i>label</i></code> */
+ /** {@code x,y: int :: if (x > y) goto label} */
public static final Rop IF_GT_INT =
new Rop(RegOps.IF_GT, Type.VOID, StdTypeList.INT_INT, Rop.BRANCH_IF,
"if-gt-int");
- /** <code>x,y: Object :: if (x == y) goto <i>label</i></code> */
+ /** {@code x,y: Object :: if (x == y) goto label} */
public static final Rop IF_EQ_OBJECT =
new Rop(RegOps.IF_EQ, Type.VOID, StdTypeList.OBJECT_OBJECT,
Rop.BRANCH_IF, "if-eq-object");
- /** <code>x,y: Object :: if (x != y) goto <i>label</i></code> */
+ /** {@code x,y: Object :: if (x != y) goto label} */
public static final Rop IF_NE_OBJECT =
new Rop(RegOps.IF_NE, Type.VOID, StdTypeList.OBJECT_OBJECT,
Rop.BRANCH_IF, "if-ne-object");
- /** <code>x: int :: goto switchtable[x]</code> */
+ /** {@code x: int :: goto switchtable[x]} */
public static final Rop SWITCH =
new Rop(RegOps.SWITCH, Type.VOID, StdTypeList.INT, Rop.BRANCH_SWITCH,
"switch");
- /** <code>r,x,y: int :: r = x + y;</code> */
+ /** {@code r,x,y: int :: r = x + y;} */
public static final Rop ADD_INT =
new Rop(RegOps.ADD, Type.INT, StdTypeList.INT_INT, "add-int");
- /** <code>r,x,y: long :: r = x + y;</code> */
+ /** {@code r,x,y: long :: r = x + y;} */
public static final Rop ADD_LONG =
new Rop(RegOps.ADD, Type.LONG, StdTypeList.LONG_LONG, "add-long");
- /** <code>r,x,y: float :: r = x + y;</code> */
+ /** {@code r,x,y: float :: r = x + y;} */
public static final Rop ADD_FLOAT =
new Rop(RegOps.ADD, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "add-float");
- /** <code>r,x,y: double :: r = x + y;</code> */
+ /** {@code r,x,y: double :: r = x + y;} */
public static final Rop ADD_DOUBLE =
new Rop(RegOps.ADD, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE,
Rop.BRANCH_NONE, "add-double");
- /** <code>r,x,y: int :: r = x - y;</code> */
+ /** {@code r,x,y: int :: r = x - y;} */
public static final Rop SUB_INT =
new Rop(RegOps.SUB, Type.INT, StdTypeList.INT_INT, "sub-int");
- /** <code>r,x,y: long :: r = x - y;</code> */
+ /** {@code r,x,y: long :: r = x - y;} */
public static final Rop SUB_LONG =
new Rop(RegOps.SUB, Type.LONG, StdTypeList.LONG_LONG, "sub-long");
- /** <code>r,x,y: float :: r = x - y;</code> */
+ /** {@code r,x,y: float :: r = x - y;} */
public static final Rop SUB_FLOAT =
new Rop(RegOps.SUB, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "sub-float");
- /** <code>r,x,y: double :: r = x - y;</code> */
+ /** {@code r,x,y: double :: r = x - y;} */
public static final Rop SUB_DOUBLE =
new Rop(RegOps.SUB, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE,
Rop.BRANCH_NONE, "sub-double");
- /** <code>r,x,y: int :: r = x * y;</code> */
+ /** {@code r,x,y: int :: r = x * y;} */
public static final Rop MUL_INT =
new Rop(RegOps.MUL, Type.INT, StdTypeList.INT_INT, "mul-int");
- /** <code>r,x,y: long :: r = x * y;</code> */
+ /** {@code r,x,y: long :: r = x * y;} */
public static final Rop MUL_LONG =
new Rop(RegOps.MUL, Type.LONG, StdTypeList.LONG_LONG, "mul-long");
- /** <code>r,x,y: float :: r = x * y;</code> */
+ /** {@code r,x,y: float :: r = x * y;} */
public static final Rop MUL_FLOAT =
new Rop(RegOps.MUL, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "mul-float");
- /** <code>r,x,y: double :: r = x * y;</code> */
+ /** {@code r,x,y: double :: r = x * y;} */
public static final Rop MUL_DOUBLE =
new Rop(RegOps.MUL, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE,
Rop.BRANCH_NONE, "mul-double");
- /** <code>r,x,y: int :: r = x / y;</code> */
+ /** {@code r,x,y: int :: r = x / y;} */
public static final Rop DIV_INT =
new Rop(RegOps.DIV, Type.INT, StdTypeList.INT_INT,
Exceptions.LIST_Error_ArithmeticException, "div-int");
- /** <code>r,x,y: long :: r = x / y;</code> */
+ /** {@code r,x,y: long :: r = x / y;} */
public static final Rop DIV_LONG =
new Rop(RegOps.DIV, Type.LONG, StdTypeList.LONG_LONG,
Exceptions.LIST_Error_ArithmeticException, "div-long");
- /** <code>r,x,y: float :: r = x / y;</code> */
+ /** {@code r,x,y: float :: r = x / y;} */
public static final Rop DIV_FLOAT =
new Rop(RegOps.DIV, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "div-float");
- /** <code>r,x,y: double :: r = x / y;</code> */
+ /** {@code r,x,y: double :: r = x / y;} */
public static final Rop DIV_DOUBLE =
new Rop(RegOps.DIV, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE,
"div-double");
- /** <code>r,x,y: int :: r = x % y;</code> */
+ /** {@code r,x,y: int :: r = x % y;} */
public static final Rop REM_INT =
new Rop(RegOps.REM, Type.INT, StdTypeList.INT_INT,
Exceptions.LIST_Error_ArithmeticException, "rem-int");
- /** <code>r,x,y: long :: r = x % y;</code> */
+ /** {@code r,x,y: long :: r = x % y;} */
public static final Rop REM_LONG =
new Rop(RegOps.REM, Type.LONG, StdTypeList.LONG_LONG,
Exceptions.LIST_Error_ArithmeticException, "rem-long");
- /** <code>r,x,y: float :: r = x % y;</code> */
+ /** {@code r,x,y: float :: r = x % y;} */
public static final Rop REM_FLOAT =
new Rop(RegOps.REM, Type.FLOAT, StdTypeList.FLOAT_FLOAT, "rem-float");
- /** <code>r,x,y: double :: r = x % y;</code> */
+ /** {@code r,x,y: double :: r = x % y;} */
public static final Rop REM_DOUBLE =
new Rop(RegOps.REM, Type.DOUBLE, StdTypeList.DOUBLE_DOUBLE,
"rem-double");
- /** <code>r,x: int :: r = -x;</code> */
+ /** {@code r,x: int :: r = -x;} */
public static final Rop NEG_INT =
new Rop(RegOps.NEG, Type.INT, StdTypeList.INT, "neg-int");
- /** <code>r,x: long :: r = -x;</code> */
+ /** {@code r,x: long :: r = -x;} */
public static final Rop NEG_LONG =
new Rop(RegOps.NEG, Type.LONG, StdTypeList.LONG, "neg-long");
- /** <code>r,x: float :: r = -x;</code> */
+ /** {@code r,x: float :: r = -x;} */
public static final Rop NEG_FLOAT =
new Rop(RegOps.NEG, Type.FLOAT, StdTypeList.FLOAT, "neg-float");
- /** <code>r,x: double :: r = -x;</code> */
+ /** {@code r,x: double :: r = -x;} */
public static final Rop NEG_DOUBLE =
new Rop(RegOps.NEG, Type.DOUBLE, StdTypeList.DOUBLE, "neg-double");
- /** <code>r,x,y: int :: r = x & y;</code> */
+ /** {@code r,x,y: int :: r = x & y;} */
public static final Rop AND_INT =
new Rop(RegOps.AND, Type.INT, StdTypeList.INT_INT, "and-int");
- /** <code>r,x,y: long :: r = x & y;</code> */
+ /** {@code r,x,y: long :: r = x & y;} */
public static final Rop AND_LONG =
new Rop(RegOps.AND, Type.LONG, StdTypeList.LONG_LONG, "and-long");
- /** <code>r,x,y: int :: r = x | y;</code> */
+ /** {@code r,x,y: int :: r = x | y;} */
public static final Rop OR_INT =
new Rop(RegOps.OR, Type.INT, StdTypeList.INT_INT, "or-int");
- /** <code>r,x,y: long :: r = x | y;</code> */
+ /** {@code r,x,y: long :: r = x | y;} */
public static final Rop OR_LONG =
new Rop(RegOps.OR, Type.LONG, StdTypeList.LONG_LONG, "or-long");
- /** <code>r,x,y: int :: r = x ^ y;</code> */
+ /** {@code r,x,y: int :: r = x ^ y;} */
public static final Rop XOR_INT =
new Rop(RegOps.XOR, Type.INT, StdTypeList.INT_INT, "xor-int");
- /** <code>r,x,y: long :: r = x ^ y;</code> */
+ /** {@code r,x,y: long :: r = x ^ y;} */
public static final Rop XOR_LONG =
new Rop(RegOps.XOR, Type.LONG, StdTypeList.LONG_LONG, "xor-long");
- /** <code>r,x,y: int :: r = x << y;</code> */
+ /** {@code r,x,y: int :: r = x << y;} */
public static final Rop SHL_INT =
new Rop(RegOps.SHL, Type.INT, StdTypeList.INT_INT, "shl-int");
- /** <code>r,x: long; y: int :: r = x << y;</code> */
+ /** {@code r,x: long; y: int :: r = x << y;} */
public static final Rop SHL_LONG =
new Rop(RegOps.SHL, Type.LONG, StdTypeList.LONG_INT, "shl-long");
- /** <code>r,x,y: int :: r = x >> y;</code> */
+ /** {@code r,x,y: int :: r = x >> y;} */
public static final Rop SHR_INT =
new Rop(RegOps.SHR, Type.INT, StdTypeList.INT_INT, "shr-int");
- /** <code>r,x: long; y: int :: r = x >> y;</code> */
+ /** {@code r,x: long; y: int :: r = x >> y;} */
public static final Rop SHR_LONG =
new Rop(RegOps.SHR, Type.LONG, StdTypeList.LONG_INT, "shr-long");
- /** <code>r,x,y: int :: r = x >>> y;</code> */
+ /** {@code r,x,y: int :: r = x >>> y;} */
public static final Rop USHR_INT =
new Rop(RegOps.USHR, Type.INT, StdTypeList.INT_INT, "ushr-int");
- /** <code>r,x: long; y: int :: r = x >>> y;</code> */
+ /** {@code r,x: long; y: int :: r = x >>> y;} */
public static final Rop USHR_LONG =
new Rop(RegOps.USHR, Type.LONG, StdTypeList.LONG_INT, "ushr-long");
- /** <code>r,x: int :: r = ~x;</code> */
+ /** {@code r,x: int :: r = ~x;} */
public static final Rop NOT_INT =
new Rop(RegOps.NOT, Type.INT, StdTypeList.INT, "not-int");
- /** <code>r,x: long :: r = ~x;</code> */
+ /** {@code r,x: long :: r = ~x;} */
public static final Rop NOT_LONG =
new Rop(RegOps.NOT, Type.LONG, StdTypeList.LONG, "not-long");
- /** <code>r,x,c: int :: r = x + c;</code> */
+ /** {@code r,x,c: int :: r = x + c;} */
public static final Rop ADD_CONST_INT =
new Rop(RegOps.ADD, Type.INT, StdTypeList.INT, "add-const-int");
- /** <code>r,x,c: long :: r = x + c;</code> */
+ /** {@code r,x,c: long :: r = x + c;} */
public static final Rop ADD_CONST_LONG =
new Rop(RegOps.ADD, Type.LONG, StdTypeList.LONG, "add-const-long");
- /** <code>r,x,c: float :: r = x + c;</code> */
+ /** {@code r,x,c: float :: r = x + c;} */
public static final Rop ADD_CONST_FLOAT =
new Rop(RegOps.ADD, Type.FLOAT, StdTypeList.FLOAT, "add-const-float");
- /** <code>r,x,c: double :: r = x + c;</code> */
+ /** {@code r,x,c: double :: r = x + c;} */
public static final Rop ADD_CONST_DOUBLE =
new Rop(RegOps.ADD, Type.DOUBLE, StdTypeList.DOUBLE,
"add-const-double");
- /** <code>r,x,c: int :: r = x - c;</code> */
+ /** {@code r,x,c: int :: r = x - c;} */
public static final Rop SUB_CONST_INT =
new Rop(RegOps.SUB, Type.INT, StdTypeList.INT, "sub-const-int");
- /** <code>r,x,c: long :: r = x - c;</code> */
+ /** {@code r,x,c: long :: r = x - c;} */
public static final Rop SUB_CONST_LONG =
new Rop(RegOps.SUB, Type.LONG, StdTypeList.LONG, "sub-const-long");
- /** <code>r,x,c: float :: r = x - c;</code> */
+ /** {@code r,x,c: float :: r = x - c;} */
public static final Rop SUB_CONST_FLOAT =
new Rop(RegOps.SUB, Type.FLOAT, StdTypeList.FLOAT, "sub-const-float");
- /** <code>r,x,c: double :: r = x - c;</code> */
+ /** {@code r,x,c: double :: r = x - c;} */
public static final Rop SUB_CONST_DOUBLE =
new Rop(RegOps.SUB, Type.DOUBLE, StdTypeList.DOUBLE,
"sub-const-double");
- /** <code>r,x,c: int :: r = x * c;</code> */
+ /** {@code r,x,c: int :: r = x * c;} */
public static final Rop MUL_CONST_INT =
new Rop(RegOps.MUL, Type.INT, StdTypeList.INT, "mul-const-int");
- /** <code>r,x,c: long :: r = x * c;</code> */
+ /** {@code r,x,c: long :: r = x * c;} */
public static final Rop MUL_CONST_LONG =
new Rop(RegOps.MUL, Type.LONG, StdTypeList.LONG, "mul-const-long");
- /** <code>r,x,c: float :: r = x * c;</code> */
+ /** {@code r,x,c: float :: r = x * c;} */
public static final Rop MUL_CONST_FLOAT =
new Rop(RegOps.MUL, Type.FLOAT, StdTypeList.FLOAT, "mul-const-float");
- /** <code>r,x,c: double :: r = x * c;</code> */
+ /** {@code r,x,c: double :: r = x * c;} */
public static final Rop MUL_CONST_DOUBLE =
new Rop(RegOps.MUL, Type.DOUBLE, StdTypeList.DOUBLE,
"mul-const-double");
- /** <code>r,x,c: int :: r = x / c;</code> */
+ /** {@code r,x,c: int :: r = x / c;} */
public static final Rop DIV_CONST_INT =
new Rop(RegOps.DIV, Type.INT, StdTypeList.INT,
Exceptions.LIST_Error_ArithmeticException, "div-const-int");
- /** <code>r,x,c: long :: r = x / c;</code> */
+ /** {@code r,x,c: long :: r = x / c;} */
public static final Rop DIV_CONST_LONG =
new Rop(RegOps.DIV, Type.LONG, StdTypeList.LONG,
Exceptions.LIST_Error_ArithmeticException, "div-const-long");
- /** <code>r,x,c: float :: r = x / c;</code> */
+ /** {@code r,x,c: float :: r = x / c;} */
public static final Rop DIV_CONST_FLOAT =
new Rop(RegOps.DIV, Type.FLOAT, StdTypeList.FLOAT, "div-const-float");
- /** <code>r,x,c: double :: r = x / c;</code> */
+ /** {@code r,x,c: double :: r = x / c;} */
public static final Rop DIV_CONST_DOUBLE =
new Rop(RegOps.DIV, Type.DOUBLE, StdTypeList.DOUBLE,
"div-const-double");
- /** <code>r,x,c: int :: r = x % c;</code> */
+ /** {@code r,x,c: int :: r = x % c;} */
public static final Rop REM_CONST_INT =
new Rop(RegOps.REM, Type.INT, StdTypeList.INT,
Exceptions.LIST_Error_ArithmeticException, "rem-const-int");
- /** <code>r,x,c: long :: r = x % c;</code> */
+ /** {@code r,x,c: long :: r = x % c;} */
public static final Rop REM_CONST_LONG =
new Rop(RegOps.REM, Type.LONG, StdTypeList.LONG,
Exceptions.LIST_Error_ArithmeticException, "rem-const-long");
- /** <code>r,x,c: float :: r = x % c;</code> */
+ /** {@code r,x,c: float :: r = x % c;} */
public static final Rop REM_CONST_FLOAT =
new Rop(RegOps.REM, Type.FLOAT, StdTypeList.FLOAT, "rem-const-float");
- /** <code>r,x,c: double :: r = x % c;</code> */
+ /** {@code r,x,c: double :: r = x % c;} */
public static final Rop REM_CONST_DOUBLE =
new Rop(RegOps.REM, Type.DOUBLE, StdTypeList.DOUBLE,
"rem-const-double");
- /** <code>r,x,c: int :: r = x & c;</code> */
+ /** {@code r,x,c: int :: r = x & c;} */
public static final Rop AND_CONST_INT =
new Rop(RegOps.AND, Type.INT, StdTypeList.INT, "and-const-int");
- /** <code>r,x,c: long :: r = x & c;</code> */
+ /** {@code r,x,c: long :: r = x & c;} */
public static final Rop AND_CONST_LONG =
new Rop(RegOps.AND, Type.LONG, StdTypeList.LONG, "and-const-long");
- /** <code>r,x,c: int :: r = x | c;</code> */
+ /** {@code r,x,c: int :: r = x | c;} */
public static final Rop OR_CONST_INT =
new Rop(RegOps.OR, Type.INT, StdTypeList.INT, "or-const-int");
- /** <code>r,x,c: long :: r = x | c;</code> */
+ /** {@code r,x,c: long :: r = x | c;} */
public static final Rop OR_CONST_LONG =
new Rop(RegOps.OR, Type.LONG, StdTypeList.LONG, "or-const-long");
- /** <code>r,x,c: int :: r = x ^ c;</code> */
+ /** {@code r,x,c: int :: r = x ^ c;} */
public static final Rop XOR_CONST_INT =
new Rop(RegOps.XOR, Type.INT, StdTypeList.INT, "xor-const-int");
- /** <code>r,x,c: long :: r = x ^ c;</code> */
+ /** {@code r,x,c: long :: r = x ^ c;} */
public static final Rop XOR_CONST_LONG =
new Rop(RegOps.XOR, Type.LONG, StdTypeList.LONG, "xor-const-long");
- /** <code>r,x,c: int :: r = x << c;</code> */
+ /** {@code r,x,c: int :: r = x << c;} */
public static final Rop SHL_CONST_INT =
new Rop(RegOps.SHL, Type.INT, StdTypeList.INT, "shl-const-int");
- /** <code>r,x: long; c: int :: r = x << c;</code> */
+ /** {@code r,x: long; c: int :: r = x << c;} */
public static final Rop SHL_CONST_LONG =
new Rop(RegOps.SHL, Type.LONG, StdTypeList.INT, "shl-const-long");
- /** <code>r,x,c: int :: r = x >> c;</code> */
+ /** {@code r,x,c: int :: r = x >> c;} */
public static final Rop SHR_CONST_INT =
new Rop(RegOps.SHR, Type.INT, StdTypeList.INT, "shr-const-int");
- /** <code>r,x: long; c: int :: r = x >> c;</code> */
+ /** {@code r,x: long; c: int :: r = x >> c;} */
public static final Rop SHR_CONST_LONG =
new Rop(RegOps.SHR, Type.LONG, StdTypeList.INT, "shr-const-long");
- /** <code>r,x,c: int :: r = x >>> c;</code> */
+ /** {@code r,x,c: int :: r = x >>> c;} */
public static final Rop USHR_CONST_INT =
new Rop(RegOps.USHR, Type.INT, StdTypeList.INT, "ushr-const-int");
- /** <code>r,x: long; c: int :: r = x >>> c;</code> */
+ /** {@code r,x: long; c: int :: r = x >>> c;} */
public static final Rop USHR_CONST_LONG =
new Rop(RegOps.USHR, Type.LONG, StdTypeList.INT, "ushr-const-long");
- /** <code>r: int; x,y: long :: r = cmp(x, y);</code> */
+ /** {@code r: int; x,y: long :: r = cmp(x, y);} */
public static final Rop CMPL_LONG =
new Rop(RegOps.CMPL, Type.INT, StdTypeList.LONG_LONG, "cmpl-long");
- /** <code>r: int; x,y: float :: r = cmpl(x, y);</code> */
+ /** {@code r: int; x,y: float :: r = cmpl(x, y);} */
public static final Rop CMPL_FLOAT =
new Rop(RegOps.CMPL, Type.INT, StdTypeList.FLOAT_FLOAT, "cmpl-float");
- /** <code>r: int; x,y: double :: r = cmpl(x, y);</code> */
+ /** {@code r: int; x,y: double :: r = cmpl(x, y);} */
public static final Rop CMPL_DOUBLE =
new Rop(RegOps.CMPL, Type.INT, StdTypeList.DOUBLE_DOUBLE,
"cmpl-double");
- /** <code>r: int; x,y: float :: r = cmpg(x, y);</code> */
+ /** {@code r: int; x,y: float :: r = cmpg(x, y);} */
public static final Rop CMPG_FLOAT =
new Rop(RegOps.CMPG, Type.INT, StdTypeList.FLOAT_FLOAT, "cmpg-float");
- /** <code>r: int; x,y: double :: r = cmpg(x, y);</code> */
+ /** {@code r: int; x,y: double :: r = cmpg(x, y);} */
public static final Rop CMPG_DOUBLE =
new Rop(RegOps.CMPG, Type.INT, StdTypeList.DOUBLE_DOUBLE,
"cmpg-double");
- /** <code>r: int; x: long :: r = (int) x</code> */
+ /** {@code r: int; x: long :: r = (int) x} */
public static final Rop CONV_L2I =
new Rop(RegOps.CONV, Type.INT, StdTypeList.LONG, "conv-l2i");
- /** <code>r: int; x: float :: r = (int) x</code> */
+ /** {@code r: int; x: float :: r = (int) x} */
public static final Rop CONV_F2I =
new Rop(RegOps.CONV, Type.INT, StdTypeList.FLOAT, "conv-f2i");
- /** <code>r: int; x: double :: r = (int) x</code> */
+ /** {@code r: int; x: double :: r = (int) x} */
public static final Rop CONV_D2I =
new Rop(RegOps.CONV, Type.INT, StdTypeList.DOUBLE, "conv-d2i");
- /** <code>r: long; x: int :: r = (long) x</code> */
+ /** {@code r: long; x: int :: r = (long) x} */
public static final Rop CONV_I2L =
new Rop(RegOps.CONV, Type.LONG, StdTypeList.INT, "conv-i2l");
- /** <code>r: long; x: float :: r = (long) x</code> */
+ /** {@code r: long; x: float :: r = (long) x} */
public static final Rop CONV_F2L =
new Rop(RegOps.CONV, Type.LONG, StdTypeList.FLOAT, "conv-f2l");
- /** <code>r: long; x: double :: r = (long) x</code> */
+ /** {@code r: long; x: double :: r = (long) x} */
public static final Rop CONV_D2L =
new Rop(RegOps.CONV, Type.LONG, StdTypeList.DOUBLE, "conv-d2l");
- /** <code>r: float; x: int :: r = (float) x</code> */
+ /** {@code r: float; x: int :: r = (float) x} */
public static final Rop CONV_I2F =
new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.INT, "conv-i2f");
- /** <code>r: float; x: long :: r = (float) x</code> */
+ /** {@code r: float; x: long :: r = (float) x} */
public static final Rop CONV_L2F =
new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.LONG, "conv-l2f");
- /** <code>r: float; x: double :: r = (float) x</code> */
+ /** {@code r: float; x: double :: r = (float) x} */
public static final Rop CONV_D2F =
new Rop(RegOps.CONV, Type.FLOAT, StdTypeList.DOUBLE, "conv-d2f");
- /** <code>r: double; x: int :: r = (double) x</code> */
+ /** {@code r: double; x: int :: r = (double) x} */
public static final Rop CONV_I2D =
new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.INT, "conv-i2d");
- /** <code>r: double; x: long :: r = (double) x</code> */
+ /** {@code r: double; x: long :: r = (double) x} */
public static final Rop CONV_L2D =
new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.LONG, "conv-l2d");
- /** <code>r: double; x: float :: r = (double) x</code> */
+ /** {@code r: double; x: float :: r = (double) x} */
public static final Rop CONV_F2D =
new Rop(RegOps.CONV, Type.DOUBLE, StdTypeList.FLOAT, "conv-f2d");
/**
- * <code>r,x: int :: r = (x << 24) >> 24</code> (Java-style
+ * {@code r,x: int :: r = (x << 24) >> 24} (Java-style
* convert int to byte)
*/
public static final Rop TO_BYTE =
new Rop(RegOps.TO_BYTE, Type.INT, StdTypeList.INT, "to-byte");
/**
- * <code>r,x: int :: r = x & 0xffff</code> (Java-style
+ * {@code r,x: int :: r = x & 0xffff} (Java-style
* convert int to char)
*/
public static final Rop TO_CHAR =
new Rop(RegOps.TO_CHAR, Type.INT, StdTypeList.INT, "to-char");
/**
- * <code>r,x: int :: r = (x << 16) >> 16</code> (Java-style
+ * {@code r,x: int :: r = (x << 16) >> 16} (Java-style
* convert int to short)
*/
public static final Rop TO_SHORT =
new Rop(RegOps.TO_SHORT, Type.INT, StdTypeList.INT, "to-short");
- /** <code>return void</code> */
+ /** {@code return void} */
public static final Rop RETURN_VOID =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.EMPTY, Rop.BRANCH_RETURN,
"return-void");
- /** <code>x: int; return x</code> */
+ /** {@code x: int; return x} */
public static final Rop RETURN_INT =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.INT, Rop.BRANCH_RETURN,
"return-int");
- /** <code>x: long; return x</code> */
+ /** {@code x: long; return x} */
public static final Rop RETURN_LONG =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.LONG, Rop.BRANCH_RETURN,
"return-long");
- /** <code>x: float; return x</code> */
+ /** {@code x: float; return x} */
public static final Rop RETURN_FLOAT =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.FLOAT, Rop.BRANCH_RETURN,
"return-float");
- /** <code>x: double; return x</code> */
+ /** {@code x: double; return x} */
public static final Rop RETURN_DOUBLE =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.DOUBLE,
Rop.BRANCH_RETURN, "return-double");
- /** <code>x: Object; return x</code> */
+ /** {@code x: Object; return x} */
public static final Rop RETURN_OBJECT =
new Rop(RegOps.RETURN, Type.VOID, StdTypeList.OBJECT,
Rop.BRANCH_RETURN, "return-object");
- /** <code>T: any type; r: int; x: T[]; :: r = x.length</code> */
+ /** {@code T: any type; r: int; x: T[]; :: r = x.length} */
public static final Rop ARRAY_LENGTH =
new Rop(RegOps.ARRAY_LENGTH, Type.INT, StdTypeList.OBJECT,
Exceptions.LIST_Error_NullPointerException, "array-length");
- /** <code>x: Throwable :: throw(x)</code> */
+ /** {@code x: Throwable :: throw(x)} */
public static final Rop THROW =
new Rop(RegOps.THROW, Type.VOID, StdTypeList.THROWABLE,
StdTypeList.THROWABLE, "throw");
- /** <code>x: Object :: monitorenter(x)</code> */
+ /** {@code x: Object :: monitorenter(x)} */
public static final Rop MONITOR_ENTER =
new Rop(RegOps.MONITOR_ENTER, Type.VOID, StdTypeList.OBJECT,
Exceptions.LIST_Error_NullPointerException, "monitor-enter");
- /** <code>x: Object :: monitorexit(x)</code> */
+ /** {@code x: Object :: monitorexit(x)} */
public static final Rop MONITOR_EXIT =
new Rop(RegOps.MONITOR_EXIT, Type.VOID, StdTypeList.OBJECT,
Exceptions.LIST_Error_Null_IllegalMonitorStateException,
"monitor-exit");
- /** <code>r,y: int; x: int[] :: r = x[y]</code> */
+ /** {@code r,y: int; x: int[] :: r = x[y]} */
public static final Rop AGET_INT =
new Rop(RegOps.AGET, Type.INT, StdTypeList.INTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-int");
- /** <code>r: long; x: long[]; y: int :: r = x[y]</code> */
+ /** {@code r: long; x: long[]; y: int :: r = x[y]} */
public static final Rop AGET_LONG =
new Rop(RegOps.AGET, Type.LONG, StdTypeList.LONGARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-long");
- /** <code>r: float; x: float[]; y: int :: r = x[y]</code> */
+ /** {@code r: float; x: float[]; y: int :: r = x[y]} */
public static final Rop AGET_FLOAT =
new Rop(RegOps.AGET, Type.FLOAT, StdTypeList.FLOATARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-float");
- /** <code>r: double; x: double[]; y: int :: r = x[y]</code> */
+ /** {@code r: double; x: double[]; y: int :: r = x[y]} */
public static final Rop AGET_DOUBLE =
new Rop(RegOps.AGET, Type.DOUBLE, StdTypeList.DOUBLEARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-double");
- /** <code>r: Object; x: Object[]; y: int :: r = x[y]</code> */
+ /** {@code r: Object; x: Object[]; y: int :: r = x[y]} */
public static final Rop AGET_OBJECT =
new Rop(RegOps.AGET, Type.OBJECT, StdTypeList.OBJECTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-object");
- /** <code>r: boolean; x: boolean[]; y: int :: r = x[y]</code> */
+ /** {@code r: boolean; x: boolean[]; y: int :: r = x[y]} */
public static final Rop AGET_BOOLEAN =
new Rop(RegOps.AGET, Type.INT, StdTypeList.BOOLEANARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-boolean");
- /** <code>r: byte; x: byte[]; y: int :: r = x[y]</code> */
+ /** {@code r: byte; x: byte[]; y: int :: r = x[y]} */
public static final Rop AGET_BYTE =
new Rop(RegOps.AGET, Type.INT, StdTypeList.BYTEARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-byte");
- /** <code>r: char; x: char[]; y: int :: r = x[y]</code> */
+ /** {@code r: char; x: char[]; y: int :: r = x[y]} */
public static final Rop AGET_CHAR =
new Rop(RegOps.AGET, Type.INT, StdTypeList.CHARARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aget-char");
- /** <code>r: short; x: short[]; y: int :: r = x[y]</code> */
+ /** {@code r: short; x: short[]; y: int :: r = x[y]} */
public static final Rop AGET_SHORT =
new Rop(RegOps.AGET, Type.INT, StdTypeList.SHORTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aget-short");
- /** <code>x,z: int; y: int[] :: y[z] = x</code> */
+ /** {@code x,z: int; y: int[] :: y[z] = x} */
public static final Rop APUT_INT =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_INTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-int");
- /** <code>x: long; y: long[]; z: int :: y[z] = x</code> */
+ /** {@code x: long; y: long[]; z: int :: y[z] = x} */
public static final Rop APUT_LONG =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.LONG_LONGARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds, "aput-long");
- /** <code>x: float; y: float[]; z: int :: y[z] = x</code> */
+ /** {@code x: float; y: float[]; z: int :: y[z] = x} */
public static final Rop APUT_FLOAT =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.FLOAT_FLOATARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aput-float");
- /** <code>x: double; y: double[]; z: int :: y[z] = x</code> */
+ /** {@code x: double; y: double[]; z: int :: y[z] = x} */
public static final Rop APUT_DOUBLE =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.DOUBLE_DOUBLEARR_INT,
Exceptions.LIST_Error_Null_ArrayIndexOutOfBounds,
"aput-double");
- /** <code>x: Object; y: Object[]; z: int :: y[z] = x</code> */
+ /** {@code x: Object; y: Object[]; z: int :: y[z] = x} */
public static final Rop APUT_OBJECT =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.OBJECT_OBJECTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore,
"aput-object");
- /** <code>x: boolean; y: boolean[]; z: int :: y[z] = x</code> */
+ /** {@code x: boolean; y: boolean[]; z: int :: y[z] = x} */
public static final Rop APUT_BOOLEAN =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_BOOLEANARR_INT,
Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore,
"aput-boolean");
- /** <code>x: byte; y: byte[]; z: int :: y[z] = x</code> */
+ /** {@code x: byte; y: byte[]; z: int :: y[z] = x} */
public static final Rop APUT_BYTE =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_BYTEARR_INT,
Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-byte");
- /** <code>x: char; y: char[]; z: int :: y[z] = x</code> */
+ /** {@code x: char; y: char[]; z: int :: y[z] = x} */
public static final Rop APUT_CHAR =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_CHARARR_INT,
Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore, "aput-char");
- /** <code>x: short; y: short[]; z: int :: y[z] = x</code> */
+ /** {@code x: short; y: short[]; z: int :: y[z] = x} */
public static final Rop APUT_SHORT =
new Rop(RegOps.APUT, Type.VOID, StdTypeList.INT_SHORTARR_INT,
Exceptions.LIST_Error_Null_ArrayIndex_ArrayStore,
"aput-short");
/**
- * <code>T: any non-array object type :: r =
- * alloc(T)</code> (allocate heap space for an object)
+ * {@code T: any non-array object type :: r =
+ * alloc(T)} (allocate heap space for an object)
*/
public static final Rop NEW_INSTANCE =
new Rop(RegOps.NEW_INSTANCE, Type.OBJECT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "new-instance");
- /** <code>r: int[]; x: int :: r = new int[x]</code> */
+ /** {@code r: int[]; x: int :: r = new int[x]} */
public static final Rop NEW_ARRAY_INT =
new Rop(RegOps.NEW_ARRAY, Type.INT_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-int");
- /** <code>r: long[]; x: int :: r = new long[x]</code> */
+ /** {@code r: long[]; x: int :: r = new long[x]} */
public static final Rop NEW_ARRAY_LONG =
new Rop(RegOps.NEW_ARRAY, Type.LONG_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-long");
- /** <code>r: float[]; x: int :: r = new float[x]</code> */
+ /** {@code r: float[]; x: int :: r = new float[x]} */
public static final Rop NEW_ARRAY_FLOAT =
new Rop(RegOps.NEW_ARRAY, Type.FLOAT_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-float");
- /** <code>r: double[]; x: int :: r = new double[x]</code> */
+ /** {@code r: double[]; x: int :: r = new double[x]} */
public static final Rop NEW_ARRAY_DOUBLE =
new Rop(RegOps.NEW_ARRAY, Type.DOUBLE_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-double");
- /** <code>r: boolean[]; x: int :: r = new boolean[x]</code> */
+ /** {@code r: boolean[]; x: int :: r = new boolean[x]} */
public static final Rop NEW_ARRAY_BOOLEAN =
new Rop(RegOps.NEW_ARRAY, Type.BOOLEAN_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-boolean");
- /** <code>r: byte[]; x: int :: r = new byte[x]</code> */
+ /** {@code r: byte[]; x: int :: r = new byte[x]} */
public static final Rop NEW_ARRAY_BYTE =
new Rop(RegOps.NEW_ARRAY, Type.BYTE_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-byte");
- /** <code>r: char[]; x: int :: r = new char[x]</code> */
+ /** {@code r: char[]; x: int :: r = new char[x]} */
public static final Rop NEW_ARRAY_CHAR =
new Rop(RegOps.NEW_ARRAY, Type.CHAR_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-char");
- /** <code>r: short[]; x: int :: r = new short[x]</code> */
+ /** {@code r: short[]; x: int :: r = new short[x]} */
public static final Rop NEW_ARRAY_SHORT =
new Rop(RegOps.NEW_ARRAY, Type.SHORT_ARRAY, StdTypeList.INT,
Exceptions.LIST_Error_NegativeArraySizeException,
"new-array-short");
/**
- * <code>T: any non-array object type; x: Object :: (T) x</code> (can
- * throw <code>ClassCastException</code>)
+ * {@code T: any non-array object type; x: Object :: (T) x} (can
+ * throw {@code ClassCastException})
*/
public static final Rop CHECK_CAST =
new Rop(RegOps.CHECK_CAST, Type.VOID, StdTypeList.OBJECT,
Exceptions.LIST_Error_ClassCastException, "check-cast");
/**
- * <code>T: any non-array object type; x: Object :: x instanceof
- * T</code>. Note: This is listed as throwing <code>Error</code>
+ * {@code T: any non-array object type; x: Object :: x instanceof
+ * T}. Note: This is listed as throwing {@code Error}
* explicitly because the op <i>can</i> throw, but there are no
* other predefined exceptions for it.
*/
@@ -822,24 +822,24 @@
Exceptions.LIST_Error, "instance-of");
/**
- * <code>r: int; x: Object; f: instance field spec of
- * type int :: r = x.f</code>
+ * {@code r: int; x: Object; f: instance field spec of
+ * type int :: r = x.f}
*/
public static final Rop GET_FIELD_INT =
new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT,
Exceptions.LIST_Error_NullPointerException, "get-field-int");
/**
- * <code>r: long; x: Object; f: instance field spec of
- * type long :: r = x.f</code>
+ * {@code r: long; x: Object; f: instance field spec of
+ * type long :: r = x.f}
*/
public static final Rop GET_FIELD_LONG =
new Rop(RegOps.GET_FIELD, Type.LONG, StdTypeList.OBJECT,
Exceptions.LIST_Error_NullPointerException, "get-field-long");
/**
- * <code>r: float; x: Object; f: instance field spec of
- * type float :: r = x.f</code>
+ * {@code r: float; x: Object; f: instance field spec of
+ * type float :: r = x.f}
*/
public static final Rop GET_FIELD_FLOAT =
new Rop(RegOps.GET_FIELD, Type.FLOAT, StdTypeList.OBJECT,
@@ -847,8 +847,8 @@
"get-field-float");
/**
- * <code>r: double; x: Object; f: instance field spec of
- * type double :: r = x.f</code>
+ * {@code r: double; x: Object; f: instance field spec of
+ * type double :: r = x.f}
*/
public static final Rop GET_FIELD_DOUBLE =
new Rop(RegOps.GET_FIELD, Type.DOUBLE, StdTypeList.OBJECT,
@@ -856,8 +856,8 @@
"get-field-double");
/**
- * <code>r: Object; x: Object; f: instance field spec of
- * type Object :: r = x.f</code>
+ * {@code r: Object; x: Object; f: instance field spec of
+ * type Object :: r = x.f}
*/
public static final Rop GET_FIELD_OBJECT =
new Rop(RegOps.GET_FIELD, Type.OBJECT, StdTypeList.OBJECT,
@@ -865,8 +865,8 @@
"get-field-object");
/**
- * <code>r: boolean; x: Object; f: instance field spec of
- * type boolean :: r = x.f</code>
+ * {@code r: boolean; x: Object; f: instance field spec of
+ * type boolean :: r = x.f}
*/
public static final Rop GET_FIELD_BOOLEAN =
new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT,
@@ -874,8 +874,8 @@
"get-field-boolean");
/**
- * <code>r: byte; x: Object; f: instance field spec of
- * type byte :: r = x.f</code>
+ * {@code r: byte; x: Object; f: instance field spec of
+ * type byte :: r = x.f}
*/
public static final Rop GET_FIELD_BYTE =
new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT,
@@ -883,8 +883,8 @@
"get-field-byte");
/**
- * <code>r: char; x: Object; f: instance field spec of
- * type char :: r = x.f</code>
+ * {@code r: char; x: Object; f: instance field spec of
+ * type char :: r = x.f}
*/
public static final Rop GET_FIELD_CHAR =
new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT,
@@ -892,105 +892,78 @@
"get-field-char");
/**
- * <code>r: short; x: Object; f: instance field spec of
- * type short :: r = x.f</code>
+ * {@code r: short; x: Object; f: instance field spec of
+ * type short :: r = x.f}
*/
public static final Rop GET_FIELD_SHORT =
new Rop(RegOps.GET_FIELD, Type.INT, StdTypeList.OBJECT,
Exceptions.LIST_Error_NullPointerException,
"get-field-short");
- /**
- * <code>r: int; f: static field spec of type int :: r =
- * f</code>
- */
+ /** {@code r: int; f: static field spec of type int :: r = f} */
public static final Rop GET_STATIC_INT =
new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-static-int");
- /**
- * <code>r: long; f: static field spec of type long :: r =
- * f</code>
- */
+ /** {@code r: long; f: static field spec of type long :: r = f} */
public static final Rop GET_STATIC_LONG =
new Rop(RegOps.GET_STATIC, Type.LONG, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-static-long");
- /**
- * <code>r: float; f: static field spec of type float :: r =
- * f</code>
- */
+ /** {@code r: float; f: static field spec of type float :: r = f} */
public static final Rop GET_STATIC_FLOAT =
new Rop(RegOps.GET_STATIC, Type.FLOAT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-static-float");
- /**
- * <code>r: double; f: static field spec of type double :: r =
- * f</code>
- */
+ /** {@code r: double; f: static field spec of type double :: r = f} */
public static final Rop GET_STATIC_DOUBLE =
new Rop(RegOps.GET_STATIC, Type.DOUBLE, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-static-double");
- /**
- * <code>r: Object; f: static field spec of type Object :: r =
- * f</code>
- */
+ /** {@code r: Object; f: static field spec of type Object :: r = f} */
public static final Rop GET_STATIC_OBJECT =
new Rop(RegOps.GET_STATIC, Type.OBJECT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-static-object");
- /**
- * <code>r: boolean; f: static field spec of type boolean :: r =
- * f</code>
- */
+ /** {@code r: boolean; f: static field spec of type boolean :: r = f} */
public static final Rop GET_STATIC_BOOLEAN =
new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-field-boolean");
- /**
- * <code>r: byte; f: static field spec of type byte :: r =
- * f</code>
- */
+ /** {@code r: byte; f: static field spec of type byte :: r = f} */
public static final Rop GET_STATIC_BYTE =
new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-field-byte");
- /**
- * <code>r: char; f: static field spec of type char :: r =
- * f</code>
- */
+ /** {@code r: char; f: static field spec of type char :: r = f} */
public static final Rop GET_STATIC_CHAR =
new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-field-char");
- /**
- * <code>r: short; f: static field spec of type short :: r =
- * f</code>
- */
+ /** {@code r: short; f: static field spec of type short :: r = f} */
public static final Rop GET_STATIC_SHORT =
new Rop(RegOps.GET_STATIC, Type.INT, StdTypeList.EMPTY,
Exceptions.LIST_Error, "get-field-short");
/**
- * <code>x: int; y: Object; f: instance field spec of type
- * int :: y.f = x</code>
+ * {@code x: int; y: Object; f: instance field spec of type
+ * int :: y.f = x}
*/
public static final Rop PUT_FIELD_INT =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT,
Exceptions.LIST_Error_NullPointerException, "put-field-int");
/**
- * <code>x: long; y: Object; f: instance field spec of type
- * long :: y.f = x</code>
+ * {@code x: long; y: Object; f: instance field spec of type
+ * long :: y.f = x}
*/
public static final Rop PUT_FIELD_LONG =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.LONG_OBJECT,
Exceptions.LIST_Error_NullPointerException, "put-field-long");
/**
- * <code>x: float; y: Object; f: instance field spec of type
- * float :: y.f = x</code>
+ * {@code x: float; y: Object; f: instance field spec of type
+ * float :: y.f = x}
*/
public static final Rop PUT_FIELD_FLOAT =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.FLOAT_OBJECT,
@@ -998,8 +971,8 @@
"put-field-float");
/**
- * <code>x: double; y: Object; f: instance field spec of type
- * double :: y.f = x</code>
+ * {@code x: double; y: Object; f: instance field spec of type
+ * double :: y.f = x}
*/
public static final Rop PUT_FIELD_DOUBLE =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.DOUBLE_OBJECT,
@@ -1007,8 +980,8 @@
"put-field-double");
/**
- * <code>x: Object; y: Object; f: instance field spec of type
- * Object :: y.f = x</code>
+ * {@code x: Object; y: Object; f: instance field spec of type
+ * Object :: y.f = x}
*/
public static final Rop PUT_FIELD_OBJECT =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.OBJECT_OBJECT,
@@ -1016,8 +989,8 @@
"put-field-object");
/**
- * <code>x: int; y: Object; f: instance field spec of type
- * boolean :: y.f = x</code>
+ * {@code x: int; y: Object; f: instance field spec of type
+ * boolean :: y.f = x}
*/
public static final Rop PUT_FIELD_BOOLEAN =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT,
@@ -1025,8 +998,8 @@
"put-field-boolean");
/**
- * <code>x: int; y: Object; f: instance field spec of type
- * byte :: y.f = x</code>
+ * {@code x: int; y: Object; f: instance field spec of type
+ * byte :: y.f = x}
*/
public static final Rop PUT_FIELD_BYTE =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT,
@@ -1034,8 +1007,8 @@
"put-field-byte");
/**
- * <code>x: int; y: Object; f: instance field spec of type
- * char :: y.f = x</code>
+ * {@code x: int; y: Object; f: instance field spec of type
+ * char :: y.f = x}
*/
public static final Rop PUT_FIELD_CHAR =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT,
@@ -1043,112 +1016,88 @@
"put-field-char");
/**
- * <code>x: int; y: Object; f: instance field spec of type
- * short :: y.f = x</code>
+ * {@code x: int; y: Object; f: instance field spec of type
+ * short :: y.f = x}
*/
public static final Rop PUT_FIELD_SHORT =
new Rop(RegOps.PUT_FIELD, Type.VOID, StdTypeList.INT_OBJECT,
Exceptions.LIST_Error_NullPointerException,
"put-field-short");
- /**
- * <code>f: static field spec of type int; x: int :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type int; x: int :: f = x} */
public static final Rop PUT_STATIC_INT =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT,
Exceptions.LIST_Error, "put-static-int");
- /**
- * <code>f: static field spec of type long; x: long :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type long; x: long :: f = x} */
public static final Rop PUT_STATIC_LONG =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.LONG,
Exceptions.LIST_Error, "put-static-long");
- /**
- * <code>f: static field spec of type float; x: float :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type float; x: float :: f = x} */
public static final Rop PUT_STATIC_FLOAT =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.FLOAT,
Exceptions.LIST_Error, "put-static-float");
- /**
- * <code>f: static field spec of type double; x: double :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type double; x: double :: f = x} */
public static final Rop PUT_STATIC_DOUBLE =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.DOUBLE,
Exceptions.LIST_Error, "put-static-double");
- /**
- * <code>f: static field spec of type Object; x: Object :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type Object; x: Object :: f = x} */
public static final Rop PUT_STATIC_OBJECT =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.OBJECT,
Exceptions.LIST_Error, "put-static-object");
/**
- * <code>f: static field spec of type boolean; x: boolean :: f =
- * x</code>
+ * {@code f: static field spec of type boolean; x: boolean :: f =
+ * x}
*/
public static final Rop PUT_STATIC_BOOLEAN =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT,
Exceptions.LIST_Error, "put-static-boolean");
- /**
- * <code>f: static field spec of type byte; x: byte :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type byte; x: byte :: f = x} */
public static final Rop PUT_STATIC_BYTE =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT,
Exceptions.LIST_Error, "put-static-byte");
- /**
- * <code>f: static field spec of type char; x: char :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type char; x: char :: f = x} */
public static final Rop PUT_STATIC_CHAR =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT,
Exceptions.LIST_Error, "put-static-char");
- /**
- * <code>f: static field spec of type short; x: short :: f =
- * x</code>
- */
+ /** {@code f: static field spec of type short; x: short :: f = x} */
public static final Rop PUT_STATIC_SHORT =
new Rop(RegOps.PUT_STATIC, Type.VOID, StdTypeList.INT,
Exceptions.LIST_Error, "put-static-short");
- /** <code>x: Int :: local variable begins in x */
+ /** {@code x: Int :: local variable begins in x} */
public static final Rop MARK_LOCAL_INT =
new Rop (RegOps.MARK_LOCAL, Type.VOID,
StdTypeList.INT, "mark-local-int");
- /** <code>x: Long :: local variable begins in x */
+ /** {@code x: Long :: local variable begins in x} */
public static final Rop MARK_LOCAL_LONG =
new Rop (RegOps.MARK_LOCAL, Type.VOID,
StdTypeList.LONG, "mark-local-long");
- /** <code>x: Float :: local variable begins in x */
+ /** {@code x: Float :: local variable begins in x} */
public static final Rop MARK_LOCAL_FLOAT =
new Rop (RegOps.MARK_LOCAL, Type.VOID,
StdTypeList.FLOAT, "mark-local-float");
- /** <code>x: Double :: local variable begins in x */
+ /** {@code x: Double :: local variable begins in x} */
public static final Rop MARK_LOCAL_DOUBLE =
new Rop (RegOps.MARK_LOCAL, Type.VOID,
StdTypeList.DOUBLE, "mark-local-double");
- /** <code>x: Object :: local variable begins in x */
+ /** {@code x: Object :: local variable begins in x} */
public static final Rop MARK_LOCAL_OBJECT =
new Rop (RegOps.MARK_LOCAL, Type.VOID,
StdTypeList.OBJECT, "mark-local-object");
- /** <code>T: Any primitive type; v0..vx: T :: {v0, ..., vx}</code> */
+ /** {@code T: Any primitive type; v0..vx: T :: {v0, ..., vx}} */
public static final Rop FILL_ARRAY_DATA =
new Rop(RegOps.FILL_ARRAY_DATA, Type.VOID, StdTypeList.EMPTY,
"fill-array-data");
@@ -1164,13 +1113,14 @@
* match what is returned. TODO: Revisit this issue.</p>
*
* @param opcode the opcode
- * @param dest non-null; destination type, or {@link Type#VOID} if none
- * @param sources non-null; list of source types
- * @param cst null-ok; associated constant, if any
- * @return non-null; an appropriate instance
+ * @param dest {@code non-null;} destination (result) type, or
+ * {@link Type#VOID} if none
+ * @param sources {@code non-null;} list of source types
+ * @param cst {@code null-ok;} associated constant, if any
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop ropFor(int opcode, TypeBearer dest, TypeList sources,
- Constant cst) {
+ Constant cst) {
switch (opcode) {
case RegOps.NOP: return NOP;
case RegOps.MOVE: return opMove(dest);
@@ -1216,19 +1166,31 @@
case RegOps.MONITOR_EXIT: return MONITOR_EXIT;
case RegOps.AGET: {
Type source = sources.getType(0);
+ Type componentType;
if (source == Type.KNOWN_NULL) {
- // Treat a known-null as an Object[] in this context.
- source = Type.OBJECT_ARRAY;
- }
- return opAget(source.getComponentType());
+ /*
+ * Treat a known-null as an array of the expected
+ * result type.
+ */
+ componentType = dest.getType();
+ } else {
+ componentType = source.getComponentType();
+ }
+ return opAget(componentType);
}
case RegOps.APUT: {
Type source = sources.getType(1);
+ Type componentType;
if (source == Type.KNOWN_NULL) {
- // Treat a known-null as an Object[] in this context.
- source = Type.OBJECT_ARRAY;
- }
- return opAput(source.getComponentType());
+ /*
+ * Treat a known-null as an array of the type being
+ * stored.
+ */
+ componentType = sources.getType(0);
+ } else {
+ componentType = source.getComponentType();
+ }
+ return opAput(componentType);
}
case RegOps.NEW_INSTANCE: return NEW_INSTANCE;
case RegOps.NEW_ARRAY: return opNewArray(dest.getType());
@@ -1275,11 +1237,11 @@
}
/**
- * Returns the appropriate <code>move</code> rop for the given type. The
+ * Returns the appropriate {@code move} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being moved
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being moved
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMove(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -1295,11 +1257,11 @@
}
/**
- * Returns the appropriate <code>move-param</code> rop for the
+ * Returns the appropriate {@code move-param} rop for the
* given type. The result is a shared instance.
*
- * @param type non-null; type of value being moved
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being moved
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMoveParam(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -1314,11 +1276,11 @@
}
/**
- * Returns the appropriate <code>move-exception</code> rop for the
+ * Returns the appropriate {@code move-exception} rop for the
* given type. The result may be a shared instance.
*
- * @param type non-null; type of the exception
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the exception
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMoveException(TypeBearer type) {
return new Rop(RegOps.MOVE_EXCEPTION, type.getType(),
@@ -1326,11 +1288,11 @@
}
/**
- * Returns the appropriate <code>move-result</code> rop for the
+ * Returns the appropriate {@code move-result} rop for the
* given type. The result may be a shared instance.
*
- * @param type non-null; type of the parameter
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMoveResult(TypeBearer type) {
return new Rop(RegOps.MOVE_RESULT, type.getType(),
@@ -1338,11 +1300,11 @@
}
/**
- * Returns the appropriate <code>move-result-pseudo</code> rop for the
+ * Returns the appropriate {@code move-result-pseudo} rop for the
* given type. The result may be a shared instance.
*
- * @param type non-null; type of the parameter
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMoveResultPseudo(TypeBearer type) {
return new Rop(RegOps.MOVE_RESULT_PSEUDO, type.getType(),
@@ -1350,11 +1312,11 @@
}
/**
- * Returns the appropriate <code>const</code> rop for the given
+ * Returns the appropriate {@code const} rop for the given
* type. The result is a shared instance.
*
- * @param type non-null; type of the constant
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the constant
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opConst(TypeBearer type) {
if (type.getType() == Type.KNOWN_NULL) {
@@ -1373,11 +1335,11 @@
}
/**
- * Returns the appropriate <code>if-eq</code> rop for the given
+ * Returns the appropriate {@code if-eq} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfEq(TypeList types) {
return pickIf(types, IF_EQZ_INT, IF_EQZ_OBJECT,
@@ -1385,11 +1347,11 @@
}
/**
- * Returns the appropriate <code>if-ne</code> rop for the given
+ * Returns the appropriate {@code if-ne} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfNe(TypeList types) {
return pickIf(types, IF_NEZ_INT, IF_NEZ_OBJECT,
@@ -1397,60 +1359,60 @@
}
/**
- * Returns the appropriate <code>if-lt</code> rop for the given
+ * Returns the appropriate {@code if-lt} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfLt(TypeList types) {
return pickIf(types, IF_LTZ_INT, null, IF_LT_INT, null);
}
/**
- * Returns the appropriate <code>if-ge</code> rop for the given
+ * Returns the appropriate {@code if-ge} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfGe(TypeList types) {
return pickIf(types, IF_GEZ_INT, null, IF_GE_INT, null);
}
/**
- * Returns the appropriate <code>if-gt</code> rop for the given
+ * Returns the appropriate {@code if-gt} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfGt(TypeList types) {
return pickIf(types, IF_GTZ_INT, null, IF_GT_INT, null);
}
/**
- * Returns the appropriate <code>if-le</code> rop for the given
+ * Returns the appropriate {@code if-le} rop for the given
* sources. The result is a shared instance.
*
- * @param types non-null; source types
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} source types
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opIfLe(TypeList types) {
return pickIf(types, IF_LEZ_INT, null, IF_LE_INT, null);
}
/**
- * Helper for all the <code>if*</code>-related methods, which
+ * Helper for all the {@code if*}-related methods, which
* checks types and picks one of the four variants, throwing if
* there's a problem.
*
- * @param types non-null; the types
- * @param intZ non-null; the int-to-0 comparison
- * @param objZ null-ok; the object-to-null comparison
- * @param intInt non-null; the int-to-int comparison
- * @param objObj non-null; the object-to-object comparison
- * @return non-null; the appropriate instance
+ * @param types {@code non-null;} the types
+ * @param intZ {@code non-null;} the int-to-0 comparison
+ * @param objZ {@code null-ok;} the object-to-null comparison
+ * @param intInt {@code non-null;} the int-to-int comparison
+ * @param objObj {@code non-null;} the object-to-object comparison
+ * @return {@code non-null;} the appropriate instance
*/
private static Rop pickIf(TypeList types, Rop intZ, Rop objZ, Rop intInt,
Rop objObj) {
@@ -1490,11 +1452,11 @@
}
/**
- * Returns the appropriate <code>add</code> rop for the given
+ * Returns the appropriate {@code add} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opAdd(TypeList types) {
return pickBinaryOp(types, ADD_CONST_INT, ADD_CONST_LONG,
@@ -1503,11 +1465,11 @@
}
/**
- * Returns the appropriate <code>sub</code> rop for the given
+ * Returns the appropriate {@code sub} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opSub(TypeList types) {
return pickBinaryOp(types, SUB_CONST_INT, SUB_CONST_LONG,
@@ -1516,11 +1478,11 @@
}
/**
- * Returns the appropriate <code>mul</code> rop for the given
+ * Returns the appropriate {@code mul} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMul(TypeList types) {
return pickBinaryOp(types, MUL_CONST_INT, MUL_CONST_LONG,
@@ -1529,11 +1491,11 @@
}
/**
- * Returns the appropriate <code>div</code> rop for the given
+ * Returns the appropriate {@code div} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opDiv(TypeList types) {
return pickBinaryOp(types, DIV_CONST_INT, DIV_CONST_LONG,
@@ -1542,11 +1504,11 @@
}
/**
- * Returns the appropriate <code>rem</code> rop for the given
+ * Returns the appropriate {@code rem} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opRem(TypeList types) {
return pickBinaryOp(types, REM_CONST_INT, REM_CONST_LONG,
@@ -1555,11 +1517,11 @@
}
/**
- * Returns the appropriate <code>and</code> rop for the given
+ * Returns the appropriate {@code and} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opAnd(TypeList types) {
return pickBinaryOp(types, AND_CONST_INT, AND_CONST_LONG, null, null,
@@ -1567,11 +1529,11 @@
}
/**
- * Returns the appropriate <code>or</code> rop for the given
+ * Returns the appropriate {@code or} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opOr(TypeList types) {
return pickBinaryOp(types, OR_CONST_INT, OR_CONST_LONG, null, null,
@@ -1579,11 +1541,11 @@
}
/**
- * Returns the appropriate <code>xor</code> rop for the given
+ * Returns the appropriate {@code xor} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opXor(TypeList types) {
return pickBinaryOp(types, XOR_CONST_INT, XOR_CONST_LONG, null, null,
@@ -1591,11 +1553,11 @@
}
/**
- * Returns the appropriate <code>shl</code> rop for the given
+ * Returns the appropriate {@code shl} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opShl(TypeList types) {
return pickBinaryOp(types, SHL_CONST_INT, SHL_CONST_LONG, null, null,
@@ -1603,11 +1565,11 @@
}
/**
- * Returns the appropriate <code>shr</code> rop for the given
+ * Returns the appropriate {@code shr} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opShr(TypeList types) {
return pickBinaryOp(types, SHR_CONST_INT, SHR_CONST_LONG, null, null,
@@ -1615,11 +1577,11 @@
}
/**
- * Returns the appropriate <code>ushr</code> rop for the given
+ * Returns the appropriate {@code ushr} rop for the given
* types. The result is a shared instance.
*
- * @param types non-null; types of the sources
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} types of the sources
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opUshr(TypeList types) {
return pickBinaryOp(types, USHR_CONST_INT, USHR_CONST_LONG, null, null,
@@ -1630,16 +1592,16 @@
* Returns the appropriate binary arithmetic rop for the given type
* and arguments. The result is a shared instance.
*
- * @param types non-null; sources of the operation
- * @param int1 non-null; the int-to-constant rop
- * @param long1 non-null; the long-to-constant rop
- * @param float1 null-ok; the float-to-constant rop, if any
- * @param double1 null-ok; the double-to-constant rop, if any
- * @param int2 non-null; the int-to-int rop
- * @param long2 non-null; the long-to-long or long-to-int rop
- * @param float2 null-ok; the float-to-float rop, if any
- * @param double2 null-ok; the double-to-double rop, if any
- * @return non-null; an appropriate instance
+ * @param types {@code non-null;} sources of the operation
+ * @param int1 {@code non-null;} the int-to-constant rop
+ * @param long1 {@code non-null;} the long-to-constant rop
+ * @param float1 {@code null-ok;} the float-to-constant rop, if any
+ * @param double1 {@code null-ok;} the double-to-constant rop, if any
+ * @param int2 {@code non-null;} the int-to-int rop
+ * @param long2 {@code non-null;} the long-to-long or long-to-int rop
+ * @param float2 {@code null-ok;} the float-to-float rop, if any
+ * @param double2 {@code null-ok;} the double-to-double rop, if any
+ * @return {@code non-null;} an appropriate instance
*/
private static Rop pickBinaryOp(TypeList types, Rop int1, Rop long1,
Rop float1, Rop double1, Rop int2,
@@ -1676,11 +1638,11 @@
}
/**
- * Returns the appropriate <code>neg</code> rop for the given type. The
+ * Returns the appropriate {@code neg} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being operated on
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being operated on
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opNeg(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -1694,11 +1656,11 @@
}
/**
- * Returns the appropriate <code>not</code> rop for the given type. The
+ * Returns the appropriate {@code not} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being operated on
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being operated on
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opNot(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -1710,11 +1672,11 @@
}
/**
- * Returns the appropriate <code>cmpl</code> rop for the given type. The
+ * Returns the appropriate {@code cmpl} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being compared
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being compared
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opCmpl(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1727,11 +1689,11 @@
}
/**
- * Returns the appropriate <code>cmpg</code> rop for the given type. The
+ * Returns the appropriate {@code cmpg} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being compared
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being compared
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opCmpg(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1743,12 +1705,12 @@
}
/**
- * Returns the appropriate <code>conv</code> rop for the given types. The
+ * Returns the appropriate {@code conv} rop for the given types. The
* result is a shared instance.
*
- * @param dest non-null; target value type
- * @param source non-null; source value type
- * @return non-null; an appropriate instance
+ * @param dest {@code non-null;} target value type
+ * @param source {@code non-null;} source value type
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opConv(TypeBearer dest, TypeBearer source) {
int dbt = dest.getBasicFrameType();
@@ -1788,11 +1750,11 @@
}
/**
- * Returns the appropriate <code>return</code> rop for the given type. The
+ * Returns the appropriate {@code return} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; type of value being returned
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being returned
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opReturn(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -1808,11 +1770,11 @@
}
/**
- * Returns the appropriate <code>aget</code> rop for the given type. The
+ * Returns the appropriate {@code aget} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; element type of array being accessed
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} element type of array being accessed
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opAget(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1831,11 +1793,11 @@
}
/**
- * Returns the appropriate <code>aput</code> rop for the given type. The
+ * Returns the appropriate {@code aput} rop for the given type. The
* result is a shared instance.
*
- * @param type non-null; element type of array being accessed
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} element type of array being accessed
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opAput(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1854,11 +1816,11 @@
}
/**
- * Returns the appropriate <code>new-array</code> rop for the given
+ * Returns the appropriate {@code new-array} rop for the given
* type. The result is a shared instance.
*
- * @param arrayType non-null; array type of array being created
- * @return non-null; an appropriate instance
+ * @param arrayType {@code non-null;} array type of array being created
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opNewArray(TypeBearer arrayType) {
Type type = arrayType.getType();
@@ -1884,12 +1846,12 @@
}
/**
- * Returns the appropriate <code>filled-new-array</code> rop for the given
+ * Returns the appropriate {@code filled-new-array} rop for the given
* type. The result may be a shared instance.
*
- * @param arrayType non-null; type of array being created
- * @param count >= 0; number of elements that the array should have
- * @return non-null; an appropriate instance
+ * @param arrayType {@code non-null;} type of array being created
+ * @param count {@code >= 0;} number of elements that the array should have
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opFilledNewArray(TypeBearer arrayType, int count) {
Type type = arrayType.getType();
@@ -1916,11 +1878,11 @@
}
/**
- * Returns the appropriate <code>get-field</code> rop for the given
+ * Returns the appropriate {@code get-field} rop for the given
* type. The result is a shared instance.
*
- * @param type non-null; type of the field in question
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the field in question
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opGetField(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1939,11 +1901,11 @@
}
/**
- * Returns the appropriate <code>put-field</code> rop for the given
+ * Returns the appropriate {@code put-field} rop for the given
* type. The result is a shared instance.
*
- * @param type non-null; type of the field in question
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the field in question
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opPutField(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1962,11 +1924,11 @@
}
/**
- * Returns the appropriate <code>get-static</code> rop for the given
+ * Returns the appropriate {@code get-static} rop for the given
* type. The result is a shared instance.
*
- * @param type non-null; type of the field in question
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the field in question
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opGetStatic(TypeBearer type) {
switch (type.getBasicType()) {
@@ -1985,11 +1947,11 @@
}
/**
- * Returns the appropriate <code>put-static</code> rop for the given
+ * Returns the appropriate {@code put-static} rop for the given
* type. The result is a shared instance.
*
- * @param type non-null; type of the field in question
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of the field in question
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opPutStatic(TypeBearer type) {
switch (type.getBasicType()) {
@@ -2008,11 +1970,11 @@
}
/**
- * Returns the appropriate <code>invoke-static</code> rop for the
+ * Returns the appropriate {@code invoke-static} rop for the
* given type. The result is typically a newly-allocated instance.
*
- * @param meth non-null; descriptor of the method
- * @return non-null; an appropriate instance
+ * @param meth {@code non-null;} descriptor of the method
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opInvokeStatic(Prototype meth) {
return new Rop(RegOps.INVOKE_STATIC,
@@ -2021,12 +1983,12 @@
}
/**
- * Returns the appropriate <code>invoke-virtual</code> rop for the
+ * Returns the appropriate {@code invoke-virtual} rop for the
* given type. The result is typically a newly-allocated instance.
*
- * @param meth non-null; descriptor of the method, including the
- * <code>this</code> parameter
- * @return non-null; an appropriate instance
+ * @param meth {@code non-null;} descriptor of the method, including the
+ * {@code this} parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opInvokeVirtual(Prototype meth) {
return new Rop(RegOps.INVOKE_VIRTUAL,
@@ -2035,12 +1997,12 @@
}
/**
- * Returns the appropriate <code>invoke-super</code> rop for the
+ * Returns the appropriate {@code invoke-super} rop for the
* given type. The result is typically a newly-allocated instance.
*
- * @param meth non-null; descriptor of the method, including the
- * <code>this</code> parameter
- * @return non-null; an appropriate instance
+ * @param meth {@code non-null;} descriptor of the method, including the
+ * {@code this} parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opInvokeSuper(Prototype meth) {
return new Rop(RegOps.INVOKE_SUPER,
@@ -2049,12 +2011,12 @@
}
/**
- * Returns the appropriate <code>invoke-direct</code> rop for the
+ * Returns the appropriate {@code invoke-direct} rop for the
* given type. The result is typically a newly-allocated instance.
*
- * @param meth non-null; descriptor of the method, including the
- * <code>this</code> parameter
- * @return non-null; an appropriate instance
+ * @param meth {@code non-null;} descriptor of the method, including the
+ * {@code this} parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opInvokeDirect(Prototype meth) {
return new Rop(RegOps.INVOKE_DIRECT,
@@ -2063,12 +2025,12 @@
}
/**
- * Returns the appropriate <code>invoke-interface</code> rop for the
+ * Returns the appropriate {@code invoke-interface} rop for the
* given type. The result is typically a newly-allocated instance.
*
- * @param meth non-null; descriptor of the method, including the
- * <code>this</code> parameter
- * @return non-null; an appropriate instance
+ * @param meth {@code non-null;} descriptor of the method, including the
+ * {@code this} parameter
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opInvokeInterface(Prototype meth) {
return new Rop(RegOps.INVOKE_INTERFACE,
@@ -2077,11 +2039,11 @@
}
/**
- * Returns the appropriate <code>mark-local</code> rop for the given type.
+ * Returns the appropriate {@code mark-local} rop for the given type.
* The result is a shared instance.
*
- * @param type non-null; type of value being marked
- * @return non-null; an appropriate instance
+ * @param type {@code non-null;} type of value being marked
+ * @return {@code non-null;} an appropriate instance
*/
public static Rop opMarkLocal(TypeBearer type) {
switch (type.getBasicFrameType()) {
@@ -2105,7 +2067,7 @@
/**
* Throws the right exception to complain about a bogus type.
*
- * @param type non-null; the bad type
+ * @param type {@code non-null;} the bad type
* @return never
*/
private static Rop throwBadType(TypeBearer type) {
@@ -2115,7 +2077,7 @@
/**
* Throws the right exception to complain about a bogus list of types.
*
- * @param types non-null; the bad types
+ * @param types {@code non-null;} the bad types
* @return never
*/
private static Rop throwBadTypes(TypeList types) {
diff --git a/dx/src/com/android/dx/rop/code/SourcePosition.java b/dx/src/com/android/dx/rop/code/SourcePosition.java
index da66c7d..f32caa1 100644
--- a/dx/src/com/android/dx/rop/code/SourcePosition.java
+++ b/dx/src/com/android/dx/rop/code/SourcePosition.java
@@ -24,21 +24,21 @@
* line number and original bytecode address.
*/
public final class SourcePosition {
- /** non-null; convenient "no information known" instance */
+ /** {@code non-null;} convenient "no information known" instance */
public static final SourcePosition NO_INFO =
new SourcePosition(null, -1, -1);
- /** null-ok; name of the file of origin or <code>null</code> if unknown */
+ /** {@code null-ok;} name of the file of origin or {@code null} if unknown */
private final CstUtf8 sourceFile;
/**
- * >= -1; the bytecode address, or <code>-1</code> if that
+ * {@code >= -1;} the bytecode address, or {@code -1} if that
* information is unknown
*/
private final int address;
/**
- * >= -1; the line number, or <code>-1</code> if that
+ * {@code >= -1;} the line number, or {@code -1} if that
* information is unknown
*/
private final int line;
@@ -46,11 +46,11 @@
/**
* Constructs an instance.
*
- * @param sourceFile null-ok; name of the file of origin or
- * <code>null</code> if unknown
- * @param address >= -1; original bytecode address or <code>-1</code>
+ * @param sourceFile {@code null-ok;} name of the file of origin or
+ * {@code null} if unknown
+ * @param address {@code >= -1;} original bytecode address or {@code -1}
* if unknown
- * @param line >= -1; original line number or <code>-1</code> if
+ * @param line {@code >= -1;} original line number or {@code -1} if
* unknown
*/
public SourcePosition(CstUtf8 sourceFile, int address, int line) {
@@ -118,8 +118,8 @@
* Returns whether the lines match between this instance and
* the one given.
*
- * @param other non-null; the instance to compare to
- * @return <code>true</code> iff the lines match
+ * @param other {@code non-null;} the instance to compare to
+ * @return {@code true} iff the lines match
*/
public boolean sameLine(SourcePosition other) {
return (line == other.line);
@@ -129,8 +129,8 @@
* Returns whether the lines and files match between this instance and
* the one given.
*
- * @param other non-null; the instance to compare to
- * @return <code>true</code> iff the lines and files match
+ * @param other {@code non-null;} the instance to compare to
+ * @return {@code true} iff the lines and files match
*/
public boolean sameLineAndFile(SourcePosition other) {
return (line == other.line) &&
@@ -141,7 +141,7 @@
/**
* Gets the source file, if known.
*
- * @return null-ok; the source file or <code>null</code> if unknown
+ * @return {@code null-ok;} the source file or {@code null} if unknown
*/
public CstUtf8 getSourceFile() {
return sourceFile;
@@ -150,7 +150,7 @@
/**
* Gets the original bytecode address.
*
- * @return >= -1; the address or <code>-1</code> if unknown
+ * @return {@code >= -1;} the address or {@code -1} if unknown
*/
public int getAddress() {
return address;
@@ -159,7 +159,7 @@
/**
* Gets the original line number.
*
- * @return >= -1; the original line number or <code>-1</code> if
+ * @return {@code >= -1;} the original line number or {@code -1} if
* unknown
*/
public int getLine() {
diff --git a/dx/src/com/android/dx/rop/code/SwitchInsn.java b/dx/src/com/android/dx/rop/code/SwitchInsn.java
index fdf1a46..586205b 100644
--- a/dx/src/com/android/dx/rop/code/SwitchInsn.java
+++ b/dx/src/com/android/dx/rop/code/SwitchInsn.java
@@ -26,17 +26,17 @@
*/
public final class SwitchInsn
extends Insn {
- /** non-null; list of switch cases */
+ /** {@code non-null;} list of switch cases */
private final IntList cases;
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param result null-ok; spec for the result, if any
- * @param sources non-null; specs for all the sources
- * @param cases non-null; list of switch cases
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param result {@code null-ok;} spec for the result, if any
+ * @param sources {@code non-null;} specs for all the sources
+ * @param cases {@code non-null;} list of switch cases
*/
public SwitchInsn(Rop opcode, SourcePosition position, RegisterSpec result,
RegisterSpecList sources, IntList cases) {
@@ -90,7 +90,7 @@
* {@inheritDoc}
*
* <p> SwitchInsn always compares false. The current use for this method
- * never encounters <code>SwitchInsn</code>s
+ * never encounters {@code SwitchInsn}s
*/
@Override
public boolean contentEquals(Insn b) {
@@ -111,7 +111,7 @@
/**
* Gets the list of switch cases.
*
- * @return non-null; the case list
+ * @return {@code non-null;} the case list
*/
public IntList getCases() {
return cases;
diff --git a/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java b/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java
index 49ebc91..b14e758 100644
--- a/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java
+++ b/dx/src/com/android/dx/rop/code/ThrowingCstInsn.java
@@ -26,17 +26,17 @@
*/
public final class ThrowingCstInsn
extends CstInsn {
- /** non-null; list of exceptions caught */
+ /** {@code non-null;} list of exceptions caught */
private final TypeList catches;
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param sources non-null; specs for all the sources
- * @param catches non-null; list of exceptions caught
- * @param cst non-null; the constant
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param sources {@code non-null;} specs for all the sources
+ * @param catches {@code non-null;} list of exceptions caught
+ * @param cst {@code non-null;} the constant
*/
public ThrowingCstInsn(Rop opcode, SourcePosition position,
RegisterSpecList sources,
diff --git a/dx/src/com/android/dx/rop/code/ThrowingInsn.java b/dx/src/com/android/dx/rop/code/ThrowingInsn.java
index 24a5bed..78dc874 100644
--- a/dx/src/com/android/dx/rop/code/ThrowingInsn.java
+++ b/dx/src/com/android/dx/rop/code/ThrowingInsn.java
@@ -20,22 +20,22 @@
import com.android.dx.rop.type.TypeList;
/**
- * Instruction which possibly throws. The <code>successors</code> list in the
+ * Instruction which possibly throws. The {@code successors} list in the
* basic block an instance of this class is inside corresponds in-order to
* the list of exceptions handled by this instruction, with the
* no-exception case appended as the final target.
*/
public final class ThrowingInsn
extends Insn {
- /** non-null; list of exceptions caught */
+ /** {@code non-null;} list of exceptions caught */
private final TypeList catches;
/**
* Gets the string form of a register spec list to be used as a catches
* list.
*
- * @param catches non-null; the catches list
- * @return non-null; the string form
+ * @param catches {@code non-null;} the catches list
+ * @return {@code non-null;} the string form
*/
public static String toCatchString(TypeList catches) {
StringBuffer sb = new StringBuffer(100);
@@ -54,10 +54,10 @@
/**
* Constructs an instance.
*
- * @param opcode non-null; the opcode
- * @param position non-null; source position
- * @param sources non-null; specs for all the sources
- * @param catches non-null; list of exceptions caught
+ * @param opcode {@code non-null;} the opcode
+ * @param position {@code non-null;} source position
+ * @param sources {@code non-null;} specs for all the sources
+ * @param catches {@code non-null;} list of exceptions caught
*/
public ThrowingInsn(Rop opcode, SourcePosition position,
RegisterSpecList sources,
diff --git a/dx/src/com/android/dx/rop/code/TranslationAdvice.java b/dx/src/com/android/dx/rop/code/TranslationAdvice.java
index 8c2cde9..832d84d 100644
--- a/dx/src/com/android/dx/rop/code/TranslationAdvice.java
+++ b/dx/src/com/android/dx/rop/code/TranslationAdvice.java
@@ -30,10 +30,10 @@
* last argument must have a type which indicates it is a known constant.)
* The instruction associated must have exactly two sources.
*
- * @param opcode non-null; the opcode
- * @param sourceA non-null; the first source
- * @param sourceB non-null; the second source
- * @return <code>true</code> iff the target can represent the operation
+ * @param opcode {@code non-null;} the opcode
+ * @param sourceA {@code non-null;} the first source
+ * @param sourceB {@code non-null;} the second source
+ * @return {@code true} iff the target can represent the operation
* using a constant for the last argument
*/
public boolean hasConstantOperation(Rop opcode,
@@ -43,9 +43,9 @@
* Returns true if the translation target requires the sources of the
* specified opcode to be in order and contiguous (eg, for an invoke-range)
*
- * @param opcode non-null; opcode
- * @param sources non-null; source list
- * @return <code>true</code> iff the target requires the sources to be
+ * @param opcode {@code non-null;} opcode
+ * @param sources {@code non-null;} source list
+ * @return {@code true} iff the target requires the sources to be
* in order and contiguous.
*/
public boolean requiresSourcesInOrder(Rop opcode, RegisterSpecList sources);
diff --git a/dx/src/com/android/dx/rop/cst/Constant.java b/dx/src/com/android/dx/rop/cst/Constant.java
index 0f44010..64231d3 100644
--- a/dx/src/com/android/dx/rop/cst/Constant.java
+++ b/dx/src/com/android/dx/rop/cst/Constant.java
@@ -24,11 +24,11 @@
public abstract class Constant
implements ToHuman, Comparable<Constant> {
/**
- * Returns <code>true</code> if this instance is a category-2 constant,
+ * Returns {@code true} if this instance is a category-2 constant,
* meaning it takes up two slots in the constant pool, or
- * <code>false</code> if this instance is category-1.
+ * {@code false} if this instance is category-1.
*
- * @return <code>true</code> iff this instance is category-2
+ * @return {@code true} iff this instance is category-2
*/
public abstract boolean isCategory2();
@@ -36,7 +36,7 @@
* Returns the human name for the particular type of constant
* this instance is.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public abstract String typeName();
@@ -60,8 +60,8 @@
* Compare the values of this and another instance, which are guaranteed
* to be of the same class. Subclasses must implement this.
*
- * @param other non-null; the instance to compare to
- * @return <code>-1</code>, <code>0</code>, or <code>1</code>, as usual
+ * @param other {@code non-null;} the instance to compare to
+ * @return {@code -1}, {@code 0}, or {@code 1}, as usual
* for a comparison
*/
protected abstract int compareTo0(Constant other);
diff --git a/dx/src/com/android/dx/rop/cst/ConstantPool.java b/dx/src/com/android/dx/rop/cst/ConstantPool.java
index 9a64a2a..efc394d 100644
--- a/dx/src/com/android/dx/rop/cst/ConstantPool.java
+++ b/dx/src/com/android/dx/rop/cst/ConstantPool.java
@@ -23,47 +23,47 @@
public interface ConstantPool {
/**
* Get the "size" of the constant pool. This corresponds to the
- * class file field <code>constant_pool_count</code>, and is in fact
+ * class file field {@code constant_pool_count}, and is in fact
* always at least one more than the actual size of the constant pool,
- * as element <code>0</code> is always invalid.
+ * as element {@code 0} is always invalid.
*
- * @return <code>>= 1</code>; the size
+ * @return {@code >= 1;} the size
*/
public int size();
/**
- * Get the <code>n</code>th entry in the constant pool, which must
+ * Get the {@code n}th entry in the constant pool, which must
* be valid.
*
- * @param n <code>n >= 0, n < size()</code>; the constant pool index
- * @return non-null; the corresponding entry
- * @throws IllegalArgumentException thrown if <code>n</code> is
+ * @param n {@code n >= 0, n < size();} the constant pool index
+ * @return {@code non-null;} the corresponding entry
+ * @throws IllegalArgumentException thrown if {@code n} is
* in-range but invalid
*/
public Constant get(int n);
/**
- * Get the <code>n</code>th entry in the constant pool, which must
- * be valid unless <code>n == 0</code>, in which case <code>null</code>
+ * Get the {@code n}th entry in the constant pool, which must
+ * be valid unless {@code n == 0}, in which case {@code null}
* is returned.
*
- * @param n <code>n >= 0, n < size()</code>; the constant pool index
- * @return null-ok; the corresponding entry, if <code>n != 0</code>
- * @throws IllegalArgumentException thrown if <code>n</code> is
+ * @param n {@code n >= 0, n < size();} the constant pool index
+ * @return {@code null-ok;} the corresponding entry, if {@code n != 0}
+ * @throws IllegalArgumentException thrown if {@code n} is
* in-range and non-zero but invalid
*/
public Constant get0Ok(int n);
/**
- * Get the <code>n</code>th entry in the constant pool, or
- * <code>null</code> if the index is in-range but invalid. In
- * particular, <code>null</code> is returned for index <code>0</code>
+ * Get the {@code n}th entry in the constant pool, or
+ * {@code null} if the index is in-range but invalid. In
+ * particular, {@code null} is returned for index {@code 0}
* as well as the index after any entry which is defined to take up
- * two slots (that is, <code>Long</code> and <code>Double</code>
+ * two slots (that is, {@code Long} and {@code Double}
* entries).
*
- * @param n <code>n >= 0, n < size()</code>; the constant pool index
- * @return null-ok; the corresponding entry, or <code>null</code> if
+ * @param n {@code n >= 0, n < size();} the constant pool index
+ * @return {@code null-ok;} the corresponding entry, or {@code null} if
* the index is in-range but invalid
*/
public Constant getOrNull(int n);
diff --git a/dx/src/com/android/dx/rop/cst/CstAnnotation.java b/dx/src/com/android/dx/rop/cst/CstAnnotation.java
index d6dc1f2..1385798 100644
--- a/dx/src/com/android/dx/rop/cst/CstAnnotation.java
+++ b/dx/src/com/android/dx/rop/cst/CstAnnotation.java
@@ -22,13 +22,13 @@
* Constant type that represents an annotation.
*/
public final class CstAnnotation extends Constant {
- /** non-null; the actual annotation */
+ /** {@code non-null;} the actual annotation */
private final Annotation annotation;
/**
* Constructs an instance.
*
- * @param annotation non-null; the annotation to hold
+ * @param annotation {@code non-null;} the annotation to hold
*/
public CstAnnotation(Annotation annotation) {
if (annotation == null) {
@@ -88,7 +88,7 @@
/**
* Get the underlying annotation.
*
- * @return non-null; the annotation
+ * @return {@code non-null;} the annotation
*/
public Annotation getAnnotation() {
return annotation;
diff --git a/dx/src/com/android/dx/rop/cst/CstArray.java b/dx/src/com/android/dx/rop/cst/CstArray.java
index 69c0aef..8b521bd 100644
--- a/dx/src/com/android/dx/rop/cst/CstArray.java
+++ b/dx/src/com/android/dx/rop/cst/CstArray.java
@@ -24,13 +24,13 @@
* may be of any type <i>other</i> than {@link CstUtf8}.
*/
public final class CstArray extends Constant {
- /** non-null; the actual list of contents */
+ /** {@code non-null;} the actual list of contents */
private final List list;
/**
* Constructs an instance.
*
- * @param list non-null; the actual list of contents
+ * @param list {@code non-null;} the actual list of contents
*/
public CstArray(List list) {
if (list == null) {
@@ -90,7 +90,7 @@
/**
* Get the underlying list.
*
- * @return non-null; the list
+ * @return {@code non-null;} the list
*/
public List getList() {
return list;
@@ -103,7 +103,7 @@
extends FixedSizeList implements Comparable<List> {
/**
* Constructs an instance. All indices initially contain
- * <code>null</code>.
+ * {@code null}.
*
* @param size the size of the list
*/
@@ -138,10 +138,10 @@
/**
* Gets the element at the given index. It is an error to call
* this with the index for an element which was never set; if you
- * do that, this will throw <code>NullPointerException</code>.
+ * do that, this will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which index
- * @return non-null; element at that index
+ * @param n {@code >= 0, < size();} which index
+ * @return {@code non-null;} element at that index
*/
public Constant get(int n) {
return (Constant) get0(n);
@@ -150,8 +150,8 @@
/**
* Sets the element at the given index.
*
- * @param n >= 0, < size(); which index
- * @param a null-ok; the element to set at <code>n</code>
+ * @param n {@code >= 0, < size();} which index
+ * @param a {@code null-ok;} the element to set at {@code n}
*/
public void set(int n, Constant a) {
if (a instanceof CstUtf8) {
diff --git a/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java b/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java
index c885601..039d7ed 100644
--- a/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstBaseMethodRef.java
@@ -28,20 +28,20 @@
*/
public abstract class CstBaseMethodRef
extends CstMemberRef {
- /** non-null; the raw prototype for this method */
+ /** {@code non-null;} the raw prototype for this method */
private final Prototype prototype;
/**
- * null-ok; the prototype for this method taken to be an instance
- * method, or <code>null</code> if not yet calculated
+ * {@code null-ok;} the prototype for this method taken to be an instance
+ * method, or {@code null} if not yet calculated
*/
private Prototype instancePrototype;
/**
* Constructs an instance.
*
- * @param definingClass non-null; the type of the defining class
- * @param nat non-null; the name-and-type
+ * @param definingClass {@code non-null;} the type of the defining class
+ * @param nat {@code non-null;} the name-and-type
*/
/*package*/ CstBaseMethodRef(CstType definingClass, CstNat nat) {
super(definingClass, nat);
@@ -53,9 +53,9 @@
/**
* Gets the raw prototype of this method. This doesn't include a
- * <code>this</code> argument.
+ * {@code this} argument.
*
- * @return non-null; the method prototype
+ * @return {@code non-null;} the method prototype
*/
public final Prototype getPrototype() {
return prototype;
@@ -63,14 +63,14 @@
/**
* Gets the prototype of this method as either a
- * <code>static</code> or instance method. In the case of a
- * <code>static</code> method, this is the same as the raw
+ * {@code static} or instance method. In the case of a
+ * {@code static} method, this is the same as the raw
* prototype. In the case of an instance method, this has an
- * appropriately-typed <code>this</code> argument as the first
+ * appropriately-typed {@code this} argument as the first
* one.
*
* @param isStatic whether the method should be considered static
- * @return non-null; the method prototype
+ * @return {@code non-null;} the method prototype
*/
public final Prototype getPrototype(boolean isStatic) {
if (isStatic) {
@@ -102,7 +102,7 @@
*
* In this case, this method returns the <i>return type</i> of this method.
*
- * @return non-null; the method's return type
+ * @return {@code non-null;} the method's return type
*/
public final Type getType() {
return prototype.getReturnType();
@@ -111,15 +111,15 @@
/**
* Gets the number of words of parameters required by this
* method's descriptor. Since instances of this class have no way
- * to know if they will be used in a <code>static</code> or
+ * to know if they will be used in a {@code static} or
* instance context, one has to indicate this explicitly as an
* argument. This method is just a convenient shorthand for
- * <code>getPrototype().getParameterTypes().getWordCount()</code>,
- * plus <code>1</code> if the method is to be treated as an
+ * {@code getPrototype().getParameterTypes().getWordCount()},
+ * plus {@code 1} if the method is to be treated as an
* instance method.
*
* @param isStatic whether the method should be considered static
- * @return >= 0; the argument word count
+ * @return {@code >= 0;} the argument word count
*/
public final int getParameterWordCount(boolean isStatic) {
return getPrototype(isStatic).getParameterTypes().getWordCount();
@@ -128,9 +128,9 @@
/**
* Gets whether this is a reference to an instance initialization
* method. This is just a convenient shorthand for
- * <code>getNat().isInstanceInit()</code>.
+ * {@code getNat().isInstanceInit()}.
*
- * @return <code>true</code> iff this is a reference to an
+ * @return {@code true} iff this is a reference to an
* instance initialization method
*/
public final boolean isInstanceInit() {
@@ -140,9 +140,9 @@
/**
* Gets whether this is a reference to a class initialization
* method. This is just a convenient shorthand for
- * <code>getNat().isClassInit()</code>.
+ * {@code getNat().isClassInit()}.
*
- * @return <code>true</code> iff this is a reference to an
+ * @return {@code true} iff this is a reference to an
* instance initialization method
*/
public final boolean isClassInit() {
diff --git a/dx/src/com/android/dx/rop/cst/CstBoolean.java b/dx/src/com/android/dx/rop/cst/CstBoolean.java
index ab25d5b..8c290ef 100644
--- a/dx/src/com/android/dx/rop/cst/CstBoolean.java
+++ b/dx/src/com/android/dx/rop/cst/CstBoolean.java
@@ -19,33 +19,33 @@
import com.android.dx.rop.type.Type;
/**
- * Constants of type <code>boolean</code>.
+ * Constants of type {@code boolean}.
*/
public final class CstBoolean
extends CstLiteral32 {
- /** non-null; instance representing <code>false</code> */
+ /** {@code non-null;} instance representing {@code false} */
public static final CstBoolean VALUE_FALSE = new CstBoolean(false);
- /** non-null; instance representing <code>true</code> */
+ /** {@code non-null;} instance representing {@code true} */
public static final CstBoolean VALUE_TRUE = new CstBoolean(true);
/**
* Makes an instance for the given value. This will return an
* already-allocated instance.
*
- * @param value the <code>boolean</code> value
- * @return non-null; the appropriate instance
+ * @param value the {@code boolean} value
+ * @return {@code non-null;} the appropriate instance
*/
public static CstBoolean make(boolean value) {
return value ? VALUE_TRUE : VALUE_FALSE;
}
/**
- * Makes an instance for the given <code>int</code> value. This
+ * Makes an instance for the given {@code int} value. This
* will return an already-allocated instance.
*
- * @param value must be either <code>0</code> or <code>1</code>
- * @return non-null; the appropriate instance
+ * @param value must be either {@code 0} or {@code 1}
+ * @return {@code non-null;} the appropriate instance
*/
public static CstBoolean make(int value) {
if (value == 0) {
@@ -60,7 +60,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>boolean</code> value
+ * @param value the {@code boolean} value
*/
private CstBoolean(boolean value) {
super(value ? 1 : 0);
@@ -89,7 +89,7 @@
}
/**
- * Gets the <code>boolean</code> value.
+ * Gets the {@code boolean} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstByte.java b/dx/src/com/android/dx/rop/cst/CstByte.java
index ffc3206..a8af9f7 100644
--- a/dx/src/com/android/dx/rop/cst/CstByte.java
+++ b/dx/src/com/android/dx/rop/cst/CstByte.java
@@ -20,30 +20,30 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>byte</code>.
+ * Constants of type {@code byte}.
*/
public final class CstByte
extends CstLiteral32 {
- /** non-null; the value <code>0</code> as an instance of this class */
+ /** {@code non-null;} the value {@code 0} as an instance of this class */
public static final CstByte VALUE_0 = make((byte) 0);
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param value the <code>byte</code> value
+ * @param value the {@code byte} value
*/
public static CstByte make(byte value) {
return new CstByte(value);
}
/**
- * Makes an instance for the given <code>int</code> value. This
+ * Makes an instance for the given {@code int} value. This
* may (but does not necessarily) return an already-allocated
* instance.
*
- * @param value the value, which must be in range for a <code>byte</code>
- * @return non-null; the appropriate instance
+ * @param value the value, which must be in range for a {@code byte}
+ * @return {@code non-null;} the appropriate instance
*/
public static CstByte make(int value) {
byte cast = (byte) value;
@@ -59,7 +59,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>byte</code> value
+ * @param value the {@code byte} value
*/
private CstByte(byte value) {
super(value);
@@ -89,7 +89,7 @@
}
/**
- * Gets the <code>byte</code> value.
+ * Gets the {@code byte} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstChar.java b/dx/src/com/android/dx/rop/cst/CstChar.java
index a31bd7f..0a87cbc 100644
--- a/dx/src/com/android/dx/rop/cst/CstChar.java
+++ b/dx/src/com/android/dx/rop/cst/CstChar.java
@@ -20,30 +20,30 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>char</code>.
+ * Constants of type {@code char}.
*/
public final class CstChar
extends CstLiteral32 {
- /** non-null; the value <code>0</code> as an instance of this class */
+ /** {@code non-null;} the value {@code 0} as an instance of this class */
public static final CstChar VALUE_0 = make((char) 0);
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param value the <code>char</code> value
+ * @param value the {@code char} value
*/
public static CstChar make(char value) {
return new CstChar(value);
}
/**
- * Makes an instance for the given <code>int</code> value. This
+ * Makes an instance for the given {@code int} value. This
* may (but does not necessarily) return an already-allocated
* instance.
*
- * @param value the value, which must be in range for a <code>char</code>
- * @return non-null; the appropriate instance
+ * @param value the value, which must be in range for a {@code char}
+ * @return {@code non-null;} the appropriate instance
*/
public static CstChar make(int value) {
char cast = (char) value;
@@ -59,7 +59,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>char</code> value
+ * @param value the {@code char} value
*/
private CstChar(char value) {
super(value);
@@ -89,7 +89,7 @@
}
/**
- * Gets the <code>char</code> value.
+ * Gets the {@code char} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstDouble.java b/dx/src/com/android/dx/rop/cst/CstDouble.java
index 4516667..df4a2cf 100644
--- a/dx/src/com/android/dx/rop/cst/CstDouble.java
+++ b/dx/src/com/android/dx/rop/cst/CstDouble.java
@@ -20,15 +20,15 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>CONSTANT_Double_info</code>.
+ * Constants of type {@code CONSTANT_Double_info}.
*/
public final class CstDouble
extends CstLiteral64 {
- /** non-null; instance representing <code>0</code> */
+ /** {@code non-null;} instance representing {@code 0} */
public static final CstDouble VALUE_0 =
new CstDouble(Double.doubleToLongBits(0.0));
- /** non-null; instance representing <code>1</code> */
+ /** {@code non-null;} instance representing {@code 1} */
public static final CstDouble VALUE_1 =
new CstDouble(Double.doubleToLongBits(1.0));
@@ -36,7 +36,7 @@
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param bits the <code>double</code> value as <code>long</code> bits
+ * @param bits the {@code double} value as {@code long} bits
*/
public static CstDouble make(long bits) {
/*
@@ -49,7 +49,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param bits the <code>double</code> value as <code>long</code> bits
+ * @param bits the {@code double} value as {@code long} bits
*/
private CstDouble(long bits) {
super(bits);
@@ -80,7 +80,7 @@
}
/**
- * Gets the <code>double</code> value.
+ * Gets the {@code double} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstEnumRef.java b/dx/src/com/android/dx/rop/cst/CstEnumRef.java
index f5aec05..78cab9d 100644
--- a/dx/src/com/android/dx/rop/cst/CstEnumRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstEnumRef.java
@@ -23,13 +23,13 @@
* value of an enumerated type.
*/
public final class CstEnumRef extends CstMemberRef {
- /** null-ok; the corresponding field ref, lazily initialized */
+ /** {@code null-ok;} the corresponding field ref, lazily initialized */
private CstFieldRef fieldRef;
/**
* Constructs an instance.
*
- * @param nat non-null; the name-and-type; the defining class is derived
+ * @param nat {@code non-null;} the name-and-type; the defining class is derived
* from this
*/
public CstEnumRef(CstNat nat) {
@@ -56,7 +56,7 @@
/**
* Get a {@link CstFieldRef} that corresponds with this instance.
*
- * @return non-null; the corresponding field reference
+ * @return {@code non-null;} the corresponding field reference
*/
public CstFieldRef getFieldRef() {
if (fieldRef == null) {
diff --git a/dx/src/com/android/dx/rop/cst/CstFieldRef.java b/dx/src/com/android/dx/rop/cst/CstFieldRef.java
index 306eca9..497531f 100644
--- a/dx/src/com/android/dx/rop/cst/CstFieldRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstFieldRef.java
@@ -19,7 +19,7 @@
import com.android.dx.rop.type.Type;
/**
- * Constants of type <code>CONSTANT_Fieldref_info</code>.
+ * Constants of type {@code CONSTANT_Fieldref_info}.
*/
public final class CstFieldRef extends CstMemberRef {
/**
@@ -27,10 +27,10 @@
* field which should hold the class corresponding to a given
* primitive type. For example, if given {@link Type#INT}, this
* method returns an instance corresponding to the field
- * <code>java.lang.Integer.TYPE</code>.
+ * {@code java.lang.Integer.TYPE}.
*
- * @param primitiveType non-null; the primitive type
- * @return non-null; the corresponding static field
+ * @param primitiveType {@code non-null;} the primitive type
+ * @return {@code non-null;} the corresponding static field
*/
public static CstFieldRef forPrimitiveType(Type primitiveType) {
return new CstFieldRef(CstType.forBoxedPrimitiveType(primitiveType),
@@ -40,8 +40,8 @@
/**
* Constructs an instance.
*
- * @param definingClass non-null; the type of the defining class
- * @param nat non-null; the name-and-type
+ * @param definingClass {@code non-null;} the type of the defining class
+ * @param nat {@code non-null;} the name-and-type
*/
public CstFieldRef(CstType definingClass, CstNat nat) {
super(definingClass, nat);
@@ -56,7 +56,7 @@
/**
* Returns the type of this field.
*
- * @return non-null; the field's type
+ * @return {@code non-null;} the field's type
*/
public Type getType() {
return getNat().getFieldType();
diff --git a/dx/src/com/android/dx/rop/cst/CstFloat.java b/dx/src/com/android/dx/rop/cst/CstFloat.java
index 08b7f76..531a20d 100644
--- a/dx/src/com/android/dx/rop/cst/CstFloat.java
+++ b/dx/src/com/android/dx/rop/cst/CstFloat.java
@@ -20,24 +20,24 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>CONSTANT_Float_info</code>.
+ * Constants of type {@code CONSTANT_Float_info}.
*/
public final class CstFloat
extends CstLiteral32 {
- /** non-null; instance representing <code>0</code> */
+ /** {@code non-null;} instance representing {@code 0} */
public static final CstFloat VALUE_0 = make(Float.floatToIntBits(0.0f));
- /** non-null; instance representing <code>1</code> */
+ /** {@code non-null;} instance representing {@code 1} */
public static final CstFloat VALUE_1 = make(Float.floatToIntBits(1.0f));
- /** non-null; instance representing <code>2</code> */
+ /** {@code non-null;} instance representing {@code 2} */
public static final CstFloat VALUE_2 = make(Float.floatToIntBits(2.0f));
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param bits the <code>float</code> value as <code>int</code> bits
+ * @param bits the {@code float} value as {@code int} bits
*/
public static CstFloat make(int bits) {
/*
@@ -50,7 +50,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param bits the <code>float</code> value as <code>int</code> bits
+ * @param bits the {@code float} value as {@code int} bits
*/
private CstFloat(int bits) {
super(bits);
@@ -81,7 +81,7 @@
}
/**
- * Gets the <code>float</code> value.
+ * Gets the {@code float} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstInteger.java b/dx/src/com/android/dx/rop/cst/CstInteger.java
index d3fafcc..8fae4fa 100644
--- a/dx/src/com/android/dx/rop/cst/CstInteger.java
+++ b/dx/src/com/android/dx/rop/cst/CstInteger.java
@@ -20,40 +20,40 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>CONSTANT_Integer_info</code>.
+ * Constants of type {@code CONSTANT_Integer_info}.
*/
public final class CstInteger
extends CstLiteral32 {
- /** non-null; array of cached instances */
+ /** {@code non-null;} array of cached instances */
private static final CstInteger[] cache = new CstInteger[511];
- /** non-null; instance representing <code>-1</code> */
+ /** {@code non-null;} instance representing {@code -1} */
public static final CstInteger VALUE_M1 = make(-1);
- /** non-null; instance representing <code>0</code> */
+ /** {@code non-null;} instance representing {@code 0} */
public static final CstInteger VALUE_0 = make(0);
- /** non-null; instance representing <code>1</code> */
+ /** {@code non-null;} instance representing {@code 1} */
public static final CstInteger VALUE_1 = make(1);
- /** non-null; instance representing <code>2</code> */
+ /** {@code non-null;} instance representing {@code 2} */
public static final CstInteger VALUE_2 = make(2);
- /** non-null; instance representing <code>3</code> */
+ /** {@code non-null;} instance representing {@code 3} */
public static final CstInteger VALUE_3 = make(3);
- /** non-null; instance representing <code>4</code> */
+ /** {@code non-null;} instance representing {@code 4} */
public static final CstInteger VALUE_4 = make(4);
- /** non-null; instance representing <code>5</code> */
+ /** {@code non-null;} instance representing {@code 5} */
public static final CstInteger VALUE_5 = make(5);
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param value the <code>int</code> value
- * @return non-null; the appropriate instance
+ * @param value the {@code int} value
+ * @return {@code non-null;} the appropriate instance
*/
public static CstInteger make(int value) {
/*
@@ -76,7 +76,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>int</code> value
+ * @param value the {@code int} value
*/
private CstInteger(int value) {
super(value);
@@ -106,7 +106,7 @@
}
/**
- * Gets the <code>int</code> value.
+ * Gets the {@code int} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java b/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java
index f169ec9..55a7599 100644
--- a/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstInterfaceMethodRef.java
@@ -17,12 +17,12 @@
package com.android.dx.rop.cst;
/**
- * Constants of type <code>CONSTANT_InterfaceMethodref_info</code>.
+ * Constants of type {@code CONSTANT_InterfaceMethodref_info}.
*/
public final class CstInterfaceMethodRef
extends CstBaseMethodRef {
/**
- * null-ok; normal {@link CstMethodRef} that corresponds to this
+ * {@code null-ok;} normal {@link CstMethodRef} that corresponds to this
* instance, if calculated
*/
private CstMethodRef methodRef;
@@ -30,8 +30,8 @@
/**
* Constructs an instance.
*
- * @param definingClass non-null; the type of the defining class
- * @param nat non-null; the name-and-type
+ * @param definingClass {@code non-null;} the type of the defining class
+ * @param nat {@code non-null;} the name-and-type
*/
public CstInterfaceMethodRef(CstType definingClass, CstNat nat) {
super(definingClass, nat);
@@ -48,7 +48,7 @@
* Gets a normal (non-interface) {@link CstMethodRef} that corresponds to
* this instance.
*
- * @return non-null; an appropriate instance
+ * @return {@code non-null;} an appropriate instance
*/
public CstMethodRef toMethodRef() {
if (methodRef == null) {
diff --git a/dx/src/com/android/dx/rop/cst/CstKnownNull.java b/dx/src/com/android/dx/rop/cst/CstKnownNull.java
index 853e57e..09dde1b 100644
--- a/dx/src/com/android/dx/rop/cst/CstKnownNull.java
+++ b/dx/src/com/android/dx/rop/cst/CstKnownNull.java
@@ -19,10 +19,10 @@
import com.android.dx.rop.type.Type;
/**
- * Constant type to represent a known-<code>null</code> value.
+ * Constant type to represent a known-{@code null} value.
*/
public final class CstKnownNull extends CstLiteralBits {
- /** non-null; unique instance of this class */
+ /** {@code non-null;} unique instance of this class */
public static final CstKnownNull THE_ONE = new CstKnownNull();
/**
diff --git a/dx/src/com/android/dx/rop/cst/CstLiteral32.java b/dx/src/com/android/dx/rop/cst/CstLiteral32.java
index 31e96dd..c6e3021 100644
--- a/dx/src/com/android/dx/rop/cst/CstLiteral32.java
+++ b/dx/src/com/android/dx/rop/cst/CstLiteral32.java
@@ -21,13 +21,13 @@
*/
public abstract class CstLiteral32
extends CstLiteralBits {
- /** the value as <code>int</code> bits */
+ /** the value as {@code int} bits */
private final int bits;
/**
* Constructs an instance.
*
- * @param bits the value as <code>int</code> bits
+ * @param bits the value as {@code int} bits
*/
/*package*/ CstLiteral32(int bits) {
this.bits = bits;
diff --git a/dx/src/com/android/dx/rop/cst/CstLiteral64.java b/dx/src/com/android/dx/rop/cst/CstLiteral64.java
index dd7d24d..d0b27d2 100644
--- a/dx/src/com/android/dx/rop/cst/CstLiteral64.java
+++ b/dx/src/com/android/dx/rop/cst/CstLiteral64.java
@@ -21,13 +21,13 @@
*/
public abstract class CstLiteral64
extends CstLiteralBits {
- /** the value as <code>long</code> bits */
+ /** the value as {@code long} bits */
private final long bits;
/**
* Constructs an instance.
*
- * @param bits the value as <code>long</code> bits
+ * @param bits the value as {@code long} bits
*/
/*package*/ CstLiteral64(long bits) {
this.bits = bits;
diff --git a/dx/src/com/android/dx/rop/cst/CstLiteralBits.java b/dx/src/com/android/dx/rop/cst/CstLiteralBits.java
index 98a3f0e..6415487 100644
--- a/dx/src/com/android/dx/rop/cst/CstLiteralBits.java
+++ b/dx/src/com/android/dx/rop/cst/CstLiteralBits.java
@@ -23,18 +23,18 @@
extends TypedConstant {
/**
* Returns whether or not this instance's value may be accurately
- * represented as an <code>int</code>. The rule is that if there
- * is an <code>int</code> which may be sign-extended to yield this
- * instance's value, then this method returns <code>true</code>.
- * Otherwise, it returns <code>false</code>.
+ * represented as an {@code int}. The rule is that if there
+ * is an {@code int} which may be sign-extended to yield this
+ * instance's value, then this method returns {@code true}.
+ * Otherwise, it returns {@code false}.
*
- * @return <code>true</code> iff this instance fits in an <code>int</code>
+ * @return {@code true} iff this instance fits in an {@code int}
*/
public abstract boolean fitsInInt();
/**
- * Gets the value as <code>int</code> bits. If this instance contains
- * more bits than fit in an <code>int</code>, then this returns only
+ * Gets the value as {@code int} bits. If this instance contains
+ * more bits than fit in an {@code int}, then this returns only
* the low-order bits.
*
* @return the bits
@@ -42,8 +42,8 @@
public abstract int getIntBits();
/**
- * Gets the value as <code>long</code> bits. If this instance contains
- * fewer bits than fit in a <code>long</code>, then the result of this
+ * Gets the value as {@code long} bits. If this instance contains
+ * fewer bits than fit in a {@code long}, then the result of this
* method is the sign extension of the value.
*
* @return the bits
diff --git a/dx/src/com/android/dx/rop/cst/CstLong.java b/dx/src/com/android/dx/rop/cst/CstLong.java
index 377eb93..c89a339 100644
--- a/dx/src/com/android/dx/rop/cst/CstLong.java
+++ b/dx/src/com/android/dx/rop/cst/CstLong.java
@@ -20,21 +20,21 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>CONSTANT_Long_info</code>.
+ * Constants of type {@code CONSTANT_Long_info}.
*/
public final class CstLong
extends CstLiteral64 {
- /** non-null; instance representing <code>0</code> */
+ /** {@code non-null;} instance representing {@code 0} */
public static final CstLong VALUE_0 = make(0);
- /** non-null; instance representing <code>1</code> */
+ /** {@code non-null;} instance representing {@code 1} */
public static final CstLong VALUE_1 = make(1);
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param value the <code>long</code> value
+ * @param value the {@code long} value
*/
public static CstLong make(long value) {
/*
@@ -47,7 +47,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>long</code> value
+ * @param value the {@code long} value
*/
private CstLong(long value) {
super(value);
@@ -77,7 +77,7 @@
}
/**
- * Gets the <code>long</code> value.
+ * Gets the {@code long} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstMemberRef.java b/dx/src/com/android/dx/rop/cst/CstMemberRef.java
index dbaad47..bae47c2 100644
--- a/dx/src/com/android/dx/rop/cst/CstMemberRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstMemberRef.java
@@ -17,20 +17,20 @@
package com.android.dx.rop.cst;
/**
- * Constants of type <code>CONSTANT_*ref_info</code>.
+ * Constants of type {@code CONSTANT_*ref_info}.
*/
public abstract class CstMemberRef extends TypedConstant {
- /** non-null; the type of the defining class */
+ /** {@code non-null;} the type of the defining class */
private final CstType definingClass;
- /** non-null; the name-and-type */
+ /** {@code non-null;} the name-and-type */
private final CstNat nat;
/**
* Constructs an instance.
*
- * @param definingClass non-null; the type of the defining class
- * @param nat non-null; the name-and-type
+ * @param definingClass {@code non-null;} the type of the defining class
+ * @param nat {@code non-null;} the name-and-type
*/
/*package*/ CstMemberRef(CstType definingClass, CstNat nat) {
if (definingClass == null) {
@@ -68,7 +68,7 @@
*
* <p><b>Note:</b> This implementation just compares the defining
* class and name, and it is up to subclasses to compare the rest
- * after calling <code>super.compareTo0()</code>.</p>
+ * after calling {@code super.compareTo0()}.</p>
*/
@Override
protected int compareTo0(Constant other) {
@@ -105,7 +105,7 @@
/**
* Gets the type of the defining class.
*
- * @return non-null; the type of defining class
+ * @return {@code non-null;} the type of defining class
*/
public final CstType getDefiningClass() {
return definingClass;
@@ -114,7 +114,7 @@
/**
* Gets the defining name-and-type.
*
- * @return non-null; the name-and-type
+ * @return {@code non-null;} the name-and-type
*/
public final CstNat getNat() {
return nat;
diff --git a/dx/src/com/android/dx/rop/cst/CstMethodRef.java b/dx/src/com/android/dx/rop/cst/CstMethodRef.java
index 766c9bf..77c97e9 100644
--- a/dx/src/com/android/dx/rop/cst/CstMethodRef.java
+++ b/dx/src/com/android/dx/rop/cst/CstMethodRef.java
@@ -17,15 +17,15 @@
package com.android.dx.rop.cst;
/**
- * Constants of type <code>CONSTANT_Methodref_info</code>.
+ * Constants of type {@code CONSTANT_Methodref_info}.
*/
public final class CstMethodRef
extends CstBaseMethodRef {
/**
* Constructs an instance.
*
- * @param definingClass non-null; the type of the defining class
- * @param nat non-null; the name-and-type
+ * @param definingClass {@code non-null;} the type of the defining class
+ * @param nat {@code non-null;} the name-and-type
*/
public CstMethodRef(CstType definingClass, CstNat nat) {
super(definingClass, nat);
diff --git a/dx/src/com/android/dx/rop/cst/CstNat.java b/dx/src/com/android/dx/rop/cst/CstNat.java
index 106b599..5270fd2 100644
--- a/dx/src/com/android/dx/rop/cst/CstNat.java
+++ b/dx/src/com/android/dx/rop/cst/CstNat.java
@@ -19,29 +19,29 @@
import com.android.dx.rop.type.Type;
/**
- * Constants of type <code>CONSTANT_NameAndType_info</code>.
+ * Constants of type {@code CONSTANT_NameAndType_info}.
*/
public final class CstNat extends Constant {
/**
- * non-null; the instance for name <code>TYPE</code> and descriptor
- * <code>java.lang.Class</code>, which is useful when dealing with
+ * {@code non-null;} the instance for name {@code TYPE} and descriptor
+ * {@code java.lang.Class}, which is useful when dealing with
* wrapped primitives
*/
public static final CstNat PRIMITIVE_TYPE_NAT =
new CstNat(new CstUtf8("TYPE"),
new CstUtf8("Ljava/lang/Class;"));
- /** non-null; the name */
+ /** {@code non-null;} the name */
private final CstUtf8 name;
- /** non-null; the descriptor (type) */
+ /** {@code non-null;} the descriptor (type) */
private final CstUtf8 descriptor;
/**
* Constructs an instance.
*
- * @param name non-null; the name
- * @param descriptor non-null; the descriptor
+ * @param name {@code non-null;} the name
+ * @param descriptor {@code non-null;} the descriptor
*/
public CstNat(CstUtf8 name, CstUtf8 descriptor) {
if (name == null) {
@@ -108,7 +108,7 @@
/**
* Gets the name.
*
- * @return non-null; the name
+ * @return {@code non-null;} the name
*/
public CstUtf8 getName() {
return name;
@@ -117,7 +117,7 @@
/**
* Gets the descriptor.
*
- * @return non-null; the descriptor
+ * @return {@code non-null;} the descriptor
*/
public CstUtf8 getDescriptor() {
return descriptor;
@@ -127,7 +127,7 @@
* Returns an unadorned but human-readable version of the name-and-type
* value.
*
- * @return non-null; the human form
+ * @return {@code non-null;} the human form
*/
public String toHuman() {
return name.toHuman() + ':' + descriptor.toHuman();
@@ -138,7 +138,7 @@
* This method is only valid to call if the descriptor in fact describes
* a field (and not a method).
*
- * @return non-null; the field type
+ * @return {@code non-null;} the field type
*/
public Type getFieldType() {
return Type.intern(descriptor.getString());
@@ -147,9 +147,9 @@
/**
* Gets whether this instance has the name of a standard instance
* initialization method. This is just a convenient shorthand for
- * <code>getName().getString().equals("<init>")</code>.
+ * {@code getName().getString().equals("<init>")}.
*
- * @return <code>true</code> iff this is a reference to an
+ * @return {@code true} iff this is a reference to an
* instance initialization method
*/
public final boolean isInstanceInit() {
@@ -159,9 +159,9 @@
/**
* Gets whether this instance has the name of a standard class
* initialization method. This is just a convenient shorthand for
- * <code>getName().getString().equals("<clinit>")</code>.
+ * {@code getName().getString().equals("<clinit>")}.
*
- * @return <code>true</code> iff this is a reference to an
+ * @return {@code true} iff this is a reference to an
* instance initialization method
*/
public final boolean isClassInit() {
diff --git a/dx/src/com/android/dx/rop/cst/CstShort.java b/dx/src/com/android/dx/rop/cst/CstShort.java
index 3804254..4ac2f68 100644
--- a/dx/src/com/android/dx/rop/cst/CstShort.java
+++ b/dx/src/com/android/dx/rop/cst/CstShort.java
@@ -20,31 +20,31 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>short</code>.
+ * Constants of type {@code short}.
*/
public final class CstShort
extends CstLiteral32 {
- /** non-null; the value <code>0</code> as an instance of this class */
+ /** {@code non-null;} the value {@code 0} as an instance of this class */
public static final CstShort VALUE_0 = make((short) 0);
/**
* Makes an instance for the given value. This may (but does not
* necessarily) return an already-allocated instance.
*
- * @param value the <code>short</code> value
- * @return non-null; the appropriate instance
+ * @param value the {@code short} value
+ * @return {@code non-null;} the appropriate instance
*/
public static CstShort make(short value) {
return new CstShort(value);
}
/**
- * Makes an instance for the given <code>int</code> value. This
+ * Makes an instance for the given {@code int} value. This
* may (but does not necessarily) return an already-allocated
* instance.
*
- * @param value the value, which must be in range for a <code>short</code>
- * @return non-null; the appropriate instance
+ * @param value the value, which must be in range for a {@code short}
+ * @return {@code non-null;} the appropriate instance
*/
public static CstShort make(int value) {
short cast = (short) value;
@@ -60,7 +60,7 @@
/**
* Constructs an instance. This constructor is private; use {@link #make}.
*
- * @param value the <code>short</code> value
+ * @param value the {@code short} value
*/
private CstShort(short value) {
super(value);
@@ -90,7 +90,7 @@
}
/**
- * Gets the <code>short</code> value.
+ * Gets the {@code short} value.
*
* @return the value
*/
diff --git a/dx/src/com/android/dx/rop/cst/CstString.java b/dx/src/com/android/dx/rop/cst/CstString.java
index 89a4c8b..ce00f52 100644
--- a/dx/src/com/android/dx/rop/cst/CstString.java
+++ b/dx/src/com/android/dx/rop/cst/CstString.java
@@ -19,17 +19,17 @@
import com.android.dx.rop.type.Type;
/**
- * Constants of type <code>CONSTANT_String_info</code>.
+ * Constants of type {@code CONSTANT_String_info}.
*/
public final class CstString
extends TypedConstant {
- /** non-null; the string value */
+ /** {@code non-null;} the string value */
private final CstUtf8 string;
/**
* Constructs an instance.
*
- * @param string non-null; the string value
+ * @param string {@code non-null;} the string value
*/
public CstString(CstUtf8 string) {
if (string == null) {
@@ -42,7 +42,7 @@
/**
* Constructs an instance.
*
- * @param string non-null; the string value
+ * @param string {@code non-null;} the string value
*/
public CstString(String string) {
this(new CstUtf8(string));
@@ -101,7 +101,7 @@
/**
* Gets the string value.
*
- * @return non-null; the string value
+ * @return {@code non-null;} the string value
*/
public CstUtf8 getString() {
return string;
diff --git a/dx/src/com/android/dx/rop/cst/CstType.java b/dx/src/com/android/dx/rop/cst/CstType.java
index 02df28d..6dc9867 100644
--- a/dx/src/com/android/dx/rop/cst/CstType.java
+++ b/dx/src/com/android/dx/rop/cst/CstType.java
@@ -24,69 +24,69 @@
* Constants that represent an arbitrary type (reference or primitive).
*/
public final class CstType extends TypedConstant {
- /** non-null; map of interned types */
+ /** {@code non-null;} map of interned types */
private static final HashMap<Type, CstType> interns =
new HashMap<Type, CstType>(100);
- /** non-null; instance corresponding to the class <code>Object</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Object} */
public static final CstType OBJECT = intern(Type.OBJECT);
- /** non-null; instance corresponding to the class <code>Boolean</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Boolean} */
public static final CstType BOOLEAN = intern(Type.BOOLEAN_CLASS);
- /** non-null; instance corresponding to the class <code>Byte</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Byte} */
public static final CstType BYTE = intern(Type.BYTE_CLASS);
- /** non-null; instance corresponding to the class <code>Character</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Character} */
public static final CstType CHARACTER = intern(Type.CHARACTER_CLASS);
- /** non-null; instance corresponding to the class <code>Double</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Double} */
public static final CstType DOUBLE = intern(Type.DOUBLE_CLASS);
- /** non-null; instance corresponding to the class <code>Float</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Float} */
public static final CstType FLOAT = intern(Type.FLOAT_CLASS);
- /** non-null; instance corresponding to the class <code>Long</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Long} */
public static final CstType LONG = intern(Type.LONG_CLASS);
- /** non-null; instance corresponding to the class <code>Integer</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Integer} */
public static final CstType INTEGER = intern(Type.INTEGER_CLASS);
- /** non-null; instance corresponding to the class <code>Short</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Short} */
public static final CstType SHORT = intern(Type.SHORT_CLASS);
- /** non-null; instance corresponding to the class <code>Void</code> */
+ /** {@code non-null;} instance corresponding to the class {@code Void} */
public static final CstType VOID = intern(Type.VOID_CLASS);
- /** non-null; instance corresponding to the type <code>boolean[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code boolean[]} */
public static final CstType BOOLEAN_ARRAY = intern(Type.BOOLEAN_ARRAY);
- /** non-null; instance corresponding to the type <code>byte[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code byte[]} */
public static final CstType BYTE_ARRAY = intern(Type.BYTE_ARRAY);
- /** non-null; instance corresponding to the type <code>char[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code char[]} */
public static final CstType CHAR_ARRAY = intern(Type.CHAR_ARRAY);
- /** non-null; instance corresponding to the type <code>double[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code double[]} */
public static final CstType DOUBLE_ARRAY = intern(Type.DOUBLE_ARRAY);
- /** non-null; instance corresponding to the type <code>float[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code float[]} */
public static final CstType FLOAT_ARRAY = intern(Type.FLOAT_ARRAY);
- /** non-null; instance corresponding to the type <code>long[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code long[]} */
public static final CstType LONG_ARRAY = intern(Type.LONG_ARRAY);
- /** non-null; instance corresponding to the type <code>int[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code int[]} */
public static final CstType INT_ARRAY = intern(Type.INT_ARRAY);
- /** non-null; instance corresponding to the type <code>short[]</code> */
+ /** {@code non-null;} instance corresponding to the type {@code short[]} */
public static final CstType SHORT_ARRAY = intern(Type.SHORT_ARRAY);
- /** non-null; the underlying type */
+ /** {@code non-null;} the underlying type */
private final Type type;
/**
- * null-ok; the type descriptor corresponding to this instance, if
+ * {@code null-ok;} the type descriptor corresponding to this instance, if
* calculated
*/
private CstUtf8 descriptor;
@@ -95,10 +95,10 @@
* Returns an instance of this class that represents the wrapper
* class corresponding to a given primitive type. For example, if
* given {@link Type#INT}, this method returns the class reference
- * <code>java.lang.Integer</code>.
+ * {@code java.lang.Integer}.
*
- * @param primitiveType non-null; the primitive type
- * @return non-null; the corresponding wrapper class
+ * @param primitiveType {@code non-null;} the primitive type
+ * @return {@code non-null;} the corresponding wrapper class
*/
public static CstType forBoxedPrimitiveType(Type primitiveType) {
switch (primitiveType.getBasicType()) {
@@ -119,8 +119,8 @@
/**
* Returns an interned instance of this class for the given type.
*
- * @param type non-null; the underlying type
- * @return non-null; an appropriately-constructed instance
+ * @param type {@code non-null;} the underlying type
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static CstType intern(Type type) {
CstType cst = interns.get(type);
@@ -136,7 +136,7 @@
/**
* Constructs an instance.
*
- * @param type non-null; the underlying type
+ * @param type {@code non-null;} the underlying type
*/
public CstType(Type type) {
if (type == null) {
@@ -207,9 +207,9 @@
/**
* Gets the underlying type (as opposed to the type corresponding
* to this instance as a constant, which is always
- * <code>Class</code>).
+ * {@code Class}).
*
- * @return non-null; the type corresponding to the name
+ * @return {@code non-null;} the type corresponding to the name
*/
public Type getClassType() {
return type;
@@ -218,7 +218,7 @@
/**
* Gets the type descriptor for this instance.
*
- * @return non-null; the descriptor
+ * @return {@code non-null;} the descriptor
*/
public CstUtf8 getDescriptor() {
if (descriptor == null) {
diff --git a/dx/src/com/android/dx/rop/cst/CstUtf8.java b/dx/src/com/android/dx/rop/cst/CstUtf8.java
index f0ca5f5..2c7a1df 100644
--- a/dx/src/com/android/dx/rop/cst/CstUtf8.java
+++ b/dx/src/com/android/dx/rop/cst/CstUtf8.java
@@ -20,19 +20,19 @@
import com.android.dx.util.Hex;
/**
- * Constants of type <code>CONSTANT_Utf8_info</code>.
+ * Constants of type {@code CONSTANT_Utf8_info}.
*/
public final class CstUtf8 extends Constant {
/**
- * non-null; instance representing <code>""</code>, that is, the
+ * {@code non-null;} instance representing {@code ""}, that is, the
* empty string
*/
public static final CstUtf8 EMPTY_STRING = new CstUtf8("");
- /** non-null; the UTF-8 value as a string */
+ /** {@code non-null;} the UTF-8 value as a string */
private final String string;
- /** non-null; the UTF-8 value as bytes */
+ /** {@code non-null;} the UTF-8 value as bytes */
private final ByteArray bytes;
/**
@@ -40,8 +40,8 @@
* differs from normal UTF-8 in the handling of character '\0' and
* surrogate pairs.
*
- * @param string non-null; the string to convert
- * @return non-null; the UTF-8 bytes for it
+ * @param string {@code non-null;} the string to convert
+ * @return {@code non-null;} the UTF-8 bytes for it
*/
public static byte[] stringToUtf8Bytes(String string) {
int len = string.length();
@@ -73,8 +73,8 @@
/**
* Converts an array of UTF-8 bytes into a string.
*
- * @param bytes non-null; the bytes to convert
- * @return non-null; the converted string
+ * @param bytes {@code non-null;} the bytes to convert
+ * @return {@code non-null;} the converted string
*/
public static String utf8BytesToString(ByteArray bytes) {
int length = bytes.size();
@@ -173,9 +173,9 @@
}
/**
- * Constructs an instance from a <code>String</code>.
+ * Constructs an instance from a {@code String}.
*
- * @param string non-null; the UTF-8 value as a string
+ * @param string {@code non-null;} the UTF-8 value as a string
*/
public CstUtf8(String string) {
if (string == null) {
@@ -189,7 +189,7 @@
/**
* Constructs an instance from some UTF-8 bytes.
*
- * @param bytes non-null; array of the UTF-8 bytes
+ * @param bytes {@code non-null;} array of the UTF-8 bytes
*/
public CstUtf8(ByteArray bytes) {
if (bytes == null) {
@@ -299,7 +299,7 @@
* Gets the value as a human-oriented string, surrounded by double
* quotes.
*
- * @return non-null; the quoted string
+ * @return {@code non-null;} the quoted string
*/
public String toQuoted() {
return '\"' + toHuman() + '\"';
@@ -310,8 +310,8 @@
* quotes, but ellipsizes the result if it is longer than the given
* maximum length
*
- * @param maxLength >= 5; the maximum length of the string to return
- * @return non-null; the quoted string
+ * @param maxLength {@code >= 5;} the maximum length of the string to return
+ * @return {@code non-null;} the quoted string
*/
public String toQuoted(int maxLength) {
String string = toHuman();
@@ -332,7 +332,7 @@
* Gets the UTF-8 value as a string.
* The returned string is always already interned.
*
- * @return non-null; the UTF-8 value as a string
+ * @return {@code non-null;} the UTF-8 value as a string
*/
public String getString() {
return string;
@@ -341,7 +341,7 @@
/**
* Gets the UTF-8 value as UTF-8 encoded bytes.
*
- * @return non-null; an array of the UTF-8 bytes
+ * @return {@code non-null;} an array of the UTF-8 bytes
*/
public ByteArray getBytes() {
return bytes;
@@ -351,7 +351,7 @@
* Gets the size of this instance as UTF-8 code points. That is,
* get the number of bytes in the UTF-8 encoding of this instance.
*
- * @return >= 0; the UTF-8 size
+ * @return {@code >= 0;} the UTF-8 size
*/
public int getUtf8Size() {
return bytes.size();
@@ -360,10 +360,10 @@
/**
* Gets the size of this instance as UTF-16 code points. That is,
* get the number of 16-bit chars in the UTF-16 encoding of this
- * instance. This is the same as the <code>length</code> of the
- * Java <code>String</code> representation of this instance.
+ * instance. This is the same as the {@code length} of the
+ * Java {@code String} representation of this instance.
*
- * @return >= 0; the UTF-16 size
+ * @return {@code >= 0;} the UTF-16 size
*/
public int getUtf16Size() {
return string.length();
diff --git a/dx/src/com/android/dx/rop/cst/StdConstantPool.java b/dx/src/com/android/dx/rop/cst/StdConstantPool.java
index 6979102..82c3ab7 100644
--- a/dx/src/com/android/dx/rop/cst/StdConstantPool.java
+++ b/dx/src/com/android/dx/rop/cst/StdConstantPool.java
@@ -26,16 +26,16 @@
*/
public final class StdConstantPool
extends MutabilityControl implements ConstantPool {
- /** non-null; array of entries */
+ /** {@code non-null;} array of entries */
private final Constant[] entries;
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the pool; this corresponds to the
- * class file field <code>constant_pool_count</code>, and is in fact
+ * class file field {@code constant_pool_count}, and is in fact
* always at least one more than the actual size of the constant pool,
- * as element <code>0</code> is always invalid.
+ * as element {@code 0} is always invalid.
*/
public StdConstantPool(int size) {
super(size > 1);
@@ -90,8 +90,8 @@
/**
* Sets the entry at the given index.
*
- * @param n >= 1, < size(); which entry
- * @param cst null-ok; the constant to store
+ * @param n {@code >= 1, < size();} which entry
+ * @param cst {@code null-ok;} the constant to store
*/
public void set(int n, Constant cst) {
throwIfImmutable();
diff --git a/dx/src/com/android/dx/rop/cst/TypedConstant.java b/dx/src/com/android/dx/rop/cst/TypedConstant.java
index 54472b0..823d9c4 100644
--- a/dx/src/com/android/dx/rop/cst/TypedConstant.java
+++ b/dx/src/com/android/dx/rop/cst/TypedConstant.java
@@ -26,7 +26,7 @@
/**
* {@inheritDoc}
*
- * This implentation always returns <code>this</code>.
+ * This implentation always returns {@code this}.
*/
public final TypeBearer getFrameType() {
return this;
diff --git a/dx/src/com/android/dx/rop/cst/Zeroes.java b/dx/src/com/android/dx/rop/cst/Zeroes.java
index 3379b6c..8bed657 100644
--- a/dx/src/com/android/dx/rop/cst/Zeroes.java
+++ b/dx/src/com/android/dx/rop/cst/Zeroes.java
@@ -30,10 +30,10 @@
}
/**
- * Gets the "zero" (or <code>null</code>) value for the given type.
+ * Gets the "zero" (or {@code null}) value for the given type.
*
- * @param type non-null; the type in question
- * @return non-null; its "zero" value
+ * @param type {@code non-null;} the type in question
+ * @return {@code non-null;} its "zero" value
*/
public static Constant zeroFor(Type type) {
switch (type.getBasicType()) {
diff --git a/dx/src/com/android/dx/rop/package-info.java b/dx/src/com/android/dx/rop/package-info.java
index 97fe9de..aaf21ee 100644
--- a/dx/src/com/android/dx/rop/package-info.java
+++ b/dx/src/com/android/dx/rop/package-info.java
@@ -19,7 +19,7 @@
/**
* <h1>An Introduction to Rop Form</h1>
*
- * This package contains classes associated with dx's <code>Rop</code>
+ * This package contains classes associated with dx's {@code Rop}
* intermediate form.<p>
*
* The Rop form is intended to represent the instructions and the control-flow
@@ -33,16 +33,16 @@
* <li> {@link BasicBlock} and its per-method container, {@link BasicBlockList},
* the representation of control flow elements.
* <li> {@link Insn} and its subclasses along with its per-basic block
- * container {@link InsnList}. <code>Insn</code> instances represent
+ * container {@link InsnList}. {@code Insn} instances represent
* individual instructions in the abstract register machine.
* <li> {@link RegisterSpec} and its container {@link RegisterSpecList}. A
* register spec encodes register number, register width, type information,
* and potentially local variable information as well for instruction sources
* and results.
* <li> {@link Rop} instances represent opcodes in the abstract machine. Many
- * <code>Rop</code> instances are singletons defined in static fields in
+ * {@code Rop} instances are singletons defined in static fields in
* {@link Rops}. The rest are constructed dynamically using static methods
- * in <code>Rops</code>
+ * in {@code Rops}
* <li> {@link RegOps} lists numeric constants for the opcodes
* <li> {@link Constant} and its subclasses represent constant data values
* that opcodes may refer to.
@@ -62,8 +62,8 @@
* bytecode. Blocks that don't originate directly from source bytecode have
* labels generated for them in a mostly arbitrary order.<p>
*
- * Blocks are referred to by their label, for the most part, because <code>
- * BasicBlock</code> instances are immutable and thus any modification to
+ * Blocks are referred to by their label, for the most part, because
+ * {@code BasicBlock} instances are immutable and thus any modification to
* the control flow graph or the instruction list results in replacement
* instances (with identical labels) being created.<p>
*
@@ -105,7 +105,7 @@
* instruction where a catch block exists inside the current method for that
* exception class. Since the only possible path is the exception path, only
* the exception path (which cannot be a primary successor) is a successor.
- * An example of this is shown in <code>dx/tests/092-ssa-cfg-edge-cases</code>.
+ * An example of this is shown in {@code dx/tests/092-ssa-cfg-edge-cases}.
*
* <h2>Rop Instructions</h2>
*
@@ -123,18 +123,18 @@
* Rops#MOVE_RESULT move-result} or {@link Rops#MOVE_RESULT_PSEUDO
* move-result-pseudo} instructions at the top of the primary successor block.
*
- * Only a single <code>move-result</code> or <code>move-result-pseudo</code>
+ * Only a single {@code move-result} or {@code move-result-pseudo}
* may exist in any block and it must be exactly the first instruction in the
* block.
*
- * A <code>move-result</code> instruction is used for the results of call-like
- * instructions. If the value produced by a <code>move-result</code> is not
+ * A {@code move-result} instruction is used for the results of call-like
+ * instructions. If the value produced by a {@code move-result} is not
* used by the method, it may be eliminated as dead code.
*
- * A <code>move-result-pseudo</code> instruction is used for the results of
+ * A {@code move-result-pseudo} instruction is used for the results of
* non-call-like throwing instructions. It may never be considered dead code
* since the final dex instruction will always indicate a result register.
- * If a required <code>move-result-pseudo</code> instruction is not found
+ * If a required {@code move-result-pseudo} instruction is not found
* during conversion to dex bytecode, an exception will be thrown.
*
* <h3>move-exception</h3>
@@ -148,25 +148,25 @@
* <h3>move-param</h3>
*
* A {@link RegOps.MOVE_PARAM move-param} instruction represents a method
- * parameter. Every <code>move-param</code> instruction is a
+ * parameter. Every {@code move-param} instruction is a
* {@link PlainCstInsn}. The index of the method parameter they refer to is
* carried as the {@link CstInteger integer constant} associated with the
* instruction.
*
- * Any number of <code>move-param</code> instructions referring to the same
+ * Any number of {@code move-param} instructions referring to the same
* parameter index may be included in a method's instruction lists. They
* have no restrictions on placement beyond those of any other
* {@link Rop.BRANCH_NONE} instruction. Note that the SSA optimizer arranges the
* parameter assignments to align with the dex bytecode calling conventions.
* With parameter assignments so arranged, the
- * {@link com.android.dx.dex.code.RopTranslator} sees Rop <code>move-param</code>
+ * {@link com.android.dx.dex.code.RopTranslator} sees Rop {@code move-param}
* instructions as unnecessary in dex form and eliminates them.
*
* <h3>mark-local</h3>
*
* A {@link RegOps.MARK_LOCAL mark-local} instruction indicates that a local
* variable becomes live in a specified register specified register for the
- * purposes of debug information. A <code>mark-local</code> instruction has
+ * purposes of debug information. A {@code mark-local} instruction has
* a single source (the register which will now be considered a local variable)
* and no results. The instruction has no side effect.<p>
*
@@ -179,23 +179,22 @@
* an assignment occurring. A common example of this is occurs in the Rop
* representation of the following code:<p>
*
- * <code>
+ * <pre>
* try {
* Object foo = null;
* foo = new Object();
- * } catch (Throwable ex) {
- * }
- * </code>
+ * } catch (Throwable ex) { }
+ * </pre>
*
- * An object's initialization occurs in two steps. First, a <code>new-instance
- * </code> instruction is executed, whose result is stored in a register.
- * However, that register can not yet be considered to contain "foo". That's
- * because the instance's constructor method must be called via an
- * <code>invoke</code> instruction. The constructor method, however, may
+ * An object's initialization occurs in two steps. First, a
+ * {@code new-instance} instruction is executed, whose result is stored in a
+ * register. However, that register can not yet be considered to contain
+ * "foo". That's because the instance's constructor method must be called
+ * via an {@code invoke} instruction. The constructor method, however, may
* throw an exception. And if an exception occurs, then "foo" should remain
- * null. So "foo" becomes the value of the result of the <code>new-instance
- * </code> instruction after the (void) constructor method is invoked and
- * returns successfully. In such a case, a <code>mark-local</code> will
+ * null. So "foo" becomes the value of the result of the {@code new-instance}
+ * instruction after the (void) constructor method is invoked and
+ * returns successfully. In such a case, a {@code mark-local} will
* typically occur at the beginning of the primary successor block following
* the invocation to the constructor.
*/
diff --git a/dx/src/com/android/dx/rop/type/Prototype.java b/dx/src/com/android/dx/rop/type/Prototype.java
index a6ee742..7e6ab59 100644
--- a/dx/src/com/android/dx/rop/type/Prototype.java
+++ b/dx/src/com/android/dx/rop/type/Prototype.java
@@ -21,23 +21,23 @@
/**
* Representation of a method decriptor. Instances of this class are
* generally interned and may be usefully compared with each other
- * using <code>==</code>.
+ * using {@code ==}.
*/
public final class Prototype implements Comparable<Prototype> {
- /** non-null; intern table mapping string descriptors to instances */
+ /** {@code non-null;} intern table mapping string descriptors to instances */
private static final HashMap<String, Prototype> internTable =
new HashMap<String, Prototype>(500);
- /** non-null; method descriptor */
+ /** {@code non-null;} method descriptor */
private final String descriptor;
- /** non-null; return type */
+ /** {@code non-null;} return type */
private final Type returnType;
- /** non-null; list of parameter types */
+ /** {@code non-null;} list of parameter types */
private final StdTypeList parameterTypes;
- /** null-ok; list of parameter frame types, if calculated */
+ /** {@code null-ok;} list of parameter frame types, if calculated */
private StdTypeList parameterFrameTypes;
/**
@@ -45,8 +45,8 @@
* given method descriptor. See vmspec-2 sec4.3.3 for details on the
* field descriptor syntax.
*
- * @param descriptor non-null; the descriptor
- * @return non-null; the corresponding instance
+ * @param descriptor {@code non-null;} the descriptor
+ * @return {@code non-null;} the corresponding instance
* @throws IllegalArgumentException thrown if the descriptor has
* invalid syntax
*/
@@ -111,8 +111,8 @@
* that there is a '(' at the start of the descriptor and a
* single ')' somewhere before the end.
*
- * @param descriptor non-null; the descriptor string
- * @return non-null; array large enough to hold all parsed parameter
+ * @param descriptor {@code non-null;} the descriptor string
+ * @return {@code non-null;} array large enough to hold all parsed parameter
* types, but which is likely actually larger than needed
*/
private static Type[] makeParameterArray(String descriptor) {
@@ -153,14 +153,14 @@
/**
* Interns an instance, adding to the descriptor as necessary based
* on the given definer, name, and flags. For example, an init
- * method has an uninitialized object of type <code>definer</code>
+ * method has an uninitialized object of type {@code definer}
* as its first argument.
*
- * @param descriptor non-null; the descriptor string
- * @param definer non-null; class the method is defined on
+ * @param descriptor {@code non-null;} the descriptor string
+ * @param definer {@code non-null;} class the method is defined on
* @param isStatic whether this is a static method
* @param isInit whether this is an init method
- * @return non-null; the interned instance
+ * @return {@code non-null;} the interned instance
*/
public static Prototype intern(String descriptor, Type definer,
boolean isStatic, boolean isInit) {
@@ -179,11 +179,11 @@
/**
* Interns an instance which consists of the given number of
- * <code>int</code>s along with the given return type
+ * {@code int}s along with the given return type
*
- * @param returnType non-null; the return type
- * @param count > 0; the number of elements in the prototype
- * @return non-null; the interned instance
+ * @param returnType {@code non-null;} the return type
+ * @param count {@code > 0;} the number of elements in the prototype
+ * @return {@code non-null;} the interned instance
*/
public static Prototype internInts(Type returnType, int count) {
// Make the descriptor...
@@ -207,7 +207,7 @@
* Constructs an instance. This is a private constructor; use one
* of the public static methods to get instances.
*
- * @param descriptor non-null; the descriptor string
+ * @param descriptor {@code non-null;} the descriptor string
*/
private Prototype(String descriptor, Type returnType,
StdTypeList parameterTypes) {
@@ -304,7 +304,7 @@
/**
* Gets the descriptor string.
*
- * @return non-null; the descriptor
+ * @return {@code non-null;} the descriptor
*/
public String getDescriptor() {
return descriptor;
@@ -313,7 +313,7 @@
/**
* Gets the return type.
*
- * @return non-null; the return type
+ * @return {@code non-null;} the return type
*/
public Type getReturnType() {
return returnType;
@@ -322,7 +322,7 @@
/**
* Gets the list of parameter types.
*
- * @return non-null; the list of parameter types
+ * @return {@code non-null;} the list of parameter types
*/
public StdTypeList getParameterTypes() {
return parameterTypes;
@@ -334,7 +334,7 @@
* "intlike" types (see {@link Type#isIntlike}) are replaced by
* {@link Type#INT}.
*
- * @return non-null; the list of parameter frame types
+ * @return {@code non-null;} the list of parameter frame types
*/
public StdTypeList getParameterFrameTypes() {
if (parameterFrameTypes == null) {
@@ -360,8 +360,8 @@
* except that it has an additional parameter prepended to the original's
* argument list.
*
- * @param param non-null; the new first parameter
- * @return non-null; an appropriately-constructed instance
+ * @param param {@code non-null;} the new first parameter
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Prototype withFirstParameter(Type param) {
String newDesc = "(" + param.getDescriptor() + descriptor.substring(1);
@@ -380,8 +380,8 @@
* there. If a conflicting value is already in the table, then leave it.
* Return the interned value.
*
- * @param desc non-null; instance to make interned
- * @return non-null; the actual interned object
+ * @param desc {@code non-null;} instance to make interned
+ * @return {@code non-null;} the actual interned object
*/
private static Prototype putIntern(Prototype desc) {
synchronized (internTable) {
diff --git a/dx/src/com/android/dx/rop/type/StdTypeList.java b/dx/src/com/android/dx/rop/type/StdTypeList.java
index a4c2d44..a023812 100644
--- a/dx/src/com/android/dx/rop/type/StdTypeList.java
+++ b/dx/src/com/android/dx/rop/type/StdTypeList.java
@@ -23,149 +23,149 @@
*/
public final class StdTypeList
extends FixedSizeList implements TypeList {
- /** non-null; no-element instance */
+ /** {@code non-null;} no-element instance */
public static final StdTypeList EMPTY = new StdTypeList(0);
- /** non-null; the list <code>[int]</code> */
+ /** {@code non-null;} the list {@code [int]} */
public static final StdTypeList INT = StdTypeList.make(Type.INT);
- /** non-null; the list <code>[long]</code> */
+ /** {@code non-null;} the list {@code [long]} */
public static final StdTypeList LONG = StdTypeList.make(Type.LONG);
- /** non-null; the list <code>[float]</code> */
+ /** {@code non-null;} the list {@code [float]} */
public static final StdTypeList FLOAT = StdTypeList.make(Type.FLOAT);
- /** non-null; the list <code>[double]</code> */
+ /** {@code non-null;} the list {@code [double]} */
public static final StdTypeList DOUBLE = StdTypeList.make(Type.DOUBLE);
- /** non-null; the list <code>[Object]</code> */
+ /** {@code non-null;} the list {@code [Object]} */
public static final StdTypeList OBJECT = StdTypeList.make(Type.OBJECT);
- /** non-null; the list <code>[ReturnAddress]</code> */
+ /** {@code non-null;} the list {@code [ReturnAddress]} */
public static final StdTypeList RETURN_ADDRESS
= StdTypeList.make(Type.RETURN_ADDRESS);
- /** non-null; the list <code>[Throwable]</code> */
+ /** {@code non-null;} the list {@code [Throwable]} */
public static final StdTypeList THROWABLE =
StdTypeList.make(Type.THROWABLE);
- /** non-null; the list <code>[int, int]</code> */
+ /** {@code non-null;} the list {@code [int, int]} */
public static final StdTypeList INT_INT =
StdTypeList.make(Type.INT, Type.INT);
- /** non-null; the list <code>[long, long]</code> */
+ /** {@code non-null;} the list {@code [long, long]} */
public static final StdTypeList LONG_LONG =
StdTypeList.make(Type.LONG, Type.LONG);
- /** non-null; the list <code>[float, float]</code> */
+ /** {@code non-null;} the list {@code [float, float]} */
public static final StdTypeList FLOAT_FLOAT =
StdTypeList.make(Type.FLOAT, Type.FLOAT);
- /** non-null; the list <code>[double, double]</code> */
+ /** {@code non-null;} the list {@code [double, double]} */
public static final StdTypeList DOUBLE_DOUBLE =
StdTypeList.make(Type.DOUBLE, Type.DOUBLE);
- /** non-null; the list <code>[Object, Object]</code> */
+ /** {@code non-null;} the list {@code [Object, Object]} */
public static final StdTypeList OBJECT_OBJECT =
StdTypeList.make(Type.OBJECT, Type.OBJECT);
- /** non-null; the list <code>[int, Object]</code> */
+ /** {@code non-null;} the list {@code [int, Object]} */
public static final StdTypeList INT_OBJECT =
StdTypeList.make(Type.INT, Type.OBJECT);
- /** non-null; the list <code>[long, Object]</code> */
+ /** {@code non-null;} the list {@code [long, Object]} */
public static final StdTypeList LONG_OBJECT =
StdTypeList.make(Type.LONG, Type.OBJECT);
- /** non-null; the list <code>[float, Object]</code> */
+ /** {@code non-null;} the list {@code [float, Object]} */
public static final StdTypeList FLOAT_OBJECT =
StdTypeList.make(Type.FLOAT, Type.OBJECT);
- /** non-null; the list <code>[double, Object]</code> */
+ /** {@code non-null;} the list {@code [double, Object]} */
public static final StdTypeList DOUBLE_OBJECT =
StdTypeList.make(Type.DOUBLE, Type.OBJECT);
- /** non-null; the list <code>[long, int]</code> */
+ /** {@code non-null;} the list {@code [long, int]} */
public static final StdTypeList LONG_INT =
StdTypeList.make(Type.LONG, Type.INT);
- /** non-null; the list <code>[int[], int]</code> */
+ /** {@code non-null;} the list {@code [int[], int]} */
public static final StdTypeList INTARR_INT =
StdTypeList.make(Type.INT_ARRAY, Type.INT);
- /** non-null; the list <code>[long[], int]</code> */
+ /** {@code non-null;} the list {@code [long[], int]} */
public static final StdTypeList LONGARR_INT =
StdTypeList.make(Type.LONG_ARRAY, Type.INT);
- /** non-null; the list <code>[float[], int]</code> */
+ /** {@code non-null;} the list {@code [float[], int]} */
public static final StdTypeList FLOATARR_INT =
StdTypeList.make(Type.FLOAT_ARRAY, Type.INT);
- /** non-null; the list <code>[double[], int]</code> */
+ /** {@code non-null;} the list {@code [double[], int]} */
public static final StdTypeList DOUBLEARR_INT =
StdTypeList.make(Type.DOUBLE_ARRAY, Type.INT);
- /** non-null; the list <code>[Object[], int]</code> */
+ /** {@code non-null;} the list {@code [Object[], int]} */
public static final StdTypeList OBJECTARR_INT =
StdTypeList.make(Type.OBJECT_ARRAY, Type.INT);
- /** non-null; the list <code>[boolean[], int]</code> */
+ /** {@code non-null;} the list {@code [boolean[], int]} */
public static final StdTypeList BOOLEANARR_INT =
StdTypeList.make(Type.BOOLEAN_ARRAY, Type.INT);
- /** non-null; the list <code>[byte[], int]</code> */
+ /** {@code non-null;} the list {@code [byte[], int]} */
public static final StdTypeList BYTEARR_INT =
StdTypeList.make(Type.BYTE_ARRAY, Type.INT);
- /** non-null; the list <code>[char[], int]</code> */
+ /** {@code non-null;} the list {@code [char[], int]} */
public static final StdTypeList CHARARR_INT =
StdTypeList.make(Type.CHAR_ARRAY, Type.INT);
- /** non-null; the list <code>[short[], int]</code> */
+ /** {@code non-null;} the list {@code [short[], int]} */
public static final StdTypeList SHORTARR_INT =
StdTypeList.make(Type.SHORT_ARRAY, Type.INT);
- /** non-null; the list <code>[int, int[], int]</code> */
+ /** {@code non-null;} the list {@code [int, int[], int]} */
public static final StdTypeList INT_INTARR_INT =
StdTypeList.make(Type.INT, Type.INT_ARRAY, Type.INT);
- /** non-null; the list <code>[long, long[], int]</code> */
+ /** {@code non-null;} the list {@code [long, long[], int]} */
public static final StdTypeList LONG_LONGARR_INT =
StdTypeList.make(Type.LONG, Type.LONG_ARRAY, Type.INT);
- /** non-null; the list <code>[float, float[], int]</code> */
+ /** {@code non-null;} the list {@code [float, float[], int]} */
public static final StdTypeList FLOAT_FLOATARR_INT =
StdTypeList.make(Type.FLOAT, Type.FLOAT_ARRAY, Type.INT);
- /** non-null; the list <code>[double, double[], int]</code> */
+ /** {@code non-null;} the list {@code [double, double[], int]} */
public static final StdTypeList DOUBLE_DOUBLEARR_INT =
StdTypeList.make(Type.DOUBLE, Type.DOUBLE_ARRAY, Type.INT);
- /** non-null; the list <code>[Object, Object[], int]</code> */
+ /** {@code non-null;} the list {@code [Object, Object[], int]} */
public static final StdTypeList OBJECT_OBJECTARR_INT =
StdTypeList.make(Type.OBJECT, Type.OBJECT_ARRAY, Type.INT);
- /** non-null; the list <code>[int, boolean[], int]</code> */
+ /** {@code non-null;} the list {@code [int, boolean[], int]} */
public static final StdTypeList INT_BOOLEANARR_INT =
StdTypeList.make(Type.INT, Type.BOOLEAN_ARRAY, Type.INT);
- /** non-null; the list <code>[int, byte[], int]</code> */
+ /** {@code non-null;} the list {@code [int, byte[], int]} */
public static final StdTypeList INT_BYTEARR_INT =
StdTypeList.make(Type.INT, Type.BYTE_ARRAY, Type.INT);
- /** non-null; the list <code>[int, char[], int]</code> */
+ /** {@code non-null;} the list {@code [int, char[], int]} */
public static final StdTypeList INT_CHARARR_INT =
StdTypeList.make(Type.INT, Type.CHAR_ARRAY, Type.INT);
- /** non-null; the list <code>[int, short[], int]</code> */
+ /** {@code non-null;} the list {@code [int, short[], int]} */
public static final StdTypeList INT_SHORTARR_INT =
StdTypeList.make(Type.INT, Type.SHORT_ARRAY, Type.INT);
/**
* Makes a single-element instance.
*
- * @param type non-null; the element
- * @return non-null; an appropriately-constructed instance
+ * @param type {@code non-null;} the element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static StdTypeList make(Type type) {
StdTypeList result = new StdTypeList(1);
@@ -176,9 +176,9 @@
/**
* Makes a two-element instance.
*
- * @param type0 non-null; the first element
- * @param type1 non-null; the second element
- * @return non-null; an appropriately-constructed instance
+ * @param type0 {@code non-null;} the first element
+ * @param type1 {@code non-null;} the second element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static StdTypeList make(Type type0, Type type1) {
StdTypeList result = new StdTypeList(2);
@@ -190,10 +190,10 @@
/**
* Makes a three-element instance.
*
- * @param type0 non-null; the first element
- * @param type1 non-null; the second element
- * @param type2 non-null; the third element
- * @return non-null; an appropriately-constructed instance
+ * @param type0 {@code non-null;} the first element
+ * @param type1 {@code non-null;} the second element
+ * @param type2 {@code non-null;} the third element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static StdTypeList make(Type type0, Type type1, Type type2) {
StdTypeList result = new StdTypeList(3);
@@ -206,11 +206,11 @@
/**
* Makes a four-element instance.
*
- * @param type0 non-null; the first element
- * @param type1 non-null; the second element
- * @param type2 non-null; the third element
- * @param type3 non-null; the fourth element
- * @return non-null; an appropriately-constructed instance
+ * @param type0 {@code non-null;} the first element
+ * @param type1 {@code non-null;} the second element
+ * @param type2 {@code non-null;} the third element
+ * @param type3 {@code non-null;} the fourth element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static StdTypeList make(Type type0, Type type1, Type type2,
Type type3) {
@@ -227,8 +227,8 @@
* is a static method so as to work on arbitrary {@link TypeList}
* instances.
*
- * @param list non-null; the list to convert
- * @return non-null; the human form
+ * @param list {@code non-null;} the list to convert
+ * @return {@code non-null;} the human form
*/
public static String toHuman(TypeList list) {
int size = list.size();
@@ -254,8 +254,8 @@
* is a static method so as to work on arbitrary {@link TypeList}
* instances.
*
- * @param list non-null; the list to inspect
- * @return non-null; the hash code
+ * @param list {@code non-null;} the list to inspect
+ * @return {@code non-null;} the hash code
*/
public static int hashContents(TypeList list) {
int size = list.size();
@@ -273,8 +273,8 @@
* is a static method so as to work on arbitrary {@link TypeList}
* instances.
*
- * @param list1 non-null; one list to compare
- * @param list2 non-null; another list to compare
+ * @param list1 {@code non-null;} one list to compare
+ * @param list2 {@code non-null;} another list to compare
* @return whether the two lists contain corresponding equal elements
*/
public static boolean equalContents(TypeList list1, TypeList list2) {
@@ -298,8 +298,8 @@
* is a static method so as to work on arbitrary {@link TypeList}
* instances.
*
- * @param list1 non-null; one list to compare
- * @param list2 non-null; another list to compare
+ * @param list1 {@code non-null;} one list to compare
+ * @param list2 {@code non-null;} another list to compare
* @return the order of the two lists
*/
public static int compareContents(TypeList list1, TypeList list2) {
@@ -324,7 +324,7 @@
}
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -366,10 +366,10 @@
/**
* Gets the indicated element. It is an error to call this with the
* index for an element which was never set; if you do that, this
- * will throw <code>NullPointerException</code>.
+ * will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which element
- * @return non-null; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code non-null;} the indicated element
*/
public Type get(int n) {
return (Type) get0(n);
@@ -378,8 +378,8 @@
/**
* Sets the type at the given index.
*
- * @param n >= 0, < size(); which element
- * @param type non-null; the type to store
+ * @param n {@code >= 0, < size();} which element
+ * @param type {@code non-null;} the type to store
*/
public void set(int n, Type type) {
set0(n, type);
@@ -390,8 +390,8 @@
* except that it has an additional type prepended to the
* original.
*
- * @param type non-null; the new first element
- * @return non-null; an appropriately-constructed instance
+ * @param type {@code non-null;} the new first element
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public StdTypeList withFirst(Type type) {
int sz = size();
diff --git a/dx/src/com/android/dx/rop/type/Type.java b/dx/src/com/android/dx/rop/type/Type.java
index 09ea2e2..64c3c30 100644
--- a/dx/src/com/android/dx/rop/type/Type.java
+++ b/dx/src/com/android/dx/rop/type/Type.java
@@ -24,41 +24,41 @@
* Representation of a value type, such as may appear in a field, in a
* local, on a stack, or in a method descriptor. Instances of this
* class are generally interned and may be usefully compared with each
- * other using <code>==</code>.
+ * other using {@code ==}.
*/
public final class Type implements TypeBearer, Comparable<Type> {
- /** non-null; intern table mapping string descriptors to instances */
+ /** {@code non-null;} intern table mapping string descriptors to instances */
private static final HashMap<String, Type> internTable =
new HashMap<String, Type>(500);
- /** basic type constant for <code>void</code> */
+ /** basic type constant for {@code void} */
public static final int BT_VOID = 0;
- /** basic type constant for <code>boolean</code> */
+ /** basic type constant for {@code boolean} */
public static final int BT_BOOLEAN = 1;
- /** basic type constant for <code>byte</code> */
+ /** basic type constant for {@code byte} */
public static final int BT_BYTE = 2;
- /** basic type constant for <code>char</code> */
+ /** basic type constant for {@code char} */
public static final int BT_CHAR = 3;
- /** basic type constant for <code>double</code> */
+ /** basic type constant for {@code double} */
public static final int BT_DOUBLE = 4;
- /** basic type constant for <code>float</code> */
+ /** basic type constant for {@code float} */
public static final int BT_FLOAT = 5;
- /** basic type constant for <code>int</code> */
+ /** basic type constant for {@code int} */
public static final int BT_INT = 6;
- /** basic type constant for <code>long</code> */
+ /** basic type constant for {@code long} */
public static final int BT_LONG = 7;
- /** basic type constant for <code>short</code> */
+ /** basic type constant for {@code short} */
public static final int BT_SHORT = 8;
- /** basic type constant for <code>Object</code> */
+ /** basic type constant for {@code Object} */
public static final int BT_OBJECT = 9;
/** basic type constant for a return address */
@@ -67,37 +67,37 @@
/** count of basic type constants */
public static final int BT_COUNT = 11;
- /** non-null; instance representing <code>boolean</code> */
+ /** {@code non-null;} instance representing {@code boolean} */
public static final Type BOOLEAN = new Type("Z", BT_BOOLEAN);
- /** non-null; instance representing <code>byte</code> */
+ /** {@code non-null;} instance representing {@code byte} */
public static final Type BYTE = new Type("B", BT_BYTE);
- /** non-null; instance representing <code>char</code> */
+ /** {@code non-null;} instance representing {@code char} */
public static final Type CHAR = new Type("C", BT_CHAR);
- /** non-null; instance representing <code>double</code> */
+ /** {@code non-null;} instance representing {@code double} */
public static final Type DOUBLE = new Type("D", BT_DOUBLE);
- /** non-null; instance representing <code>float</code> */
+ /** {@code non-null;} instance representing {@code float} */
public static final Type FLOAT = new Type("F", BT_FLOAT);
- /** non-null; instance representing <code>int</code> */
+ /** {@code non-null;} instance representing {@code int} */
public static final Type INT = new Type("I", BT_INT);
- /** non-null; instance representing <code>long</code> */
+ /** {@code non-null;} instance representing {@code long} */
public static final Type LONG = new Type("J", BT_LONG);
- /** non-null; instance representing <code>short</code> */
+ /** {@code non-null;} instance representing {@code short} */
public static final Type SHORT = new Type("S", BT_SHORT);
- /** non-null; instance representing <code>void</code> */
+ /** {@code non-null;} instance representing {@code void} */
public static final Type VOID = new Type("V", BT_VOID);
- /** non-null; instance representing a known-<code>null</code> */
+ /** {@code non-null;} instance representing a known-{@code null} */
public static final Type KNOWN_NULL = new Type("<null>", BT_OBJECT);
- /** non-null; instance representing a subroutine return address */
+ /** {@code non-null;} instance representing a subroutine return address */
public static final Type RETURN_ADDRESS = new Type("<addr>", BT_ADDR);
static {
@@ -120,158 +120,158 @@
}
/**
- * non-null; instance representing
- * <code>java.lang.annotation.Annotation</code>
+ * {@code non-null;} instance representing
+ * {@code java.lang.annotation.Annotation}
*/
public static final Type ANNOTATION =
intern("Ljava/lang/annotation/Annotation;");
- /** non-null; instance representing <code>java.lang.Class</code> */
+ /** {@code non-null;} instance representing {@code java.lang.Class} */
public static final Type CLASS = intern("Ljava/lang/Class;");
- /** non-null; instance representing <code>java.lang.Cloneable</code> */
+ /** {@code non-null;} instance representing {@code java.lang.Cloneable} */
public static final Type CLONEABLE = intern("Ljava/lang/Cloneable;");
- /** non-null; instance representing <code>java.lang.Object</code> */
+ /** {@code non-null;} instance representing {@code java.lang.Object} */
public static final Type OBJECT = intern("Ljava/lang/Object;");
- /** non-null; instance representing <code>java.io.Serializable</code> */
+ /** {@code non-null;} instance representing {@code java.io.Serializable} */
public static final Type SERIALIZABLE = intern("Ljava/io/Serializable;");
- /** non-null; instance representing <code>java.lang.String</code> */
+ /** {@code non-null;} instance representing {@code java.lang.String} */
public static final Type STRING = intern("Ljava/lang/String;");
- /** non-null; instance representing <code>java.lang.Throwable</code> */
+ /** {@code non-null;} instance representing {@code java.lang.Throwable} */
public static final Type THROWABLE = intern("Ljava/lang/Throwable;");
/**
- * non-null; instance representing <code>java.lang.Boolean</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Boolean}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type BOOLEAN_CLASS = intern("Ljava/lang/Boolean;");
/**
- * non-null; instance representing <code>java.lang.Byte</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Byte}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type BYTE_CLASS = intern("Ljava/lang/Byte;");
/**
- * non-null; instance representing <code>java.lang.Character</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Character}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type CHARACTER_CLASS = intern("Ljava/lang/Character;");
/**
- * non-null; instance representing <code>java.lang.Double</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Double}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type DOUBLE_CLASS = intern("Ljava/lang/Double;");
/**
- * non-null; instance representing <code>java.lang.Float</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Float}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type FLOAT_CLASS = intern("Ljava/lang/Float;");
/**
- * non-null; instance representing <code>java.lang.Integer</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Integer}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type INTEGER_CLASS = intern("Ljava/lang/Integer;");
/**
- * non-null; instance representing <code>java.lang.Long</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Long}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type LONG_CLASS = intern("Ljava/lang/Long;");
/**
- * non-null; instance representing <code>java.lang.Short</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Short}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type SHORT_CLASS = intern("Ljava/lang/Short;");
/**
- * non-null; instance representing <code>java.lang.Void</code>; the
+ * {@code non-null;} instance representing {@code java.lang.Void}; the
* suffix on the name helps disambiguate this from the instance
* representing a primitive type
*/
public static final Type VOID_CLASS = intern("Ljava/lang/Void;");
- /** non-null; instance representing <code>boolean[]</code> */
+ /** {@code non-null;} instance representing {@code boolean[]} */
public static final Type BOOLEAN_ARRAY = BOOLEAN.getArrayType();
- /** non-null; instance representing <code>byte[]</code> */
+ /** {@code non-null;} instance representing {@code byte[]} */
public static final Type BYTE_ARRAY = BYTE.getArrayType();
- /** non-null; instance representing <code>char[]</code> */
+ /** {@code non-null;} instance representing {@code char[]} */
public static final Type CHAR_ARRAY = CHAR.getArrayType();
- /** non-null; instance representing <code>double[]</code> */
+ /** {@code non-null;} instance representing {@code double[]} */
public static final Type DOUBLE_ARRAY = DOUBLE.getArrayType();
- /** non-null; instance representing <code>float[]</code> */
+ /** {@code non-null;} instance representing {@code float[]} */
public static final Type FLOAT_ARRAY = FLOAT.getArrayType();
- /** non-null; instance representing <code>int[]</code> */
+ /** {@code non-null;} instance representing {@code int[]} */
public static final Type INT_ARRAY = INT.getArrayType();
- /** non-null; instance representing <code>long[]</code> */
+ /** {@code non-null;} instance representing {@code long[]} */
public static final Type LONG_ARRAY = LONG.getArrayType();
- /** non-null; instance representing <code>Object[]</code> */
+ /** {@code non-null;} instance representing {@code Object[]} */
public static final Type OBJECT_ARRAY = OBJECT.getArrayType();
- /** non-null; instance representing <code>short[]</code> */
+ /** {@code non-null;} instance representing {@code short[]} */
public static final Type SHORT_ARRAY = SHORT.getArrayType();
- /** non-null; field descriptor for the type */
+ /** {@code non-null;} field descriptor for the type */
private final String descriptor;
/**
* basic type corresponding to this type; one of the
- * <code>BT_*</code> constants
+ * {@code BT_*} constants
*/
private final int basicType;
/**
- * >= -1; for an uninitialized type, bytecode index that this
- * instance was allocated at; <code>Integer.MAX_VALUE</code> if it
- * was an incoming uninitialized instance; <code>-1</code> if this
+ * {@code >= -1;} for an uninitialized type, bytecode index that this
+ * instance was allocated at; {@code Integer.MAX_VALUE} if it
+ * was an incoming uninitialized instance; {@code -1} if this
* is an <i>inititialized</i> instance
*/
private final int newAt;
/**
- * null-ok; the internal-form class name corresponding to this type, if
- * calculated; only valid if <code>this</code> is a reference type and
+ * {@code null-ok;} the internal-form class name corresponding to this type, if
+ * calculated; only valid if {@code this} is a reference type and
* additionally not a return address
*/
private String className;
/**
- * null-ok; the type corresponding to an array of this type, if
+ * {@code null-ok;} the type corresponding to an array of this type, if
* calculated
*/
private Type arrayType;
/**
- * null-ok; the type corresponding to elements of this type, if
- * calculated; only valid if <code>this</code> is an array type
+ * {@code null-ok;} the type corresponding to elements of this type, if
+ * calculated; only valid if {@code this} is an array type
*/
private Type componentType;
/**
- * null-ok; the type corresponding to the initialized version of
+ * {@code null-ok;} the type corresponding to the initialized version of
* this type, if this instance is in fact an uninitialized type
*/
private Type initializedType;
@@ -280,11 +280,11 @@
* Returns the unique instance corresponding to the type with the
* given descriptor. See vmspec-2 sec4.3.2 for details on the
* field descriptor syntax. This method does <i>not</i> allow
- * <code>"V"</code> (that is, type <code>void</code>) as a valid
+ * {@code "V"} (that is, type {@code void}) as a valid
* descriptor.
*
- * @param descriptor non-null; the descriptor
- * @return non-null; the corresponding instance
+ * @param descriptor {@code non-null;} the descriptor
+ * @return {@code non-null;} the corresponding instance
* @throws IllegalArgumentException thrown if the descriptor has
* invalid syntax
*/
@@ -362,12 +362,12 @@
/**
* Returns the unique instance corresponding to the type with the
- * given descriptor, allowing <code>"V"</code> to return the type
- * for <code>void</code>. Other than that one caveat, this method
+ * given descriptor, allowing {@code "V"} to return the type
+ * for {@code void}. Other than that one caveat, this method
* is identical to {@link #intern}.
*
- * @param descriptor non-null; the descriptor
- * @return non-null; the corresponding instance
+ * @param descriptor {@code non-null;} the descriptor
+ * @return {@code non-null;} the corresponding instance
* @throws IllegalArgumentException thrown if the descriptor has
* invalid syntax
*/
@@ -388,12 +388,12 @@
/**
* Returns the unique instance corresponding to the type of the
* class with the given name. Calling this method is equivalent to
- * calling <code>intern(name)</code> if <code>name</code> begins
- * with <code>"["</code> and calling <code>intern("L" + name + ";")</code>
+ * calling {@code intern(name)} if {@code name} begins
+ * with {@code "["} and calling {@code intern("L" + name + ";")}
* in all other cases.
*
- * @param name non-null; the name of the class whose type is desired
- * @return non-null; the corresponding type
+ * @param name {@code non-null;} the name of the class whose type is desired
+ * @return {@code non-null;} the corresponding type
* @throws IllegalArgumentException thrown if the name has
* invalid syntax
*/
@@ -414,10 +414,10 @@
* This is a private constructor; use one of the public static
* methods to get instances.
*
- * @param descriptor non-null; the field descriptor for the type
+ * @param descriptor {@code non-null;} the field descriptor for the type
* @param basicType basic type corresponding to this type; one of the
- * <code>BT_*</code> constants
- * @param newAt >= -1 allocation bytecode index
+ * {@code BT_*} constants
+ * @param newAt {@code >= -1;} allocation bytecode index
*/
private Type(String descriptor, int basicType, int newAt) {
if (descriptor == null) {
@@ -445,9 +445,9 @@
* This is a private constructor; use one of the public static
* methods to get instances.
*
- * @param descriptor non-null; the field descriptor for the type
+ * @param descriptor {@code non-null;} the field descriptor for the type
* @param basicType basic type corresponding to this type; one of the
- * <code>BT_*</code> constants
+ * {@code BT_*} constants
*/
private Type(String descriptor, int basicType) {
this(descriptor, basicType, -1);
@@ -560,7 +560,7 @@
/**
* Gets the descriptor.
*
- * @return non-null; the descriptor
+ * @return {@code non-null;} the descriptor
*/
public String getDescriptor() {
return descriptor;
@@ -572,7 +572,7 @@
* normal reference type (that is, a reference type and
* additionally not a return address).
*
- * @return non-null; the internal-form class name
+ * @return {@code non-null;} the internal-form class name
*/
public String getClassName() {
if (className == null) {
@@ -592,8 +592,8 @@
}
/**
- * Gets the category. Most instances are category 1. <code>long</code>
- * and <code>double</code> are the only category 2 types.
+ * Gets the category. Most instances are category 1. {@code long}
+ * and {@code double} are the only category 2 types.
*
* @see #isCategory1
* @see #isCategory2
@@ -649,7 +649,7 @@
/**
* Gets whether this type is "intlike." An intlike type is one which, when
* placed on a stack or in a local, is automatically converted to an
- * <code>int</code>.
+ * {@code int}.
*
* @return whether this type is "intlike"
*/
@@ -695,7 +695,7 @@
* Gets whether this type is a normal reference type. A normal
* reference type is a reference type that is not a return
* address. This method is just convenient shorthand for
- * <code>getBasicType() == Type.BT_OBJECT</code>.
+ * {@code getBasicType() == Type.BT_OBJECT}.
*
* @return whether this type is a normal reference type
*/
@@ -705,7 +705,7 @@
/**
* Gets whether this type is an array type. If this method returns
- * <code>true</code>, then it is safe to use {@link #getComponentType}
+ * {@code true}, then it is safe to use {@link #getComponentType}
* to determine the component type.
*
* @return whether this type is an array type
@@ -726,7 +726,7 @@
/**
* Gets whether this type represents an uninitialized instance. An
- * uninitialized instance is what one gets back from the <code>new</code>
+ * uninitialized instance is what one gets back from the {@code new}
* opcode, and remains uninitialized until a valid constructor is
* invoked on it.
*
@@ -738,12 +738,12 @@
/**
* Gets the bytecode index at which this uninitialized type was
- * allocated. This returns <code>Integer.MAX_VALUE</code> if this
+ * allocated. This returns {@code Integer.MAX_VALUE} if this
* type is an uninitialized incoming parameter (i.e., the
- * <code>this</code> of an <code><init></code> method) or
- * <code>-1</code> if this type is in fact <i>initialized</i>.
+ * {@code this} of an {@code <init>} method) or
+ * {@code -1} if this type is in fact <i>initialized</i>.
*
- * @return >= -1; the allocation bytecode index
+ * @return {@code >= -1;} the allocation bytecode index
*/
public int getNewAt() {
return newAt;
@@ -753,7 +753,7 @@
* Gets the initialized type corresponding to this instance, but only
* if this instance is in fact an uninitialized object type.
*
- * @return non-null; the initialized type
+ * @return {@code non-null;} the initialized type
*/
public Type getInitializedType() {
if (initializedType == null) {
@@ -767,7 +767,7 @@
/**
* Gets the type corresponding to an array of this type.
*
- * @return non-null; the array type
+ * @return {@code non-null;} the array type
*/
public Type getArrayType() {
if (arrayType == null) {
@@ -781,7 +781,7 @@
* Gets the component type of this type. This method is only valid on
* array types.
*
- * @return non-null; the component type
+ * @return {@code non-null;} the component type
*/
public Type getComponentType() {
if (componentType == null) {
@@ -800,8 +800,8 @@
* it is indicated as uninitialized and allocated at the given bytecode
* index. This instance must be an initialized object type.
*
- * @param newAt >= 0; the allocation bytecode index
- * @return non-null; an appropriately-constructed instance
+ * @param newAt {@code >= 0;} the allocation bytecode index
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public Type asUninitialized(int newAt) {
if (newAt < 0) {
@@ -838,8 +838,8 @@
* there. If a conflicting value is already in the table, then leave it.
* Return the interned value.
*
- * @param type non-null; instance to make interned
- * @return non-null; the actual interned object
+ * @param type {@code non-null;} instance to make interned
+ * @return {@code non-null;} the actual interned object
*/
private static Type putIntern(Type type) {
synchronized (internTable) {
diff --git a/dx/src/com/android/dx/rop/type/TypeBearer.java b/dx/src/com/android/dx/rop/type/TypeBearer.java
index b9e4ea5..2f2f274 100644
--- a/dx/src/com/android/dx/rop/type/TypeBearer.java
+++ b/dx/src/com/android/dx/rop/type/TypeBearer.java
@@ -26,40 +26,40 @@
/**
* Gets the type associated with this instance.
*
- * @return non-null; the type
+ * @return {@code non-null;} the type
*/
public Type getType();
/**
* Gets the frame type corresponding to this type. This method returns
- * <code>this</code>, except if {@link Type#isIntlike} on the underlying
- * type returns <code>true</code> but the underlying type is not in
+ * {@code this}, except if {@link Type#isIntlike} on the underlying
+ * type returns {@code true} but the underlying type is not in
* fact {@link Type#INT}, in which case this method returns an instance
- * whose underlying type <i>is</i> <code>INT</code>.
+ * whose underlying type <i>is</i> {@code INT}.
*
- * @return non-null; the frame type for this instance
+ * @return {@code non-null;} the frame type for this instance
*/
public TypeBearer getFrameType();
/**
* Gets the basic type corresponding to this instance.
*
- * @return the basic type; one of the <code>BT_*</code> constants
+ * @return the basic type; one of the {@code BT_*} constants
* defined by {@link Type}
*/
public int getBasicType();
/**
* Gets the basic type corresponding to this instance's frame type. This
- * is equivalent to <code>getFrameType().getBasicType()</code>, and
- * is the same as calling <code>getFrameType()</code> unless this
+ * is equivalent to {@code getFrameType().getBasicType()}, and
+ * is the same as calling {@code getFrameType()} unless this
* instance is an int-like type, in which case this method returns
- * <code>BT_INT</code>.
+ * {@code BT_INT}.
*
* @see #getBasicType
* @see #getFrameType
*
- * @return the basic frame type; one of the <code>BT_*</code> constants
+ * @return the basic frame type; one of the {@code BT_*} constants
* defined by {@link Type}
*/
public int getBasicFrameType();
@@ -67,8 +67,8 @@
/**
* Returns whether this instance represents a constant value.
*
- * @return <code>true</code> if this instance represents a constant value
- * and <code>false</code> if not
+ * @return {@code true} if this instance represents a constant value
+ * and {@code false} if not
*/
public boolean isConstant();
}
diff --git a/dx/src/com/android/dx/rop/type/TypeList.java b/dx/src/com/android/dx/rop/type/TypeList.java
index 0944fe2..e82cca7 100644
--- a/dx/src/com/android/dx/rop/type/TypeList.java
+++ b/dx/src/com/android/dx/rop/type/TypeList.java
@@ -22,29 +22,29 @@
public interface TypeList {
/**
* Returns whether this instance is mutable. Note that the
- * <code>TypeList</code> interface itself doesn't provide any
+ * {@code TypeList} interface itself doesn't provide any
* means of mutation, but that doesn't mean that there isn't an
* extra-interface way of mutating an instance.
*
- * @return <code>true</code> if this instance is mutable or
- * <code>false</code> if it is immutable
+ * @return {@code true} if this instance is mutable or
+ * {@code false} if it is immutable
*/
public boolean isMutable();
/**
* Gets the size of this list.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int size();
/**
* Gets the indicated element. It is an error to call this with the
* index for an element which was never set; if you do that, this
- * will throw <code>NullPointerException</code>.
+ * will throw {@code NullPointerException}.
*
- * @param n >= 0, < size(); which element
- * @return non-null; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code non-null;} the indicated element
*/
public Type getType(int n);
@@ -53,7 +53,7 @@
* all the elements of this list. This is a sum of the widths (categories)
* of all the elements.
*
- * @return >= 0; the required number of words
+ * @return {@code >= 0;} the required number of words
*/
public int getWordCount();
@@ -62,8 +62,8 @@
* the given item is appended to the end and it is guaranteed to be
* immutable.
*
- * @param type non-null; item to append
- * @return non-null; an appropriately-constructed instance
+ * @param type {@code non-null;} item to append
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public TypeList withAddedType(Type type);
}
diff --git a/dx/src/com/android/dx/ssa/BasicRegisterMapper.java b/dx/src/com/android/dx/ssa/BasicRegisterMapper.java
index 86fcf81..fdabaab 100644
--- a/dx/src/com/android/dx/ssa/BasicRegisterMapper.java
+++ b/dx/src/com/android/dx/ssa/BasicRegisterMapper.java
@@ -24,17 +24,16 @@
* This class maps one register space into another, with
* each mapping built up individually and added via addMapping()
*/
-public class BasicRegisterMapper
- extends RegisterMapper {
-
+public class BasicRegisterMapper extends RegisterMapper {
/** indexed by old register, containing new name */
private IntList oldToNew;
- /** Running count of used registers in new namespace */
+ /** running count of used registers in new namespace */
private int runningCountNewRegisters;
/**
- * Creates a new OneToOneRegisterMapper
+ * Creates a new OneToOneRegisterMapper.
+ *
* @param countOldRegisters the number of registers in the old name space
*/
public BasicRegisterMapper(int countOldRegisters) {
@@ -70,15 +69,16 @@
/**
* Returns the new-namespace mapping for the specified
- * old-namespace register, or -1 if one exists
+ * old-namespace register, or -1 if one exists.
*
- * @param oldReg >=0; old-namespace register
- * @return new-namespace register or -1 if none.
+ * @param oldReg {@code >= 0;} old-namespace register
+ * @return new-namespace register or -1 if none
*/
public int oldToNew(int oldReg) {
- if(oldReg >= oldToNew.size()) {
+ if (oldReg >= oldToNew.size()) {
return -1;
}
+
return oldToNew.get(oldReg);
}
@@ -88,7 +88,8 @@
sb.append("Old\tNew\n");
int sz = oldToNew.size();
- for(int i = 0; i < sz; i++) {
+
+ for (int i = 0; i < sz; i++) {
sb.append(i);
sb.append('\t');
sb.append(oldToNew.get(i));
@@ -104,12 +105,12 @@
}
/**
- * adds a mapping to the mapper. If oldReg has already been mapped,
+ * Adds a mapping to the mapper. If oldReg has already been mapped,
* overwrites previous mapping with new mapping.
*
- * @param oldReg >=0
- * @param newReg >=0
- * @param category width of reg (1 or 2)
+ * @param oldReg {@code >= 0;} old register
+ * @param newReg {@code >= 0;} new register
+ * @param category {@code 1..2;} width of reg
*/
public void addMapping(int oldReg, int newReg, int category) {
if (oldReg >= oldToNew.size()) {
@@ -118,6 +119,7 @@
oldToNew.add(-1);
}
}
+
oldToNew.set(oldReg, newReg);
if (runningCountNewRegisters < (newReg + category)) {
diff --git a/dx/src/com/android/dx/ssa/ConstCollector.java b/dx/src/com/android/dx/ssa/ConstCollector.java
index afdede7..62f6426 100644
--- a/dx/src/com/android/dx/ssa/ConstCollector.java
+++ b/dx/src/com/android/dx/ssa/ConstCollector.java
@@ -37,7 +37,6 @@
* insn size by about 3%.
*/
public class ConstCollector {
-
/** Maximum constants to collect per method. Puts cap on reg use */
private static final int MAX_COLLECTED_CONSTANTS = 5;
@@ -60,18 +59,20 @@
private final SsaMethod ssaMeth;
/**
- * Process a method.
+ * Processes a method.
*
- * @param ssaMethod non-null; method to process
+ * @param ssaMethod {@code non-null;} method to process
*/
public static void process(SsaMethod ssaMethod) {
- ConstCollector dc;
-
- dc = new ConstCollector(ssaMethod);
-
- dc.run();
+ ConstCollector cc = new ConstCollector(ssaMethod);
+ cc.run();
}
+ /**
+ * Constructs an instance.
+ *
+ * @param ssaMethod {@code non-null;} method to process
+ */
private ConstCollector(SsaMethod ssaMethod) {
this.ssaMeth = ssaMethod;
}
@@ -111,9 +112,7 @@
SsaBasicBlock successorBlock
= entryBlock.getPrimarySuccessor();
- /*
- * Insert a block containing the const insn
- */
+ // Insert a block containing the const insn.
SsaBasicBlock constBlock
= entryBlock.insertNewSuccessor(successorBlock);
@@ -122,18 +121,17 @@
RegisterSpecList.EMPTY,
StdTypeList.EMPTY, cst));
- /*
- * Insert a block containing the move-result-pseudo insn
- */
+ // Insert a block containing the move-result-pseudo insn.
SsaBasicBlock resultBlock
= constBlock.insertNewSuccessor(successorBlock);
+ PlainInsn insn
+ = new PlainInsn(
+ Rops.opMoveResultPseudo(result.getTypeBearer()),
+ SourcePosition.NO_INFO,
+ result, RegisterSpecList.EMPTY);
- resultBlock.addInsnToHead(
- new PlainInsn(
- Rops.opMoveResultPseudo(result.getTypeBearer()),
- SourcePosition.NO_INFO,
- result, RegisterSpecList.EMPTY));
+ resultBlock.addInsnToHead(insn);
}
newRegs.put(cst, result);
@@ -147,7 +145,7 @@
* sorted by most used first. Skips non-collectable consts, such as
* non-string object constants
*
- * @return non-null; list of constants in most-to-least used order
+ * @return {@code non-null;} list of constants in most-to-least used order
*/
private ArrayList<TypedConstant> getConstsSortedByCountUse() {
int regSz = ssaMeth.getRegCount();
@@ -155,12 +153,14 @@
final HashMap<TypedConstant, Integer> countUses
= new HashMap<TypedConstant, Integer>();
- // Each collected constant can be used by just one local
- // (used only if COLLECT_ONE_LOCAL is true)
+ /*
+ * Each collected constant can be used by just one local
+ * (used only if COLLECT_ONE_LOCAL is true).
+ */
final HashSet<TypedConstant> usedByLocal
= new HashSet<TypedConstant>();
- // Count how many times each const value is used
+ // Count how many times each const value is used.
for (int i = 0; i < regSz; i++) {
SsaInsn insn = ssaMeth.getDefinitionForRegister(i);
@@ -177,28 +177,30 @@
if (insn.canThrow()) {
/*
* Don't move anything other than strings -- the risk
- * of changing where an exception is thrown is too high.
+ * of changing where an exception is thrown is too high.
*/
if (!(cst instanceof CstString) || !COLLECT_STRINGS) {
continue;
}
/*
- * We can't move any throwable const whose throw will be caught,
- * so don't count them.
+ * We can't move any throwable const whose throw will be
+ * caught, so don't count them.
*/
if (insn.getBlock().getSuccessors().cardinality() > 1) {
continue;
}
}
- // TODO might be nice to try and figure out which local wins most
- // when collected
+ /*
+ * TODO: Might be nice to try and figure out which local
+ * wins most when collected.
+ */
if (ssaMeth.isRegALocal(result)) {
if (!COLLECT_ONE_LOCAL) {
continue;
} else {
if (usedByLocal.contains(cst)) {
- // Count one local usage only
+ // Count one local usage only.
continue;
} else {
usedByLocal.add(cst);
@@ -214,7 +216,7 @@
}
}
- // Collect constants that have been reused
+ // Collect constants that have been reused.
Iterator<TypedConstant> it = countUses.keySet().iterator();
ArrayList<TypedConstant> constantList = new ArrayList<TypedConstant>();
while (it.hasNext()) {
@@ -225,7 +227,7 @@
}
}
- // Sort by use, with most used at the beginning of the list
+ // Sort by use, with most used at the beginning of the list.
Collections.sort(constantList, new Comparator<Constant>() {
public int compare(Constant a, Constant b) {
int ret;
@@ -245,43 +247,43 @@
return obj == this;
}
});
+
return constantList;
}
/**
* Inserts mark-locals if necessary when changing a register. If
- * the definition of <code>origReg</code> is associated with a local
- * variable, then insert a mark-local for <code>newReg</code> just below
- * it. We expect the definition of <code>origReg</code> to ultimately
+ * the definition of {@code origReg} is associated with a local
+ * variable, then insert a mark-local for {@code newReg} just below
+ * it. We expect the definition of {@code origReg} to ultimately
* be removed by the dead code eliminator
*
- * @param origReg non-null; original register
- * @param newReg non-null; new register that will replace
- * <code>origReg</code>
+ * @param origReg {@code non-null;} original register
+ * @param newReg {@code non-null;} new register that will replace
+ * {@code origReg}
*/
- private void fixLocalAssignment(RegisterSpec origReg, RegisterSpec newReg) {
- for (SsaInsn use: ssaMeth.getUseListForRegister(origReg.getReg())) {
+ private void fixLocalAssignment(RegisterSpec origReg,
+ RegisterSpec newReg) {
+ for (SsaInsn use : ssaMeth.getUseListForRegister(origReg.getReg())) {
RegisterSpec localAssignment = use.getLocalAssignment();
if (localAssignment == null) {
continue;
}
if (use.getResult() == null) {
- // this is a mark-local. it will be updated when all uses
- // are updated
+ /*
+ * This is a mark-local. it will be updated when all uses
+ * are updated.
+ */
continue;
}
LocalItem local = localAssignment.getLocalItem();
- /*
- * un-associate original use
- */
+ // Un-associate original use.
use.setResultLocal(null);
- /*
- * now add a mark-local to the new reg immediately after
- */
+ // Now add a mark-local to the new reg immediately after.
newReg = newReg.withLocalItem(local);
SsaInsn newInsn
@@ -301,15 +303,17 @@
* Updates all uses of various consts to use the values in the newly
* assigned registers.
*
- * @param newRegs non-null; mapping between constant and new reg
- * @param origRegCount >=0; original SSA reg count, not including
+ * @param newRegs {@code non-null;} mapping between constant and new reg
+ * @param origRegCount {@code >=0;} original SSA reg count, not including
* newly added constant regs
*/
private void updateConstUses(HashMap<TypedConstant, RegisterSpec> newRegs,
int origRegCount) {
- // Set of constants associated with a local variable
- // Used only if COLLECT_ONE_LOCAL is true
+ /*
+ * set of constants associated with a local variable; used
+ * only if COLLECT_ONE_LOCAL is true.
+ */
final HashSet<TypedConstant> usedByLocal
= new HashSet<TypedConstant>();
@@ -338,8 +342,11 @@
if (!COLLECT_ONE_LOCAL) {
continue;
} else {
- // TODO if the same local gets the same cst multiple times,
- // it would be nice to reuse the register
+ /*
+ * TODO: If the same local gets the same cst
+ * multiple times, it would be nice to reuse the
+ * register.
+ */
if (usedByLocal.contains(cst)) {
continue;
} else {
@@ -349,7 +356,7 @@
}
}
- // Maps an original const register to the new collected register
+ // maps an original const register to the new collected register
RegisterMapper mapper = new RegisterMapper() {
@Override
public int getNewRegisterCount() {
@@ -359,14 +366,15 @@
@Override
public RegisterSpec map(RegisterSpec registerSpec) {
if (registerSpec.getReg() == origReg.getReg()) {
- return newReg.withLocalItem(registerSpec.getLocalItem());
+ return newReg.withLocalItem(
+ registerSpec.getLocalItem());
}
return registerSpec;
}
};
- for (SsaInsn use: useList[origReg.getReg()]) {
+ for (SsaInsn use : useList[origReg.getReg()]) {
if (use.canThrow()
&& use.getBlock().getSuccessors().cardinality() > 1) {
continue;
diff --git a/dx/src/com/android/dx/ssa/DeadCodeRemover.java b/dx/src/com/android/dx/ssa/DeadCodeRemover.java
index 4fded44..4ee0367 100644
--- a/dx/src/com/android/dx/ssa/DeadCodeRemover.java
+++ b/dx/src/com/android/dx/ssa/DeadCodeRemover.java
@@ -36,55 +36,55 @@
* block to entry block.
*/
public class DeadCodeRemover {
-
/** method we're processing */
- private SsaMethod ssaMeth;
+ private final SsaMethod ssaMeth;
+
/** ssaMeth.getRegCount() */
- private int regCount;
+ private final int regCount;
/**
* indexed by register: whether reg should be examined
* (does it correspond to a no-side-effect insn?)
*/
- private BitSet worklist;
+ private final BitSet worklist;
/** use list indexed by register; modified during operation */
- private ArrayList<SsaInsn>[] useList;
+ private final ArrayList<SsaInsn>[] useList;
/**
* Process a method with the dead-code remver
+ *
* @param ssaMethod method to process
*/
public static void process(SsaMethod ssaMethod) {
- DeadCodeRemover dc;
-
- dc = new DeadCodeRemover(ssaMethod);
-
+ DeadCodeRemover dc = new DeadCodeRemover(ssaMethod);
dc.run();
}
+ /**
+ * Constructs an instance.
+ *
+ * @param ssaMethod method to process
+ */
private DeadCodeRemover(SsaMethod ssaMethod) {
this.ssaMeth = ssaMethod;
regCount = ssaMethod.getRegCount();
-
worklist = new BitSet(regCount);
-
useList = ssaMeth.getUseListCopy();
}
/**
- * Run the dead code remover
+ * Runs the dead code remover.
*/
private void run() {
-
HashSet<SsaInsn> deletedInsns = (HashSet<SsaInsn>) new HashSet();
ssaMeth.forEachInsn(new NoSideEffectVisitor(worklist));
int regV;
- while ( 0 <= (regV = worklist.nextSetBit(0)) ) {
+ while ( 0 <= (regV = worklist.nextSetBit(0)) ) {
worklist.clear(regV);
if (useList[regV].size() == 0
@@ -92,7 +92,7 @@
SsaInsn insnS = ssaMeth.getDefinitionForRegister(regV);
- // This insn has already been deleted
+ // This insn has already been deleted.
if (deletedInsns.contains(insnS)) {
continue;
}
@@ -102,7 +102,7 @@
int sz = sources.size();
for (int i = 0; i < sz; i++) {
- // Delete this insn from all usage lists
+ // Delete this insn from all usage lists.
RegisterSpec source = sources.get(i);
useList[source.getReg()].remove(insnS);
@@ -110,14 +110,14 @@
ssaMeth.getDefinitionForRegister(
source.getReg()))) {
/*
- * Only registers who's definition has no side effect
- * should be added back to the worklist
+ * Only registers whose definition has no side effect
+ * should be added back to the worklist.
*/
worklist.set(source.getReg());
}
}
- // Schedule this insn for later deletion
+ // Schedule this insn for later deletion.
deletedInsns.add(insnS);
}
}
@@ -127,7 +127,8 @@
/**
* Returns true if the only uses of this register form a circle of
- * operations with no side effects
+ * operations with no side effects.
+ *
* @param regV register to examine
* @param set a set of registers that we've already determined
* are only used as sources in operations with no side effect or null
@@ -139,7 +140,7 @@
return true;
}
- for (SsaInsn use: useList[regV]) {
+ for (SsaInsn use : useList[regV]) {
if (hasSideEffect(use)) {
return false;
}
@@ -167,13 +168,14 @@
/**
* Returns true if this insn has a side-effect. Returns true
* if the insn is null for reasons stated in the code block.
- * @param insn null-ok; instruction in question
+ *
+ * @param insn {@code null-ok;} instruction in question
* @return true if it has a side-effect
*/
private static boolean hasSideEffect(SsaInsn insn) {
if (insn == null) {
- /* while false would seem to make more sense here, true
- * prevents us from adding this back to a worklist unnecessarally
+ /* While false would seem to make more sense here, true
+ * prevents us from adding this back to a worklist unnecessarally.
*/
return true;
}
@@ -185,7 +187,7 @@
* A callback class used to build up the initial worklist of
* registers defined by an instruction with no side effect.
*/
- static class NoSideEffectVisitor implements SsaInsn.Visitor {
+ static private class NoSideEffectVisitor implements SsaInsn.Visitor {
BitSet noSideEffectRegs;
/**
@@ -195,13 +197,13 @@
* @param noSideEffectRegs to-build bitset of regs that are
* results of regs with no side effects
*/
- NoSideEffectVisitor(BitSet noSideEffectRegs) {
+ public NoSideEffectVisitor(BitSet noSideEffectRegs) {
this.noSideEffectRegs = noSideEffectRegs;
}
/** {@inheritDoc} */
public void visitMoveInsn (NormalSsaInsn insn) {
- // If we're tracking local vars, some moves have side effects
+ // If we're tracking local vars, some moves have side effects.
if (!hasSideEffect(insn)) {
noSideEffectRegs.set(insn.getResult().getReg());
}
@@ -209,7 +211,7 @@
/** {@inheritDoc} */
public void visitPhiInsn (PhiInsn phi) {
- // If we're tracking local vars, then some phis have side effects
+ // If we're tracking local vars, then some phis have side effects.
if (!hasSideEffect(phi)) {
noSideEffectRegs.set(phi.getResult().getReg());
}
diff --git a/dx/src/com/android/dx/ssa/DomFront.java b/dx/src/com/android/dx/ssa/DomFront.java
index ea089ec..3b42184 100644
--- a/dx/src/com/android/dx/ssa/DomFront.java
+++ b/dx/src/com/android/dx/ssa/DomFront.java
@@ -30,27 +30,37 @@
* Harvey, and Kennedy; transliterated to Java.
*/
public class DomFront {
+ /** local debug flag */
private static boolean DEBUG = false;
+ /** {@code non-null;} method being processed */
private final SsaMethod meth;
+
private final ArrayList<SsaBasicBlock> nodes;
+
private final DomInfo[] domInfos;
/**
* Dominance-frontier information for a single basic block.
*/
public static class DomInfo {
- /** non-null; the dominance frontier set indexed by block index */
- IntSet dominanceFrontiers;
- /** >= 0 after run(); the index of the immediate dominator */
- int idom = -1;
+ /**
+ * {@code null-ok;} the dominance frontier set indexed by
+ * block index
+ */
+ public IntSet dominanceFrontiers;
+
+ /** {@code >= 0 after run();} the index of the immediate dominator */
+ public int idom = -1;
+
/** depth-first traversal index */
- int traversalIndex;
+ public int traversalIndex;
}
/**
* Constructs instance. Call {@link DomFront#run} to process.
- * @param meth
+ *
+ * @param meth {@code non-null;} method to process
*/
public DomFront(SsaMethod meth) {
this.meth = meth;
@@ -67,7 +77,7 @@
/**
* Calculates the dominance frontier information for the method.
*
- * @return non-null; an array of DomInfo structures
+ * @return {@code non-null;} an array of DomInfo structures
*/
public DomInfo[] run() {
int szNodes = nodes.size();
@@ -80,8 +90,7 @@
}
}
- Dominators methDom = new Dominators(domInfos, false);
- methDom.run(meth);
+ Dominators methDom = Dominators.make(meth, domInfos, false);
if (DEBUG) {
for (int i = 0; i < szNodes; i++) {
@@ -164,20 +173,25 @@
SsaBasicBlock nb = nodes.get(b);
DomInfo nbInfo = domInfos[b];
BitSet pred = nb.getPredecessors();
+
if (pred.cardinality() > 1) {
for (int i = pred.nextSetBit(0); i >= 0;
i = pred.nextSetBit(i + 1)) {
- for(int runnerIndex = i
- ; runnerIndex != nbInfo.idom
- ;) {
- // We can stop if we hit a block we already
- // added label to, since we must be at a part
- // of the dom tree we have seen before.
+ for (int runnerIndex = i;
+ runnerIndex != nbInfo.idom; /* empty */) {
+ /*
+ * We can stop if we hit a block we already
+ * added label to, since we must be at a part
+ * of the dom tree we have seen before.
+ */
DomInfo runnerInfo = domInfos[runnerIndex];
- if (runnerInfo.dominanceFrontiers.has(b))
+
+ if (runnerInfo.dominanceFrontiers.has(b)) {
break;
- // "add b to runner's dominance frontier set"
+ }
+
+ // Add b to runner's dominance frontier set.
runnerInfo.dominanceFrontiers.add(b);
runnerIndex = runnerInfo.idom;
}
diff --git a/dx/src/com/android/dx/ssa/Dominators.java b/dx/src/com/android/dx/ssa/Dominators.java
index 1af2cbc..f7d7da6 100644
--- a/dx/src/com/android/dx/ssa/Dominators.java
+++ b/dx/src/com/android/dx/ssa/Dominators.java
@@ -41,31 +41,55 @@
* rank to keep the union-find tree balanced.
*/
public final class Dominators {
- /* postdom is true if we want post dominators. */
- private boolean postdom;
+ /* postdom is true if we want post dominators */
+ private final boolean postdom;
+
+ /* {@code non-null;} method being processed */
+ private final SsaMethod meth;
+
/* Method's basic blocks. */
- private ArrayList<SsaBasicBlock> blocks;
+ private final ArrayList<SsaBasicBlock> blocks;
- private static final class DFSInfo {
- int semidom;
- SsaBasicBlock parent;
- // rep(resentative) is known as "label" in the paper. It is the node
- // that our block's DFS info has been unioned to.
- SsaBasicBlock rep;
- SsaBasicBlock ancestor;
- ArrayList<SsaBasicBlock> bucket;
+ /** indexed by basic block index */
+ private final DFSInfo[] info;
- public DFSInfo() {
- bucket = new ArrayList<SsaBasicBlock>();
- }
+ private final ArrayList<SsaBasicBlock> vertex;
+ /** {@code non-null;} the raw dominator info */
+ private final DomFront.DomInfo domInfos[];
+
+ /**
+ * Constructs an instance.
+ *
+ * @param meth {@code non-null;} method to process
+ * @param domInfos {@code non-null;} the raw dominator info
+ * @param postdom true for postdom information, false for normal dom info
+ */
+ private Dominators(SsaMethod meth, DomFront.DomInfo[] domInfos,
+ boolean postdom) {
+ this.meth = meth;
+ this.domInfos = domInfos;
+ this.postdom = postdom;
+ this.blocks = meth.getBlocks();
+ this.info = new DFSInfo[blocks.size() + 2];
+ this.vertex = new ArrayList<SsaBasicBlock>();
}
- /** Indexed by basic block index */
- private DFSInfo[] info;
- private ArrayList<SsaBasicBlock> vertex;
+ /**
+ * Constructs a fully-initialized instance. (This method exists so as
+ * to avoid calling a large amount of code in the constructor.)
+ *
+ * @param meth {@code non-null;} method to process
+ * @param domInfos {@code non-null;} the raw dominator info
+ * @param postdom true for postdom information, false for normal dom info
+ */
+ public static Dominators make(SsaMethod meth, DomFront.DomInfo[] domInfos,
+ boolean postdom) {
+ Dominators result = new Dominators(meth, domInfos, postdom);
- private DomFront.DomInfo domInfos[];
+ result.run();
+ return result;
+ }
private BitSet getSuccs(SsaBasicBlock block) {
if (postdom) {
@@ -85,6 +109,7 @@
/**
* Performs path compress on the DFS info.
+ *
* @param in Basic block whose DFS info we are path compressing.
*/
private void compress(SsaBasicBlock in) {
@@ -110,7 +135,7 @@
}
worklist.remove(wsize - 1);
- // Update based on ancestor info
+ // Update based on ancestor info.
if (vabbInfo.ancestor == null) {
continue;
}
@@ -124,42 +149,25 @@
}
}
}
+
private SsaBasicBlock eval(SsaBasicBlock v) {
DFSInfo bbInfo = info[v.getIndex()];
+
if (bbInfo.ancestor == null) {
return v;
}
+
compress(v);
return bbInfo.rep;
}
/**
- * Callback for depth-first walk through control flow graph (either
- * from the entry block or the exit block). Records the traversal order
- * in the <code>info</code>list.
+ * Performs dominator/post-dominator calculation for the control
+ * flow graph.
+ *
+ * @param meth {@code non-null;} method to analyze
*/
- private class DfsWalker implements SsaBasicBlock.Visitor {
- int dfsNum = 0;
-
- public void visitBlock (SsaBasicBlock v, SsaBasicBlock parent) {
- DFSInfo bbInfo = new DFSInfo();
- bbInfo.semidom = ++dfsNum;
- bbInfo.rep = v;
- bbInfo.parent = parent;
- vertex.add(v);
- info[v.getIndex()] = bbInfo;
- }
- }
-
- /**
- * Performs dominator/post-dominator calculation for the control flow graph.
- * @param meth Method to analyze
- */
- public void run(SsaMethod meth) {
-
- this.blocks = meth.getBlocks();
- this.info = new DFSInfo[blocks.size() + 2];
- this.vertex = new ArrayList<SsaBasicBlock>();
+ private void run() {
SsaBasicBlock root = postdom
? meth.getExitBlock() : meth.getEntryBlock();
@@ -168,8 +176,10 @@
domInfos[root.getIndex()].idom = root.getIndex();
}
- // First we perform a DFS numbering of the blocks, by numbering the dfs
- // tree roots
+ /*
+ * First we perform a DFS numbering of the blocks, by
+ * numbering the dfs tree roots.
+ */
DfsWalker walker = new DfsWalker();
meth.forEachBlockDepthFirst(postdom, walker);
@@ -184,12 +194,15 @@
BitSet preds = getPreds(w);
for (int j = preds.nextSetBit(0);
- j >= 0;
- j = preds.nextSetBit(j + 1)) {
+ j >= 0;
+ j = preds.nextSetBit(j + 1)) {
SsaBasicBlock predBlock = blocks.get(j);
DFSInfo predInfo = info[predBlock.getIndex()];
- // PredInfo may not exist in case the predecessor is not
- // reachable
+
+ /*
+ * PredInfo may not exist in case the predecessor is
+ * not reachable.
+ */
if (predInfo != null) {
int predSemidom = info[eval(predBlock).getIndex()].semidom;
if (predSemidom < wInfo.semidom) {
@@ -199,11 +212,14 @@
}
info[vertex.get(wInfo.semidom).getIndex()].bucket.add(w);
- // Normally we would call link here, but in our m log n
- // implementation this is equivalent to the following single line
+ /*
+ * Normally we would call link here, but in our O(m log n)
+ * implementation this is equivalent to the following
+ * single line.
+ */
wInfo.ancestor = wInfo.parent;
- // Implicity define idom for each vertex
+ // Implicity define idom for each vertex.
ArrayList<SsaBasicBlock> wParentBucket;
wParentBucket = info[wInfo.parent.getIndex()].bucket;
@@ -219,6 +235,7 @@
}
}
}
+
// Now explicitly define the immediate dominator of each vertex
for (int i = 2; i <= dfsMax; ++i) {
SsaBasicBlock w = vertex.get(i);
@@ -231,10 +248,38 @@
}
/**
- * @param postdom true for postdom information, false for normal dom info
+ * Callback for depth-first walk through control flow graph (either
+ * from the entry block or the exit block). Records the traversal order
+ * in the {@code info}list.
*/
- public Dominators(DomFront.DomInfo[] domInfos, boolean postdom) {
- this.domInfos = domInfos;
- this.postdom = postdom;
+ private class DfsWalker implements SsaBasicBlock.Visitor {
+ private int dfsNum = 0;
+
+ public void visitBlock(SsaBasicBlock v, SsaBasicBlock parent) {
+ DFSInfo bbInfo = new DFSInfo();
+ bbInfo.semidom = ++dfsNum;
+ bbInfo.rep = v;
+ bbInfo.parent = parent;
+ vertex.add(v);
+ info[v.getIndex()] = bbInfo;
+ }
+ }
+
+ private static final class DFSInfo {
+ public int semidom;
+ public SsaBasicBlock parent;
+
+ /**
+ * rep(resentative) is known as "label" in the paper. It is the node
+ * that our block's DFS info has been unioned to.
+ */
+ public SsaBasicBlock rep;
+
+ public SsaBasicBlock ancestor;
+ public ArrayList<SsaBasicBlock> bucket;
+
+ public DFSInfo() {
+ bucket = new ArrayList<SsaBasicBlock>();
+ }
}
}
diff --git a/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java b/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java
index be678dd..392579d 100644
--- a/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java
+++ b/dx/src/com/android/dx/ssa/InterferenceRegisterMapper.java
@@ -33,7 +33,6 @@
* have variable register widths/categories, and the new namespace does.
*/
public class InterferenceRegisterMapper extends BasicRegisterMapper {
-
/**
* Array of interference sets. ArrayList is indexed by new namespace
* and BitIntSet's are indexed by old namespace. The list expands
@@ -45,16 +44,15 @@
*/
private final ArrayList<BitIntSet> newRegInterference;
- /**
- * The interference graph for the old namespace
- */
+ /** the interference graph for the old namespace */
private final InterferenceGraph oldRegInterference;
/**
- * @param countOldRegisters number of registers in old namespace.
+ * Constructs an instance
+ *
+ * @param countOldRegisters number of registers in old namespace
*/
- public InterferenceRegisterMapper(
- InterferenceGraph oldRegInterference,
+ public InterferenceRegisterMapper(InterferenceGraph oldRegInterference,
int countOldRegisters) {
super(countOldRegisters);
@@ -75,8 +73,8 @@
}
/**
- * Checks to see if old namespace reg <code>oldReg</code> interferes
- * with what currently maps to <code>newReg</code>.
+ * Checks to see if old namespace reg {@code oldReg} interferes
+ * with what currently maps to {@code newReg}.
*
* @param oldReg old namespace register
* @param newReg new namespace register
@@ -101,10 +99,10 @@
}
/**
- * Checks to see if old namespace reg <code>oldReg</code> interferes
- * with what currently maps to <code>newReg</code>.
+ * Checks to see if old namespace reg {@code oldReg} interferes
+ * with what currently maps to {@code newReg}.
*
- * @param oldSpec non-null; old namespace register
+ * @param oldSpec {@code non-null;} old namespace register
* @param newReg new namespace register
* @return true if oldReg will interfere with newReg
*/
@@ -115,6 +113,7 @@
/**
* Adds a register's interference set to the interference list,
* growing it if necessary.
+ *
* @param newReg register in new namespace
* @param oldReg register in old namespace
*/
@@ -134,17 +133,17 @@
* pinned to the specified new-namespace reg + category. Takes into
* account the category of the old-namespace registers.
*
- * @param oldSpecs non-null; set of old-namespace regs
- * @param newReg >= 0 new-namespace register
- * @param targetCategory 1 or 2; the number of adjacent new-namespace
+ * @param oldSpecs {@code non-null;} set of old-namespace regs
+ * @param newReg {@code >= 0;} new-namespace register
+ * @param targetCategory {@code 1..2;} the number of adjacent new-namespace
* registers (starting at ropReg) to consider
* @return true if any of the old-namespace register have been mapped
* to the new-namespace register + category
*/
public boolean areAnyPinned(RegisterSpecList oldSpecs,
int newReg, int targetCategory) {
-
int sz = oldSpecs.size();
+
for (int i = 0; i < sz; i++) {
RegisterSpec oldSpec = oldSpecs.get(i);
int r = oldToNew(oldSpec.getReg());
@@ -159,6 +158,7 @@
return true;
}
}
+
return false;
}
}
diff --git a/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java b/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java
index ad10cd7..a70b5bb 100644
--- a/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java
+++ b/dx/src/com/android/dx/ssa/LiteralOpUpgrader.java
@@ -42,7 +42,7 @@
/**
* Process a method.
*
- * @param ssaMethod non-null; method to process
+ * @param ssaMethod {@code non-null;} method to process
*/
public static void process(SsaMethod ssaMethod) {
LiteralOpUpgrader dc;
@@ -135,8 +135,8 @@
*
* TODO move this somewhere else.
*
- * @param insn non-null; an SsaInsn containing a PlainInsn
- * @param newSources non-null; new sources list for new insn
+ * @param insn {@code non-null;} an SsaInsn containing a PlainInsn
+ * @param newSources {@code non-null;} new sources list for new insn
* @param newOpcode A RegOp from {@link RegOps}
*/
private void replacePlainInsn(NormalSsaInsn insn,
diff --git a/dx/src/com/android/dx/ssa/LocalVariableExtractor.java b/dx/src/com/android/dx/ssa/LocalVariableExtractor.java
index 21c306b..11d53cf 100644
--- a/dx/src/com/android/dx/ssa/LocalVariableExtractor.java
+++ b/dx/src/com/android/dx/ssa/LocalVariableExtractor.java
@@ -33,23 +33,23 @@
* converted, and adapted through edge-splitting.
*/
public class LocalVariableExtractor {
- /** non-null; method being extracted from */
+ /** {@code non-null;} method being extracted from */
private final SsaMethod method;
- /** non-null; block list for the method */
+ /** {@code non-null;} block list for the method */
private final ArrayList<SsaBasicBlock> blocks;
- /** non-null; result in-progress */
+ /** {@code non-null;} result in-progress */
private final LocalVariableInfo resultInfo;
- /** non-null; work set indicating blocks needing to be processed */
+ /** {@code non-null;} work set indicating blocks needing to be processed */
private final BitSet workSet;
/**
* Extracts out all the local variable information from the given method.
*
- * @param method non-null; the method to extract from
- * @return non-null; the extracted information
+ * @param method {@code non-null;} the method to extract from
+ * @return {@code non-null;} the extracted information
*/
public static LocalVariableInfo extract(SsaMethod method) {
LocalVariableExtractor lve = new LocalVariableExtractor(method);
@@ -59,7 +59,7 @@
/**
* Constructs an instance. This method is private. Use {@link #extract}.
*
- * @param method non-null; the method to extract from
+ * @param method {@code non-null;} the method to extract from
*/
private LocalVariableExtractor(SsaMethod method) {
if (method == null) {
@@ -77,7 +77,7 @@
/**
* Does the extraction.
*
- * @return non-null; the extracted information
+ * @return {@code non-null;} the extracted information
*/
private LocalVariableInfo doit() {
@@ -98,7 +98,7 @@
/**
* Processes a single block.
*
- * @param blockIndex >= 0; block index of the block to process
+ * @param blockIndex {@code >= 0;} block index of the block to process
*/
private void processBlock(int blockIndex) {
RegisterSpecSet primaryState
diff --git a/dx/src/com/android/dx/ssa/LocalVariableInfo.java b/dx/src/com/android/dx/ssa/LocalVariableInfo.java
index f7c37d2..8845270 100644
--- a/dx/src/com/android/dx/ssa/LocalVariableInfo.java
+++ b/dx/src/com/android/dx/ssa/LocalVariableInfo.java
@@ -29,30 +29,30 @@
* Stolen from {@link com.android.dx.rop.code.LocalVariableInfo}.
*/
public class LocalVariableInfo extends MutabilityControl {
- /** >= 0; the register count for the method */
+ /** {@code >= 0;} the register count for the method */
private final int regCount;
/**
- * non-null; {@link com.android.dx.rop.code.RegisterSpecSet} to use when indicating a block
+ * {@code non-null;} {@link com.android.dx.rop.code.RegisterSpecSet} to use when indicating a block
* that has no locals; it is empty and immutable but has an appropriate
* max size for the method
*/
private final RegisterSpecSet emptySet;
/**
- * non-null; array consisting of register sets representing the
+ * {@code non-null;} array consisting of register sets representing the
* sets of variables already assigned upon entry to each block,
* where array indices correspond to block indices
*/
private final RegisterSpecSet[] blockStarts;
- /** non-null; map from instructions to the variable each assigns */
+ /** {@code non-null;} map from instructions to the variable each assigns */
private final HashMap<SsaInsn, RegisterSpec> insnAssignments;
/**
* Constructs an instance.
*
- * @param method non-null; the method being represented by this instance
+ * @param method {@code non-null;} the method being represented by this instance
*/
public LocalVariableInfo(SsaMethod method) {
if (method == null) {
@@ -74,8 +74,8 @@
* Sets the register set associated with the start of the block with
* the given index.
*
- * @param index >= 0; the block index
- * @param specs non-null; the register set to associate with the block
+ * @param index {@code >= 0;} the block index
+ * @param specs {@code non-null;} the register set to associate with the block
*/
public void setStarts(int index, RegisterSpecSet specs) {
throwIfImmutable();
@@ -99,12 +99,12 @@
* merge the two sets and call {@link #setStarts} on the result of the
* merge.
*
- * @param index >= 0; the block index
- * @param specs non-null; the register set to merge into the start set
+ * @param index {@code >= 0;} the block index
+ * @param specs {@code non-null;} the register set to merge into the start set
* for the block
- * @return <code>true</code> if the merge resulted in an actual change
+ * @return {@code true} if the merge resulted in an actual change
* to the associated set (including storing one for the first time) or
- * <code>false</code> if there was no change
+ * {@code false} if there was no change
*/
public boolean mergeStarts(int index, RegisterSpecSet specs) {
RegisterSpecSet start = getStarts0(index);
@@ -133,8 +133,8 @@
* with the given index. This returns an empty set with the appropriate
* max size if no set was associated with the block in question.
*
- * @param index >= 0; the block index
- * @return non-null; the associated register set
+ * @param index {@code >= 0;} the block index
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet getStarts(int index) {
RegisterSpecSet result = getStarts0(index);
@@ -145,10 +145,10 @@
/**
* Gets the register set associated with the start of the given
* block. This is just convenient shorthand for
- * <code>getStarts(block.getLabel())</code>.
+ * {@code getStarts(block.getLabel())}.
*
- * @param block non-null; the block in question
- * @return non-null; the associated register set
+ * @param block {@code non-null;} the block in question
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet getStarts(SsaBasicBlock block) {
return getStarts(block.getIndex());
@@ -160,8 +160,8 @@
* newly-allocated empty {@link RegisterSpecSet} of appropriate
* max size if there is not yet any set associated with the block.
*
- * @param index >= 0; the block index
- * @return non-null; the associated register set
+ * @param index {@code >= 0;} the block index
+ * @return {@code non-null;} the associated register set
*/
public RegisterSpecSet mutableCopyOfStarts(int index) {
RegisterSpecSet result = getStarts0(index);
@@ -181,8 +181,8 @@
* simple type and the one in the instruction can be an arbitrary
* {@link com.android.dx.rop.type.TypeBearer} (such as a constant value).
*
- * @param insn non-null; the instruction in question
- * @param spec non-null; the associated register spec
+ * @param insn {@code non-null;} the instruction in question
+ * @param spec {@code non-null;} the associated register spec
*/
public void addAssignment(SsaInsn insn, RegisterSpec spec) {
throwIfImmutable();
@@ -202,8 +202,8 @@
* Gets the named register being assigned by the given instruction, if
* previously stored in this instance.
*
- * @param insn non-null; instruction in question
- * @return null-ok; the named register being assigned, if any
+ * @param insn {@code non-null;} instruction in question
+ * @return {@code null-ok;} the named register being assigned, if any
*/
public RegisterSpec getAssignment(SsaInsn insn) {
return insnAssignments.get(insn);
@@ -212,7 +212,7 @@
/**
* Gets the number of assignments recorded by this instance.
*
- * @return >= 0; the number of assignments
+ * @return {@code >= 0;} the number of assignments
*/
public int getAssignmentCount() {
return insnAssignments.size();
@@ -236,8 +236,8 @@
* Helper method, to get the starts for a index, throwing the
* right exception for range problems.
*
- * @param index >= 0; the block index
- * @return null-ok; associated register set or <code>null</code> if there
+ * @param index {@code >= 0;} the block index
+ * @return {@code null-ok;} associated register set or {@code null} if there
* is none
*/
private RegisterSpecSet getStarts0(int index) {
diff --git a/dx/src/com/android/dx/ssa/MoveParamCombiner.java b/dx/src/com/android/dx/ssa/MoveParamCombiner.java
index a27aec5..352e3e6 100644
--- a/dx/src/com/android/dx/ssa/MoveParamCombiner.java
+++ b/dx/src/com/android/dx/ssa/MoveParamCombiner.java
@@ -143,8 +143,8 @@
* Returns the parameter index associated with a move-param insn. Does
* not verify that the insn is a move-param insn.
*
- * @param insn non-null; a move-param insn
- * @return >=0 parameter index
+ * @param insn {@code non-null;} a move-param insn
+ * @return {@code >=0;} parameter index
*/
private int getParamIndex(NormalSsaInsn insn) {
CstInsn cstInsn = (CstInsn)(insn.getOriginalRopInsn());
diff --git a/dx/src/com/android/dx/ssa/NormalSsaInsn.java b/dx/src/com/android/dx/ssa/NormalSsaInsn.java
index ad9315a..d3392ca 100644
--- a/dx/src/com/android/dx/ssa/NormalSsaInsn.java
+++ b/dx/src/com/android/dx/ssa/NormalSsaInsn.java
@@ -19,13 +19,10 @@
import com.android.dx.rop.code.*;
/**
- * A "normal" (non-phi) instruction in SSA form. Always wraps a ROP insn.
+ * A "normal" (non-phi) instruction in SSA form. Always wraps a rop insn.
*/
public final class NormalSsaInsn extends SsaInsn implements Cloneable {
-
- /**
- * ROP insn that we're wrapping
- */
+ /** {@code non-null;} rop insn that we're wrapping */
private Insn insn;
/**
@@ -35,21 +32,19 @@
* @param block block that contains this insn
*/
NormalSsaInsn(final Insn insn, final SsaBasicBlock block) {
- super(block);
+ super(insn.getResult(), block);
this.insn = insn;
- this.result = insn.getResult();
}
/** {@inheritDoc} */
@Override
public final void mapSourceRegisters(RegisterMapper mapper) {
-
RegisterSpecList oldSources = insn.getSources();
RegisterSpecList newSources = mapper.map(oldSources);
if (newSources != oldSources) {
- insn = insn.withNewRegisters(result, newSources);
- block.getParent().onSourcesChanged(this, oldSources);
+ insn = insn.withNewRegisters(getResult(), newSources);
+ getBlock().getParent().onSourcesChanged(this, oldSources);
}
}
@@ -57,7 +52,7 @@
* Changes one of the insn's sources. New source should be of same type
* and category.
*
- * @param index >=0; index of source to change
+ * @param index {@code >=0;} index of source to change
* @param newSpec spec for new source
*/
public final void changeOneSource(int index, RegisterSpec newSpec) {
@@ -68,6 +63,7 @@
for (int i = 0; i < sz; i++) {
newSources.set(i, i == index ? newSpec : origSources.get(i));
}
+
newSources.setImmutable();
RegisterSpec origSpec = origSources.get(index);
@@ -76,10 +72,10 @@
* If the register remains unchanged, we're only changing
* the type or local var name so don't update use list
*/
- block.getParent().onSourceChanged(this, origSpec, newSpec);
+ getBlock().getParent().onSourceChanged(this, origSpec, newSpec);
}
- insn = insn.withNewRegisters(result, newSources);
+ insn = insn.withNewRegisters(getResult(), newSources);
}
/**
@@ -90,22 +86,24 @@
*/
public final void setNewSources (RegisterSpecList newSources) {
RegisterSpecList origSources = insn.getSources();
+
if (origSources.size() != newSources.size()) {
throw new RuntimeException("Sources counts don't match");
}
- insn = insn.withNewRegisters(result, newSources);
+ insn = insn.withNewRegisters(getResult(), newSources);
}
/** {@inheritDoc} */
@Override
public NormalSsaInsn clone() {
- return (NormalSsaInsn)super.clone();
+ return (NormalSsaInsn) super.clone();
}
/**
- * Like rop.Insn.getSources()
- * @return null-ok; sources list
+ * Like rop.Insn.getSources().
+ *
+ * @return {@code null-ok;} sources list
*/
public RegisterSpecList getSources() {
return insn.getSources();
@@ -119,7 +117,7 @@
/** {@inheritDoc} */
@Override
public Insn toRopInsn() {
- return insn.withNewRegisters(result,insn.getSources());
+ return insn.withNewRegisters(getResult(), insn.getSources());
}
/**
@@ -143,7 +141,7 @@
if (insn.getOpcode().getOpcode() == RegOps.MARK_LOCAL) {
assignment = insn.getSources().get(0);
} else {
- assignment = result;
+ assignment = getResult();
}
if (assignment == null) {
@@ -167,8 +165,9 @@
*/
public void upgradeToLiteral() {
RegisterSpecList oldSources = insn.getSources();
+
insn = insn.withLastSourceLiteral();
- block.getParent().onSourcesChanged(this, oldSources);
+ getBlock().getParent().onSourcesChanged(this, oldSources);
}
/**
@@ -210,7 +209,7 @@
/**
* {@inheritDoc}
*
- * TODO increase the scope of this.
+ * TODO: Increase the scope of this.
*/
@Override
public boolean hasSideEffect() {
@@ -221,7 +220,7 @@
}
boolean hasLocalSideEffect
- = Optimizer.getPreserveLocals() && getLocalAssignment() != null;
+ = Optimizer.getPreserveLocals() && getLocalAssignment() != null;
switch (opcode.getOpcode()) {
case RegOps.MOVE_RESULT:
diff --git a/dx/src/com/android/dx/ssa/Optimizer.java b/dx/src/com/android/dx/ssa/Optimizer.java
index cee6d7b..c5f6dc9 100644
--- a/dx/src/com/android/dx/ssa/Optimizer.java
+++ b/dx/src/com/android/dx/ssa/Optimizer.java
@@ -48,7 +48,7 @@
}
/**
- * @return non-null; translation advice
+ * @return {@code non-null;} translation advice
*/
public static TranslationAdvice getAdvice() {
return advice;
@@ -64,7 +64,7 @@
* @param isStatic true if this method has no 'this' pointer argument.
* @param inPreserveLocals true if local variable info should be preserved,
* at the cost of some registers and insns
- * @param inAdvice non-null; translation advice
+ * @param inAdvice {@code non-null;} translation advice
* @return optimized method
*/
public static RopMethod optimize(RopMethod rmeth, int paramWidth,
@@ -85,7 +85,7 @@
* @param isStatic true if this method has no 'this' pointer argument.
* @param inPreserveLocals true if local variable info should be preserved,
* at the cost of some registers and insns
- * @param inAdvice non-null; translation advice
+ * @param inAdvice {@code non-null;} translation advice
* @param steps set of optional optimization steps to run
* @return optimized method
*/
diff --git a/dx/src/com/android/dx/ssa/PhiInsn.java b/dx/src/com/android/dx/ssa/PhiInsn.java
index 1829133..b3a99eb 100644
--- a/dx/src/com/android/dx/ssa/PhiInsn.java
+++ b/dx/src/com/android/dx/ssa/PhiInsn.java
@@ -30,67 +30,53 @@
* conversion back to ROP form.
*/
public final class PhiInsn extends SsaInsn {
+ /**
+ * result register. The original result register of the phi insn
+ * is needed during the renaming process after the new result
+ * register has already been chosen.
+ */
+ private final int ropResultReg;
/**
- * the original result register of the phi insn is needed during the
- * renaming process after the new result register has already been chosen.
+ * {@code non-null;} operands of the instruction; built up by
+ * {@link #addPhiOperand}
*/
- private int ropResultReg;
- private ArrayList<Operand> operands = new ArrayList<Operand>();
+ private final ArrayList<Operand> operands = new ArrayList<Operand>();
+
+ /** {@code null-ok;} source registers; constructed lazily */
private RegisterSpecList sources;
/**
- * A single phi operand, consiting of source register and block index
- * for move.
- */
- class Operand {
- RegisterSpec regSpec;
- int blockIndex;
- int ropLabel; //mostly for debugging
-
- Operand (final RegisterSpec regSpec, final int blockIndex,
- final int ropLabel){
- this.regSpec = regSpec;
- this.blockIndex = blockIndex;
- this.ropLabel = ropLabel;
- }
- }
-
- public static interface Visitor {
- public void visitPhiInsn(PhiInsn insn);
- }
-
- public PhiInsn clone() {
- throw new UnsupportedOperationException("can't clone phi");
- }
-
- /**
* Constructs a new phi insn with no operands.
+ *
* @param resultReg the result reg for this phi insn
* @param block block containing this insn.
*/
- PhiInsn(final RegisterSpec resultReg, final SsaBasicBlock block) {
- super(block);
- this.result = resultReg;
+ public PhiInsn(RegisterSpec resultReg, SsaBasicBlock block) {
+ super(resultReg, block);
ropResultReg = resultReg.getReg();
}
/**
* Makes a phi insn with a void result type.
+ *
* @param resultReg the result register for this phi insn.
* @param block block containing this insn.
*/
- PhiInsn(final int resultReg, final SsaBasicBlock block) {
- super(block);
-
+ public PhiInsn(final int resultReg, final SsaBasicBlock block) {
/*
- * The type here is bogus: the type depends on the operand and
- * will be derived later.
+ * The result type here is bogus: The type depends on the
+ * operand and will be derived later.
*/
- this.result = RegisterSpec.make(resultReg, Type.VOID);
+ super(RegisterSpec.make(resultReg, Type.VOID), block);
ropResultReg = resultReg;
}
+ /** {@inheritDoc} */
+ public PhiInsn clone() {
+ throw new UnsupportedOperationException("can't clone phi");
+ }
+
/**
* Updates the TypeBearers of all the sources (phi operands) to be
* the current TypeBearer of the register-defining instruction's result.
@@ -100,9 +86,8 @@
*
* @param ssaMeth method that contains this insn
*/
- void updateSourcesToDefinitions(SsaMethod ssaMeth) {
-
- for (Operand o: operands) {
+ public void updateSourcesToDefinitions(SsaMethod ssaMeth) {
+ for (Operand o : operands) {
RegisterSpec def
= ssaMeth.getDefinitionForRegister(
o.regSpec.getReg()).getResult();
@@ -116,37 +101,42 @@
/**
* Changes the result type. Used during phi type resolution
*
- * @param type non-null; new TypeBearer
- * @param local null-ok; new local info, if available
+ * @param type {@code non-null;} new TypeBearer
+ * @param local {@code null-ok;} new local info, if available
*/
- void changeResultType(TypeBearer type, LocalItem local) {
- result = RegisterSpec.makeLocalOptional(result.getReg(), type, local);
+ public void changeResultType(TypeBearer type, LocalItem local) {
+ setResult(RegisterSpec.makeLocalOptional(
+ getResult().getReg(), type, local));
}
/**
- * @return the original rop-form result reg. Useful during renaming.
+ * Gets the original rop-form result reg. This is useful during renaming.
+ *
+ * @return the original rop-form result reg
*/
- int getRopResultReg() {
+ public int getRopResultReg() {
return ropResultReg;
}
/**
- * Add an operand to this phi instruction
+ * Adds an operand to this phi instruction.
+ *
* @param registerSpec register spec, including type and reg of operand
- * @param predBlock Predecessor block to be associated with this operand
+ * @param predBlock predecessor block to be associated with this operand
*/
public void addPhiOperand(RegisterSpec registerSpec,
SsaBasicBlock predBlock) {
operands.add(new Operand(registerSpec, predBlock.getIndex(),
predBlock.getRopLabel()));
- // in case someone has already called getSources()
+ // Un-cache sources, in case someone has already called getSources().
sources = null;
}
/**
* Gets the index of the pred block associated with the RegisterSpec
* at the particular getSources() index.
+ *
* @param sourcesIndex index of source in getSources()
* @return block index
*/
@@ -157,7 +147,7 @@
/**
* {@inheritDoc}
*
- * Always returns null for <code>PhiInsn</code>s
+ * Always returns null for {@code PhiInsn}s.
*/
@Override
public Rop getOpcode() {
@@ -167,18 +157,17 @@
/**
* {@inheritDoc}
*
- * Always returns null for <code>PhiInsn</code>s
+ * Always returns null for {@code PhiInsn}s.
*/
@Override
public Insn getOriginalRopInsn() {
return null;
}
-
/**
* {@inheritDoc}
*
- * Always returns false for <code>PhiInsn</code>s
+ * Always returns false for {@code PhiInsn}s.
*/
@Override
public boolean canThrow() {
@@ -188,10 +177,10 @@
/**
* Gets sources. Constructed lazily from phi operand data structures and
* then cached.
- * @return sources list
+ *
+ * @return {@code non-null;} sources list
*/
public RegisterSpecList getSources() {
-
if (sources != null) {
return sources;
}
@@ -219,10 +208,10 @@
public boolean isRegASource(int reg) {
/*
* Avoid creating a sources list in case it has not already been
- * created
+ * created.
*/
- for (Operand o: operands) {
+ for (Operand o : operands) {
if (o.regSpec.getReg() == reg) {
return true;
}
@@ -236,12 +225,12 @@
*/
public boolean areAllOperandsEqual() {
if (operands.size() == 0 ) {
- // this should never happen
+ // This should never happen.
return true;
}
int firstReg = operands.get(0).regSpec.getReg();
- for (Operand o: operands) {
+ for (Operand o : operands) {
if (firstReg != o.regSpec.getReg()) {
return false;
}
@@ -253,19 +242,20 @@
/** {@inheritDoc} */
@Override
public final void mapSourceRegisters(RegisterMapper mapper) {
- for (Operand o: operands) {
+ for (Operand o : operands) {
RegisterSpec old = o.regSpec;
o.regSpec = mapper.map(old);
if (old != o.regSpec) {
- block.getParent().onSourceChanged(this, old, o.regSpec);
+ getBlock().getParent().onSourceChanged(this, old, o.regSpec);
}
}
sources = null;
}
/**
- * Always throws an exeption, since
- * a phi insn may not be converted back to rop form
+ * Always throws an exeption, since a phi insn may not be
+ * converted back to rop form.
+ *
* @return always throws exception
*/
@Override
@@ -276,17 +266,16 @@
/**
* Returns the list of predecessor blocks associated with all operands
- * that have <code>reg</code> as an operand register.
+ * that have {@code reg} as an operand register.
*
* @param reg register to look up
* @param ssaMeth method we're operating on
- * @return List of predecessor blocks, empty if none
+ * @return list of predecessor blocks, empty if none
*/
- public List<SsaBasicBlock> predBlocksForReg (int reg, SsaMethod ssaMeth) {
- ArrayList<SsaBasicBlock> ret
- = (ArrayList<SsaBasicBlock>)new ArrayList();
+ public List<SsaBasicBlock> predBlocksForReg(int reg, SsaMethod ssaMeth) {
+ ArrayList<SsaBasicBlock> ret = new ArrayList<SsaBasicBlock>();
- for (Operand o: operands) {
+ for (Operand o : operands) {
if (o.regSpec.getReg() == reg) {
ret.add(ssaMeth.getBlocks().get(o.blockIndex));
}
@@ -297,12 +286,13 @@
/** {@inheritDoc} */
@Override
- public boolean isPhiOrMove() {
+ public boolean isPhiOrMove() {
return true;
}
/** {@inheritDoc} */
- @Override public boolean hasSideEffect() {
+ @Override
+ public boolean hasSideEffect() {
return Optimizer.getPreserveLocals() && getLocalAssignment() != null;
}
@@ -312,25 +302,23 @@
v.visitPhiInsn(this);
}
- /**
- * @return human-readable string for listing dumps
- */
+ /** {@inheritDoc} */
public String toHuman() {
return toHumanWithInline(null);
}
/**
- * Returns human-readable string for listing dumps.
- * Allows sub-classes to specify extra text
- * @param extra null-ok; the argument to print after the opcode
+ * Returns human-readable string for listing dumps. This method
+ * allows sub-classes to specify extra text.
+ *
+ * @param extra {@code null-ok;} the argument to print after the opcode
* @return human-readable string for listing dumps
*/
protected final String toHumanWithInline(String extra) {
StringBuffer sb = new StringBuffer(80);
sb.append(SourcePosition.NO_INFO);
- sb.append(": ");
- sb.append("phi");
+ sb.append(": phi");
if (extra != null) {
sb.append("(");
@@ -338,6 +326,8 @@
sb.append(")");
}
+ RegisterSpec result = getResult();
+
if (result == null) {
sb.append(" .");
} else {
@@ -361,4 +351,28 @@
return sb.toString();
}
+
+ /**
+ * A single phi operand, consiting of source register and block index
+ * for move.
+ */
+ private static class Operand {
+ public RegisterSpec regSpec;
+ public final int blockIndex;
+ public final int ropLabel; // only used for debugging
+
+ public Operand(final RegisterSpec regSpec, final int blockIndex,
+ final int ropLabel) {
+ this.regSpec = regSpec;
+ this.blockIndex = blockIndex;
+ this.ropLabel = ropLabel;
+ }
+ }
+
+ /**
+ * Visitor interface for instances of this (outer) class.
+ */
+ public static interface Visitor {
+ public void visitPhiInsn(PhiInsn insn);
+ }
}
diff --git a/dx/src/com/android/dx/ssa/RegisterMapper.java b/dx/src/com/android/dx/ssa/RegisterMapper.java
index 98503e2..1f45b42 100644
--- a/dx/src/com/android/dx/ssa/RegisterMapper.java
+++ b/dx/src/com/android/dx/ssa/RegisterMapper.java
@@ -21,13 +21,12 @@
import com.android.dx.util.ToHuman;
/**
- * Represents a mapping between two register numbering schemes.
- * Subclasses of this may be mutable, and as such the mapping provided is only
- * valid for the lifetime of the method call in which instances of this class
- * are passed.
+ * Represents a mapping between two register numbering schemes.
+ * Subclasses of this may be mutable, and as such the mapping provided
+ * is only valid for the lifetime of the method call in which
+ * instances of this class are passed.
*/
public abstract class RegisterMapper {
-
/**
* Gets the count of registers (really, the total register width, since
* category width is counted) in the new namespace.
@@ -47,17 +46,16 @@
* @return new mapped register list, or old if nothing has changed.
*/
public final RegisterSpecList map(RegisterSpecList sources) {
- RegisterSpecList newSources;
-
- newSources = new RegisterSpecList(sources.size());
-
int sz = sources.size();
+ RegisterSpecList newSources = new RegisterSpecList(sz);
+
for (int i = 0; i < sz; i++) {
newSources.set(i, map(sources.get(i)));
}
newSources.setImmutable();
- // Return the old sources if nothing has changed
- return newSources.equals(sources)? sources: newSources;
+
+ // Return the old sources if nothing has changed.
+ return newSources.equals(sources) ? sources : newSources;
}
}
diff --git a/dx/src/com/android/dx/ssa/SetFactory.java b/dx/src/com/android/dx/ssa/SetFactory.java
index f34d08d..92e965f 100644
--- a/dx/src/com/android/dx/ssa/SetFactory.java
+++ b/dx/src/com/android/dx/ssa/SetFactory.java
@@ -59,8 +59,8 @@
/**
* Make IntSet for the dominance-frontier sets.
*
- * @param szBlocks >=0; count of basic blocks in method
- * @return non-null; appropriate set
+ * @param szBlocks {@code >=0;} count of basic blocks in method
+ * @return {@code non-null;} appropriate set
*/
/*package*/ static IntSet makeDomFrontSet(int szBlocks) {
return szBlocks <= DOMFRONT_SET_THRESHOLD_SIZE
@@ -72,8 +72,8 @@
* Make IntSet for the interference graph sets. Public because
* InterferenceGraph is in another package.
*
- * @param countRegs >=0; count of SSA registers used in method
- * @return non-null; appropriate set
+ * @param countRegs {@code >=0;} count of SSA registers used in method
+ * @return {@code non-null;} appropriate set
*/
public static IntSet makeInterferenceSet(int countRegs) {
return countRegs <= INTERFERENCE_SET_THRESHOLD_SIZE
@@ -84,8 +84,8 @@
/**
* Make IntSet for register live in/out sets.
*
- * @param countRegs >=0; count of SSA registers used in method
- * @return non-null; appropriate set
+ * @param countRegs {@code >=0;} count of SSA registers used in method
+ * @return {@code non-null;} appropriate set
*/
/*package*/ static IntSet makeLivenessSet(int countRegs) {
return countRegs <= LIVENESS_SET_THRESHOLD_SIZE
diff --git a/dx/src/com/android/dx/ssa/SsaBasicBlock.java b/dx/src/com/android/dx/ssa/SsaBasicBlock.java
index 99ada7e..6b768e8 100644
--- a/dx/src/com/android/dx/ssa/SsaBasicBlock.java
+++ b/dx/src/com/android/dx/ssa/SsaBasicBlock.java
@@ -36,32 +36,50 @@
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
/**
* An SSA representation of a basic block.
*/
public final class SsaBasicBlock {
-
- /** non-null; insn list associated with this instance */
- private ArrayList<SsaInsn> insns;
- /** non-null; predecessor set (by block list index) */
- private BitSet predecessors;
- /** non-null; successor set (by block list index) */
- private BitSet successors;
/**
- * non-null; ordered successor list
+ * {@code non-null;} comparator for instances of this class that
+ * just compares block labels
+ */
+ public static final Comparator<SsaBasicBlock> LABEL_COMPARATOR =
+ new LabelComparator();
+
+ /** {@code non-null;} insn list associated with this instance */
+ private ArrayList<SsaInsn> insns;
+
+ /** {@code non-null;} predecessor set (by block list index) */
+ private BitSet predecessors;
+
+ /** {@code non-null;} successor set (by block list index) */
+ private BitSet successors;
+
+ /**
+ * {@code non-null;} ordered successor list
* (same block may be listed more than once)
*/
private IntList successorList;
- /** block list index of primary successor, or -1 for no primary successor */
+
+ /**
+ * block list index of primary successor, or {@code -1} for no primary
+ * successor
+ */
private int primarySuccessor = -1;
+
/** label of block in rop form */
private int ropLabel;
- /** non-null; method we belong to */
+
+ /** {@code non-null;} method we belong to */
private SsaMethod parent;
+
/** our index into parent.getBlock() */
private int index;
+
/** list of dom children */
private final ArrayList<SsaBasicBlock> domChildren;
@@ -70,19 +88,28 @@
* phi-removal process. Retained for subsequent move scheduling.
*/
private int movesFromPhisAtEnd = 0;
+
/**
* The number of moves added to the beginning of the block during the
* phi-removal process. Retained for subsequent move scheduling.
*/
private int movesFromPhisAtBeginning = 0;
- /** null-ok; indexed by reg: the regs that are live-in at this block */
+ /**
+ * {@code null-ok;} indexed by reg: the regs that are live-in at
+ * this block
+ */
private IntSet liveIn;
- /** null-ok; indexed by reg: the regs that are live-out at this block */
+
+ /**
+ * {@code null-ok;} indexed by reg: the regs that are live-out at
+ * this block
+ */
private IntSet liveOut;
/**
- * Create a new empty basic block
+ * Creates a new empty basic block.
+ *
* @param basicBlockIndex index this block will have
* @param ropLabel original rop-form label
* @param parent method of this block
@@ -112,20 +139,14 @@
*/
public static SsaBasicBlock newFromRop(RopMethod rmeth,
int basicBlockIndex, final SsaMethod parent) {
-
- BasicBlockList ropBlocks;
- SsaBasicBlock result;
- InsnList ropInsns;
- BasicBlock bb;
-
- ropBlocks = rmeth.getBlocks();
- bb = ropBlocks.get(basicBlockIndex);
-
- result = new SsaBasicBlock(basicBlockIndex, bb.getLabel(), parent);
-
- ropInsns = bb.getInsns();
+ BasicBlockList ropBlocks = rmeth.getBlocks();
+ BasicBlock bb = ropBlocks.get(basicBlockIndex);
+ SsaBasicBlock result =
+ new SsaBasicBlock(basicBlockIndex, bb.getLabel(), parent);
+ InsnList ropInsns = bb.getInsns();
result.insns.ensureCapacity(ropInsns.size());
+
for (int i = 0, sz = ropInsns.size() ; i < sz ; i++) {
result.insns.add(new NormalSsaInsn (ropInsns.get(i), result));
}
@@ -141,7 +162,6 @@
= SsaMethod.indexListFromLabelList(ropBlocks,
bb.getSuccessors());
-
if (result.successorList.size() != 0) {
int primarySuccessor = bb.getPrimarySuccessor();
@@ -156,7 +176,7 @@
* Adds a basic block as a dom child for this block. Used when constructing
* the dom tree.
*
- * @param child non-null; new dom child
+ * @param child {@code non-null;} new dom child
*/
void addDomChild(SsaBasicBlock child) {
domChildren.add(child);
@@ -165,7 +185,7 @@
/**
* Gets the dom children for this node. Don't modify this list.
*
- * @return non-null; list of dom children
+ * @return {@code non-null;} list of dom children
*/
ArrayList<SsaBasicBlock> getDomChildren() {
return domChildren;
@@ -175,7 +195,7 @@
* Adds a phi insn to the beginning of this block. The result type of
* the phi will be set to void, to indicate that it's currently unknown.
*
- * @param reg >=0 result reg
+ * @param reg {@code >=0;} result reg
*/
void addPhiInsnForReg(int reg) {
insns.add(0, new PhiInsn(reg, this));
@@ -186,7 +206,7 @@
* when the result type or local-association can be determined at phi
* insert time.
*
- * @param resultSpec non-null; reg
+ * @param resultSpec {@code non-null;} reg
*/
void addPhiInsnForReg(RegisterSpec resultSpec) {
insns.add(0, new PhiInsn(resultSpec, this));
@@ -196,7 +216,7 @@
* Adds an insn to the head of this basic block, just after any phi
* insns.
*
- * @param insn non-null; rop-form insn to add
+ * @param insn {@code non-null;} rop-form insn to add
*/
void addInsnToHead(Insn insn) {
SsaInsn newInsn = SsaInsn.makeFromRop(insn, this);
@@ -208,7 +228,7 @@
* Replaces the last insn in this block. The provided insn must have
* some branchingness.
*
- * @param insn non-null; rop-form insn to add, which must branch.
+ * @param insn {@code non-null;} rop-form insn to add, which must branch.
*/
void replaceLastInsn(Insn insn) {
if (insn.getOpcode().getBranchingness() == Rop.BRANCH_NONE) {
@@ -225,8 +245,9 @@
}
/**
- * Visits each phi insn
- * @param v callback
+ * Visits each phi insn.
+ *
+ * @param v {@code non-null;} the callback
*/
public void forEachPhiInsn(PhiInsn.Visitor v) {
@@ -276,7 +297,7 @@
}
/**
- * @return non-null;the (mutable) instruction list for this block,
+ * @return {@code non-null;} the (mutable) instruction list for this block,
* with phi insns at the beginning.
*/
public ArrayList<SsaInsn> getInsns() {
@@ -284,7 +305,7 @@
}
/**
- * @return non-null; the (mutable) list of phi insns for this block
+ * @return {@code non-null;} the (mutable) list of phi insns for this block
*/
public List<SsaInsn> getPhiInsns() {
return insns.subList(0, getCountPhiInsns());
@@ -312,29 +333,30 @@
}
/**
- * @return non-null;predecessors set, indexed by block index
+ * @return {@code non-null;} predecessors set, indexed by block index
*/
public BitSet getPredecessors() {
return predecessors;
}
/**
- * @return non-null;successors set, indexed by block index
+ * @return {@code non-null;} successors set, indexed by block index
*/
public BitSet getSuccessors() {
return successors;
}
/**
- * @return non-null;ordered successor list, containing block indicies
+ * @return {@code non-null;} ordered successor list, containing block
+ * indicies
*/
public IntList getSuccessorList() {
return successorList;
}
/**
- * @return >= -1; block index of primary successor or -1 if no
- * primary successor.
+ * @return {@code >= -1;} block index of primary successor or
+ * {@code -1} if no primary successor.
*/
public int getPrimarySuccessorIndex() {
return primarySuccessor;
@@ -348,7 +370,8 @@
}
/**
- * @return null-ok; the primary successor block or null if there is none.
+ * @return {@code null-ok;} the primary successor block or {@code null}
+ * if there is none
*/
public SsaBasicBlock getPrimarySuccessor() {
if (primarySuccessor < 0) {
@@ -373,7 +396,7 @@
}
/**
- * @return non-null; method that contains this block
+ * @return {@code non-null;} method that contains this block
*/
public SsaMethod getParent() {
return parent;
@@ -383,7 +406,7 @@
* Inserts a new empty GOTO block as a predecessor to this block.
* All previous predecessors will be predecessors to the new block.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public SsaBasicBlock insertNewPredecessor() {
SsaBasicBlock newPred = parent.makeNewGotoBlock();
@@ -412,15 +435,15 @@
}
/**
- * Constructs and inserts a new empty GOTO block <code>Z</code> between
- * this block (<code>A</code>) and a current successor block
- * (<code>B</code>). The new block will replace B as A's successor and
+ * Constructs and inserts a new empty GOTO block {@code Z} between
+ * this block ({@code A}) and a current successor block
+ * ({@code B}). The new block will replace B as A's successor and
* A as B's predecessor. A and B will no longer be directly connected.
* If B is listed as a successor multiple times, all references
* are replaced.
*
* @param other current successor (B)
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public SsaBasicBlock insertNewSuccessor(SsaBasicBlock other) {
SsaBasicBlock newSucc = parent.makeNewGotoBlock();
@@ -457,8 +480,9 @@
}
/**
- * Replace an old successor with a new successor.
- * Throws RuntimeException if oldIndex was not a successor.
+ * Replaces an old successor with a new successor. This will throw
+ * RuntimeException if {@code oldIndex} was not a successor.
+ *
* @param oldIndex index of old successor block
* @param newIndex index of new successor block.
*/
@@ -467,7 +491,7 @@
return;
}
- // Update us
+ // Update us.
successors.set(newIndex);
if (primarySuccessor == oldIndex) {
@@ -482,10 +506,10 @@
successors.clear(oldIndex);
- // Update new successor
+ // Update new successor.
parent.getBlocks().get(newIndex).predecessors.set(index);
- // Update old successor
+ // Update old successor.
parent.getBlocks().get(oldIndex).predecessors.clear(index);
}
@@ -495,7 +519,7 @@
* is not an exit predecessor or is the exit block, this block does
* nothing. For use by {@link com.android.dx.ssa.SsaMethod#makeExitBlock}
*
- * @param exitBlock non-null; exit block
+ * @param exitBlock {@code non-null;} exit block
*/
public void exitBlockFixup(SsaBasicBlock exitBlock) {
if (this == exitBlock) {
@@ -519,6 +543,7 @@
* before the last instruction. If the result of the final instruction
* is the source in question, then the move is placed at the beginning of
* the primary successor block. This is for unversioned registers.
+ *
* @param result move destination
* @param source move source
*/
@@ -568,8 +593,8 @@
NormalSsaInsn toAdd;
toAdd = new NormalSsaInsn(
- new PlainInsn(Rops.opMove(result.getType()),
- SourcePosition.NO_INFO, result, sources), this);
+ new PlainInsn(Rops.opMove(result.getType()),
+ SourcePosition.NO_INFO, result, sources), this);
insns.add(insns.size() - 1, toAdd);
@@ -578,12 +603,12 @@
}
/**
- * Add a move instruction after the phi insn block.
+ * Adds a move instruction after the phi insn block.
+ *
* @param result move destination
* @param source move source
*/
public void addMoveToBeginning (RegisterSpec result, RegisterSpec source) {
-
if (result.getReg() == source.getReg()) {
// Sometimes we end up with no-op moves. Ignore them here.
return;
@@ -638,9 +663,10 @@
* reads of any register happen before writes to that register.
* NOTE: caller is expected to returnSpareRegisters()!
*
- * TODO See Briggs, et al "Practical Improvements to the Construction and
+ * TODO: See Briggs, et al "Practical Improvements to the Construction and
* Destruction of Static Single Assignment Form" section 5. a) This can
* be done in three passes.
+ *
* @param toSchedule List of instructions. Must consist only of moves.
*/
private void scheduleUseBeforeAssigned(List<SsaInsn> toSchedule) {
@@ -740,12 +766,12 @@
}
/**
- * Adds regV to the live-out list for this block.
- * Called by the liveness analyzer.
+ * Adds {@code regV} to the live-out list for this block. This is called
+ * by the liveness analyzer.
+ *
* @param regV register that is live-out for this block.
*/
- public void
- addLiveOut (int regV) {
+ public void addLiveOut (int regV) {
if (liveOut == null) {
liveOut = SetFactory.makeLivenessSet(parent.getRegCount());
}
@@ -754,12 +780,12 @@
}
/**
- * Adds regV to the live-in list for this block.
- * Called by the liveness analyzer.
+ * Adds {@code regV} to the live-in list for this block. This is
+ * called by the liveness analyzer.
+ *
* @param regV register that is live-in for this block.
*/
- public void
- addLiveIn (int regV) {
+ public void addLiveIn (int regV) {
if (liveIn == null) {
liveIn = SetFactory.makeLivenessSet(parent.getRegCount());
}
@@ -771,7 +797,7 @@
* Returns the set of live-in registers. Valid after register
* interference graph has been generated, otherwise empty.
*
- * @return non-null; live-in register set.
+ * @return {@code non-null;} live-in register set.
*/
public IntSet getLiveInRegs() {
if (liveIn == null) {
@@ -784,7 +810,7 @@
* Returns the set of live-out registers. Valid after register
* interference graph has been generated, otherwise empty.
*
- * @return non-null; live-out register set.
+ * @return {@code non-null;} live-out register set.
*/
public IntSet getLiveOutRegs() {
if (liveOut == null) {
@@ -814,7 +840,7 @@
}
/**
- * Sorts move instructions added via <code>addMoveToEnd</code> during
+ * Sorts move instructions added via {@code addMoveToEnd} during
* phi removal so that results don't overwrite sources that are used.
* For use after all phis have been removed and all calls to
* addMoveToEnd() have been made.<p>
@@ -825,7 +851,6 @@
* refers value before any other phis have executed.
*/
public void scheduleMovesFromPhis() {
-
if (movesFromPhisAtBeginning > 1) {
List<SsaInsn> toSchedule;
@@ -869,12 +894,12 @@
}
if (!moveExceptionInterferes) {
- // The easy case
+ // This is the easy case.
insns.remove(movesFromPhisAtBeginning);
insns.add(0, firstNonPhiMoveInsn);
} else {
- // We need to move the result to a spare reg and move it
- // back.
+ // We need to move the result to a spare reg
+ // and move it back.
int spareRegister;
RegisterSpec originalResultSpec;
@@ -883,9 +908,10 @@
spareRegister = parent.borrowSpareRegister(
originalResultSpec.getCategory());
- // We now move it to a spare register
+ // We now move it to a spare register.
firstNonPhiMoveInsn.changeResultReg(spareRegister);
- RegisterSpec tempSpec = firstNonPhiMoveInsn.getResult();
+ RegisterSpec tempSpec =
+ firstNonPhiMoveInsn.getResult();
insns.add(0, firstNonPhiMoveInsn);
@@ -915,14 +941,15 @@
insns.size() - 1));
}
- // Return registers borrowed here and in scheduleUseBeforeAssigned()
+ // Return registers borrowed here and in scheduleUseBeforeAssigned().
parent.returnSpareRegisters();
}
/**
- * Visit all insns in this block
- * @param visitor callback interface
+ * Visit all insns in this block.
+ *
+ * @param visitor {@code non-null;} callback interface
*/
public void forEachInsn(SsaInsn.Visitor visitor) {
for (SsaInsn insn: insns) {
@@ -930,20 +957,41 @@
}
}
+ /** {@inheritDoc} */
public String toString() {
return "{" + index + ":" + Hex.u2(ropLabel) + '}';
}
/**
- * Visitor interface for basic blocks
+ * Visitor interface for basic blocks.
*/
public interface Visitor {
-
/**
* Indicates a block has been visited by an iterator method.
- * @param v non-null; block visited
- * @param parent null-ok; parent node if applicable.
+ *
+ * @param v {@code non-null;} block visited
+ * @param parent {@code null-ok;} parent node if applicable
*/
void visitBlock (SsaBasicBlock v, SsaBasicBlock parent);
}
+
+ /**
+ * Label comparator.
+ */
+ public static final class LabelComparator
+ implements Comparator<SsaBasicBlock> {
+ /** {@inheritDoc} */
+ public int compare(SsaBasicBlock b1, SsaBasicBlock b2) {
+ int label1 = b1.ropLabel;
+ int label2 = b2.ropLabel;
+
+ if (label1 < label2) {
+ return -1;
+ } else if (label1 > label2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ }
}
diff --git a/dx/src/com/android/dx/ssa/SsaConverter.java b/dx/src/com/android/dx/ssa/SsaConverter.java
index a731fcb..8d31eef 100644
--- a/dx/src/com/android/dx/ssa/SsaConverter.java
+++ b/dx/src/com/android/dx/ssa/SsaConverter.java
@@ -122,7 +122,7 @@
/**
* Inserts Z nodes as new predecessors for every node that has multiple
* successors and multiple predecessors.
- * @param result non-null; method to process
+ * @param result {@code non-null;} method to process
*/
private static void edgeSplitPredecessors(SsaMethod result) {
ArrayList<SsaBasicBlock> blocks = result.getBlocks();
@@ -138,7 +138,7 @@
}
/**
- * @param block non-null; block in question
+ * @param block {@code non-null;} block in question
* @return true if this node needs to have a unique predecessor created for
* it.
*/
@@ -200,7 +200,7 @@
/**
* Inserts Z nodes for every node that needs a new
* successor.
- * @param result non-null; method to process
+ * @param result {@code non-null;} method to process
*/
private static void edgeSplitSuccessors(SsaMethod result) {
ArrayList<SsaBasicBlock> blocks = result.getBlocks();
@@ -248,8 +248,8 @@
* See Appel algorithm 19.6
* Place Phi functions in appropriate locations.
*
- * @param ssaMeth non-null; method to process. Modifications made in-place
- * @param localInfo non-null; Local variable info, used when placing phis
+ * @param ssaMeth {@code non-null;} method to process. Modifications made in-place
+ * @param localInfo {@code non-null;} Local variable info, used when placing phis
*/
private static void placePhiFunctions (SsaMethod ssaMeth,
LocalVariableInfo localInfo) {
diff --git a/dx/src/com/android/dx/ssa/SsaInsn.java b/dx/src/com/android/dx/ssa/SsaInsn.java
index d9e33a0..815f82d 100644
--- a/dx/src/com/android/dx/ssa/SsaInsn.java
+++ b/dx/src/com/android/dx/ssa/SsaInsn.java
@@ -23,24 +23,34 @@
* An instruction in SSA form
*/
public abstract class SsaInsn implements ToHuman, Cloneable {
+ /** {@code non-null;} the block that contains this instance */
+ private final SsaBasicBlock block;
- protected RegisterSpec result;
- protected final SsaBasicBlock block;
+ /** {@code null-ok;} result register */
+ private RegisterSpec result;
/**
- * Constructs an instance
- * @param block block containing this insn. Can never change.
+ * Constructs an instance.
+ *
+ * @param result {@code null-ok;} initial result register. May be changed.
+ * @param block {@code non-null;} block containing this insn. Can
+ * never change.
*/
- protected SsaInsn(final SsaBasicBlock block) {
+ protected SsaInsn(RegisterSpec result, SsaBasicBlock block) {
+ if (block == null) {
+ throw new NullPointerException("block == null");
+ }
+
this.block = block;
+ this.result = result;
}
/**
- * Makes a new SSA insn form a ROP insn
+ * Makes a new SSA insn form a rop insn.
*
- * @param insn non-null; rop insn
- * @param block non-null; owning block
- * @return non-null; an appropriately constructed instance
+ * @param insn {@code non-null;} rop insn
+ * @param block {@code non-null;} owning block
+ * @return {@code non-null;} an appropriately constructed instance
*/
public static SsaInsn makeFromRop(Insn insn, SsaBasicBlock block) {
return new NormalSsaInsn(insn, block);
@@ -58,6 +68,7 @@
/**
* Like {@link com.android.dx.rop.code.Insn getResult()}.
+ *
* @return result register
*/
public RegisterSpec getResult() {
@@ -65,8 +76,22 @@
}
/**
+ * Set the result register.
+ *
+ * @param result {@code non-null;} the new result register
+ */
+ protected void setResult(RegisterSpec result) {
+ if (result == null) {
+ throw new NullPointerException("result == null");
+ }
+
+ this.result = result;
+ }
+
+ /**
* Like {@link com.android.dx.rop.code.Insn getSources()}.
- * @return non-null; sources list
+ *
+ * @return {@code non-null;} sources list
*/
abstract public RegisterSpecList getSources();
@@ -80,7 +105,8 @@
}
/**
- * is the specified reg the result reg?
+ * Returns whether or not the specified reg is the result reg.
+ *
* @param reg register to test
* @return true if there is a result and it is stored in the specified
* register
@@ -91,9 +117,10 @@
/**
- * Changes the result register if this insn has a result.
- * Used during renaming.
- * @param reg new result register.
+ * Changes the result register if this insn has a result. This is used
+ * during renaming.
+ *
+ * @param reg new result register
*/
public void changeResultReg(int reg) {
if (result != null) {
@@ -102,10 +129,10 @@
}
/**
- * Sets the local association for the result of this insn.
- * This is sometimes updated during the SsaRenamer process.
+ * Sets the local association for the result of this insn. This is
+ * sometimes updated during the SsaRenamer process.
*
- * @param local null-ok; New debug/local variable info.
+ * @param local {@code null-ok;} new debug/local variable info
*/
public final void setResultLocal(LocalItem local) {
LocalItem oldItem = result.getLocalItem();
@@ -120,10 +147,11 @@
/**
* Map registers after register allocation.
*
- * @param mapper
+ * @param mapper {@code non-null;} mapping from old to new registers
*/
public final void mapRegisters(RegisterMapper mapper) {
RegisterSpec oldResult = result;
+
result = mapper.map(result);
block.getParent().updateOneDefinition(this, oldResult);
mapSourceRegisters(mapper);
@@ -136,13 +164,12 @@
*/
abstract public void mapSourceRegisters(RegisterMapper mapper);
-
/**
- * Returns the Rop opcode for this insn, or null if this is a phi insn
+ * Returns the Rop opcode for this insn, or null if this is a phi insn.
*
- * TODO move this up into NormalSsaInsn
+ * TODO: Move this up into NormalSsaInsn.
*
- * @return null-ok; Rop opcode if there is one.
+ * @return {@code null-ok;} Rop opcode if there is one.
*/
abstract public Rop getOpcode();
@@ -150,20 +177,21 @@
* Returns the original Rop insn for this insn, or null if this is
* a phi insn.
*
- * TODO move this up into NormalSsaInsn
+ * TODO: Move this up into NormalSsaInsn.
*
- * @return null-ok; Rop insn if there is one.
+ * @return {@code null-ok;} Rop insn if there is one.
*/
abstract public Insn getOriginalRopInsn();
/**
* Gets the spec of a local variable assignment that occurs at this
* instruction, or null if no local variable assignment occurs. This
- * may be the result register, or for <code>mark-local</code> insns
+ * may be the result register, or for {@code mark-local} insns
* it may be the source.
*
- * @return null-ok; a local-associated register spec or null
* @see com.android.dx.rop.code.Insn#getLocalAssignment()
+ *
+ * @return {@code null-ok;} a local-associated register spec or null
*/
public RegisterSpec getLocalAssignment() {
if (result != null && result.getLocalItem() != null) {
@@ -176,7 +204,8 @@
/**
* Indicates whether the specified register is amongst the registers
* used as sources for this instruction.
- * @param reg The register in question
+ *
+ * @param reg the register in question
* @return true if the reg is a source
*/
public boolean isRegASource(int reg) {
@@ -186,9 +215,9 @@
/**
* Transform back to ROP form.
*
- * TODO move this up into NormalSsaInsn
+ * TODO: Move this up into NormalSsaInsn.
*
- * @return non-null; a ROP representation of this instruction, with
+ * @return {@code non-null;} a ROP representation of this instruction, with
* updated registers.
*/
public abstract Insn toRopInsn();
@@ -208,8 +237,8 @@
public abstract boolean hasSideEffect();
/**
- * @return true if this is a move (but not a move-operand or move-exception)
- * instruction
+ * @return true if this is a move (but not a move-operand or
+ * move-exception) instruction
*/
public boolean isNormalMoveInsn() {
return false;
@@ -229,8 +258,9 @@
abstract public boolean canThrow();
/**
- * accepts a visitor
- * @param v visitor
+ * Accepts a visitor.
+ *
+ * @param v {@code non-null} the visitor
*/
public abstract void accept(Visitor v);
@@ -238,22 +268,21 @@
* Visitor interface for this class.
*/
public static interface Visitor {
-
/**
* Any non-phi move instruction
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitMoveInsn(NormalSsaInsn insn);
/**
* Any phi insn
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitPhiInsn(PhiInsn insn);
/**
* Any insn that isn't a move or a phi (which is also a move).
- * @param insn non-null; the instruction to visit
+ * @param insn {@code non-null;} the instruction to visit
*/
public void visitNonMoveInsn(NormalSsaInsn insn);
}
diff --git a/dx/src/com/android/dx/ssa/SsaMethod.java b/dx/src/com/android/dx/ssa/SsaMethod.java
index 49f8ea5..b4a0894 100644
--- a/dx/src/com/android/dx/ssa/SsaMethod.java
+++ b/dx/src/com/android/dx/ssa/SsaMethod.java
@@ -73,6 +73,7 @@
/** indexed by register: the list of all insns that use a register */
private ArrayList<SsaInsn>[] useList;
+
/** A version of useList with each List unmodifiable */
private List<SsaInsn>[] unmodifiableUseList;
@@ -235,7 +236,7 @@
/**
* Makes a new basic block for this method,
- * which is empty besides a single <code>GOTO</code>. Successors and
+ * which is empty besides a single {@code GOTO}. Successors and
* predecessors are not yet set.
*
* @return new block
@@ -272,7 +273,7 @@
}
/**
- * @return null-ok; block of exit block or null if there is none
+ * @return {@code null-ok;} block of exit block or null if there is none
*/
public SsaBasicBlock getExitBlock() {
return exitBlockIndex < 0 ? null : blocks.get(exitBlockIndex);
@@ -339,7 +340,7 @@
}
/**
- * @return non-null; basic block list, do not modify.
+ * @return {@code non-null;} basic block list, do not modify.
*/
public ArrayList<SsaBasicBlock> getBlocks() {
return blocks;
@@ -349,7 +350,7 @@
* Returns the count of reachable blocks in this method: blocks that have
* predecessors (or are the start block)
*
- * @return >= 0; number of reachable basic blocks
+ * @return {@code >= 0;} number of reachable basic blocks
*/
public int getCountReachableBlocks() {
int ret = 0;
@@ -444,7 +445,7 @@
}
/**
* Adds specified insn to the uses list for all of its sources.
- * @param insn non-null; insn to process
+ * @param insn {@code non-null;} insn to process
*/
private void addToUses(SsaInsn insn) {
RegisterSpecList rl = insn.getSources();
@@ -466,9 +467,9 @@
/**
* Updates the use list for a single change in source register.
*
- * @param insn non-null; insn being changed
- * @param oldSource null-ok; The source that was used, if applicable
- * @param newSource non-null; the new source being used
+ * @param insn {@code non-null;} insn being changed
+ * @param oldSource {@code null-ok;} The source that was used, if applicable
+ * @param newSource {@code non-null;} the new source being used
*/
void onSourceChanged(SsaInsn insn,
RegisterSpec oldSource, RegisterSpec newSource) {
@@ -491,9 +492,9 @@
/**
* Updates the use list for a source list change.
*
- * @param insn insn non-null; insn being changed. insn.getSources()
+ * @param insn {@code insn non-null;} insn being changed. insn.getSources()
* must return the new source list.
- * @param oldSources null-ok; list of sources that were previously used.
+ * @param oldSources {@code null-ok;} list of sources that were previously used.
*/
void onSourcesChanged(SsaInsn insn, RegisterSpecList oldSources) {
if (useList == null) return;
@@ -512,12 +513,12 @@
}
/**
- * Removes a given <code>insn</code> from the use lists for the given
- * <code>oldSources</code> (rather than the sources currently
+ * Removes a given {@code insn} from the use lists for the given
+ * {@code oldSources} (rather than the sources currently
* returned by insn.getSources()).
*
- * @param insn non-null; insn in question
- * @param oldSources null-ok; registers whose use lists <code>insn</code>
+ * @param insn {@code non-null;} insn in question
+ * @param oldSources {@code null-ok;} registers whose use lists {@code insn}
* should be removed form.
*/
private void removeFromUseList(SsaInsn insn, RegisterSpecList oldSources) {
@@ -536,7 +537,7 @@
* Adds an insn to both the use and def lists. For use when adding
* a new insn to the method.
*
- * @param insn non-null; insn to add
+ * @param insn {@code non-null;} insn to add
*/
void onInsnAdded(SsaInsn insn) {
onSourcesChanged(insn, null);
@@ -547,7 +548,7 @@
* Removes an instruction from use and def lists. For use during
* instruction removal.
*
- * @param insn non-null; insn to remove.
+ * @param insn {@code non-null;} insn to remove.
*/
void onInsnRemoved(SsaInsn insn) {
if (useList != null) {
@@ -579,9 +580,9 @@
/**
* Updates a single definition.
*
- * @param insn non-null; insn who's result should be recorded as
+ * @param insn {@code non-null;} insn who's result should be recorded as
* a definition
- * @param oldResult null-ok; a previous result that should be no longer
+ * @param oldResult {@code null-ok;} a previous result that should be no longer
* considered a definition by this insn
*/
void updateOneDefinition(SsaInsn insn, RegisterSpec oldResult) {
@@ -641,7 +642,7 @@
* local variable. Each SSA reg may be associated with at most one
* local var.
*
- * @param spec non-null; ssa reg
+ * @param spec {@code non-null;} ssa reg
* @return true if reg is ever associated with a local
*/
public boolean isRegALocal(RegisterSpec spec) {
@@ -681,7 +682,7 @@
/**
* Makes a new SSA register. For use after renaming has completed.
*
- * @return >=0 new SSA register.
+ * @return {@code >=0;} new SSA register.
*/
public int makeNewSsaReg() {
int reg = registerCount++;
@@ -692,7 +693,7 @@
/**
* Visit all insns in this method
- * @param visitor non-null; callback interface
+ * @param visitor {@code non-null;} callback interface
*/
public void forEachInsn(SsaInsn.Visitor visitor) {
for (SsaBasicBlock block: blocks) {
@@ -702,7 +703,7 @@
/**
* Visits each phi insn in this method
- * @param v non-null; callback
+ * @param v {@code non-null;} callback
*/
public void forEachPhiInsn(PhiInsn.Visitor v) {
for (SsaBasicBlock block: blocks) {
@@ -716,7 +717,7 @@
* method once for every block. This depth-first walk may be run forward
* from the method entry point or backwards from the method exit points.
* @param reverse true if this should walk backwards from the exit points
- * @param v non-null; callback interface. <code>parent</code>is set
+ * @param v {@code non-null;} callback interface. {@code parent}is set
* unless this is the root node
*/
public void forEachBlockDepthFirst(boolean reverse,
@@ -755,10 +756,10 @@
/**
* Visits blocks in dom-tree order, starting at the current node.
- * The <code>parent</code> parameter of the Visitor.visitBlock callback
+ * The {@code parent} parameter of the Visitor.visitBlock callback
* is currently always set to null.
*
- * @param v non-null; callback interface
+ * @param v {@code non-null;} callback interface
*/
public void forEachBlockDepthFirstDom(SsaBasicBlock.Visitor v) {
BitSet visited = new BitSet(getBlocks().size());
@@ -785,7 +786,7 @@
/**
* Deletes all insns in the set from this method
*
- * @param deletedInsns non-null; insns to delete
+ * @param deletedInsns {@code non-null;} insns to delete
*/
public void deleteInsns(Set<SsaInsn> deletedInsns) {
for (SsaBasicBlock block: getBlocks()) {
diff --git a/dx/src/com/android/dx/ssa/SsaRenamer.java b/dx/src/com/android/dx/ssa/SsaRenamer.java
index 64bad2c..9a9af3b 100644
--- a/dx/src/com/android/dx/ssa/SsaRenamer.java
+++ b/dx/src/com/android/dx/ssa/SsaRenamer.java
@@ -71,7 +71,7 @@
* Indexed by block index; register version state for each block start.
* This list is updated by each dom parent for its children. The only
* sub-arrays that exist at any one time are the start states for blocks
- * yet to be processed by a <code>BlockRenamer</code> instance.
+ * yet to be processed by a {@code BlockRenamer} instance.
*/
private final RegisterSpec[][] startsForBlocks;
@@ -87,7 +87,7 @@
/**
* Constructs an instance of the renamer
*
- * @param ssaMeth non-null; un-renamed SSA method that will
+ * @param ssaMeth {@code non-null;} un-renamed SSA method that will
* be renamed.
*/
SsaRenamer (final SsaMethod ssaMeth) {
@@ -168,8 +168,8 @@
/**
* Duplicates a RegisterSpec array
- * @param orig non-null; array to duplicate
- * @return non-null; new instance
+ * @param orig {@code non-null;} array to duplicate
+ * @return {@code non-null;} new instance
*/
private static RegisterSpec[] dupArray(RegisterSpec[] orig) {
RegisterSpec[] copy = new RegisterSpec[orig.length];
@@ -183,7 +183,7 @@
* Gets a local variable item for a specified register.
*
* @param ssaReg register in SSA name space
- * @return null-ok; Local variable name or null if none
+ * @return {@code null-ok;} Local variable name or null if none
*/
private LocalItem getLocalForNewReg(int ssaReg) {
if (ssaReg < ssaRegToLocalItems.size()) {
@@ -238,11 +238,11 @@
* as appropriate.
*/
private class BlockRenamer implements SsaInsn.Visitor{
- /** non-null; block we're processing. */
+ /** {@code non-null;} block we're processing. */
private final SsaBasicBlock block;
/**
- * non-null; indexed by old register name. The current top of the
+ * {@code non-null;} indexed by old register name. The current top of the
* version stack as seen by this block. It's initialized from
* the ending state of its dom parent, updated as the block's
* instructions are processed, and then copied to each one of its
@@ -265,10 +265,10 @@
private final RenamingMapper mapper;
/**
- * Constructs a block renamer instance. Call <code>process</code>
+ * Constructs a block renamer instance. Call {@code process}
* to process.
*
- * @param block non-null; block to process
+ * @param block {@code non-null;} block to process
*/
BlockRenamer(final SsaBasicBlock block) {
this.block = block;
@@ -388,13 +388,13 @@
* local.
* <li> ensures that only one SSA register
* at a time is considered to be associated with a local variable. When
- * <code>currentMapping</code> is updated and the newly added element
+ * {@code currentMapping} is updated and the newly added element
* is named, strip that name from any other SSA registers.
* </ol>
*
- * @param ropReg >= 0 Rop register number
- * @param ssaReg non-null; An SSA register that has just
- * been added to <code>currentMapping</code>
+ * @param ropReg {@code >= 0;} rop register number
+ * @param ssaReg {@code non-null;} an SSA register that has just
+ * been added to {@code currentMapping}
*/
private void addMapping(int ropReg, RegisterSpec ssaReg) {
int ssaRegNum = ssaReg.getReg();
diff --git a/dx/src/com/android/dx/ssa/_tests/_DomFront.java b/dx/src/com/android/dx/ssa/_tests/_DomFront.java
index 997da21..3d891c9 100644
--- a/dx/src/com/android/dx/ssa/_tests/_DomFront.java
+++ b/dx/src/com/android/dx/ssa/_tests/_DomFront.java
@@ -19,7 +19,7 @@
import junit.framework.TestCase;
/**
- * Test the class <code>com.android.dx.ssa.DomFront</code>.
+ * Test the class {@code com.android.dx.ssa.DomFront}.
*/
public class _DomFront
extends TestCase {
diff --git a/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java b/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java
index d3ff7c7..6416e84 100644
--- a/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java
+++ b/dx/src/com/android/dx/ssa/back/FirstFitAllocator.java
@@ -106,7 +106,6 @@
}
for (int j = i + 1; j < oldRegCount; j++) {
-
if (mapped.get(j) || isDefinitionMoveParam(j)) {
continue;
}
diff --git a/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java b/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java
index 14eac90..e759fe6 100644
--- a/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java
+++ b/dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java
@@ -40,9 +40,10 @@
* kept together if possible.
*/
public class FirstFitLocalCombiningAllocator extends RegisterAllocator {
+ /** local debug flag */
private static final boolean DEBUG = false;
- /** maps local variable to a list of associated SSA registers*/
+ /** maps local variable to a list of associated SSA registers */
private final Map<LocalItem, ArrayList<RegisterSpec>> localVariables;
/** list of move-result-pesudo instructions seen in this method */
@@ -69,17 +70,16 @@
/** true if converter should take steps to minimize rop-form registers*/
private final boolean minimizeRegisters;
-
/**
* Constructs instance.
*
- * @param ssaMeth non-null; method to process
+ * @param ssaMeth {@code non-null;} method to process
* @param interference non-null interference graph for SSA registers
* @param minimizeRegisters true if converter should take steps to
* minimize rop-form registers
*/
public FirstFitLocalCombiningAllocator(
- final SsaMethod ssaMeth, InterferenceGraph interference,
+ SsaMethod ssaMeth, InterferenceGraph interference,
boolean minimizeRegisters) {
super(ssaMeth, interference);
@@ -122,22 +122,24 @@
printLocalVars();
}
- if(DEBUG) System.out.println("--->Mapping local-associated params");
+ if (DEBUG) System.out.println("--->Mapping local-associated params");
handleLocalAssociatedParams();
- if(DEBUG) System.out.println("--->Mapping other params");
+ if (DEBUG) System.out.println("--->Mapping other params");
handleUnassociatedParameters();
- if(DEBUG) System.out.println("--->Mapping invoke-range");
+ if (DEBUG) System.out.println("--->Mapping invoke-range");
handleInvokeRangeInsns();
- if(DEBUG) System.out.println("--->Mapping local-associated non-params");
+ if (DEBUG) {
+ System.out.println("--->Mapping local-associated non-params");
+ }
handleLocalAssociatedOther();
- if(DEBUG) System.out.println("--->Mapping check-cast results");
+ if (DEBUG) System.out.println("--->Mapping check-cast results");
handleCheckCastResults();
- if(DEBUG) System.out.println("--->Mapping others");
+ if (DEBUG) System.out.println("--->Mapping others");
handleNormalUnassociated();
return mapper;
@@ -168,13 +170,13 @@
* Maps all local-associated parameters to Rop registers.
*/
private void handleLocalAssociatedParams() {
- for (ArrayList<RegisterSpec> ssaRegs: localVariables.values()) {
+ for (ArrayList<RegisterSpec> ssaRegs : localVariables.values()) {
int sz = ssaRegs.size();
int paramIndex = -1;
int paramCategory = 0;
// First, find out if this local variable is a parameter
- for (int i = 0 ; i < sz ; i++) {
+ for (int i = 0; i < sz; i++) {
RegisterSpec ssaSpec = ssaRegs.get(i);
int ssaReg = ssaSpec.getReg();
@@ -201,7 +203,7 @@
* Gets the parameter index for SSA registers that are method parameters.
* -1 is returned for non-parameter registers.
*
- * @param ssaReg >=0 SSA register to look up
+ * @param ssaReg {@code >=0;} SSA register to look up
* @return parameter index or -1 if not a parameter
*/
private int getParameterIndexForReg(int ssaReg) {
@@ -222,13 +224,14 @@
}
/**
- * Maps all local-associated registers that are not parameters. Tries to
- * find an unreserved range that's wide enough for all of the SSA registers,
- * and then tries to map them all to that range. If not all fit,
- * a new range is tried until all registers have been fit.
+ * Maps all local-associated registers that are not parameters.
+ * Tries to find an unreserved range that's wide enough for all of
+ * the SSA registers, and then tries to map them all to that
+ * range. If not all fit, a new range is tried until all registers
+ * have been fit.
*/
private void handleLocalAssociatedOther() {
- for (ArrayList<RegisterSpec> specs: localVariables.values()) {
+ for (ArrayList<RegisterSpec> specs : localVariables.values()) {
int ropReg = 0;
boolean done;
@@ -261,8 +264,8 @@
* used rop space as reserved. SSA registers that don't fit are left
* unmapped.
*
- * @param specs non-null; SSA registers to attempt to map
- * @param ropReg >=0 rop register to map to
+ * @param specs {@code non-null;} SSA registers to attempt to map
+ * @param ropReg {@code >=0;} rop register to map to
* @param maxAllowedCategory 1 or 2, maximum category allowed in mapping.
* @param markReserved do so if true
* @return true if all registers wew mapped, false if some remain unmapped.
@@ -271,7 +274,7 @@
ArrayList<RegisterSpec> specs, int ropReg,
int maxAllowedCategory, boolean markReserved) {
boolean remaining = false;
- for(RegisterSpec spec: specs) {
+ for (RegisterSpec spec : specs) {
if (ssaRegsMapped.get(spec.getReg())) {
continue;
}
@@ -291,8 +294,8 @@
/**
* Tries to map an SSA register to a rop register.
*
- * @param ssaSpec non-null; SSA register
- * @param ropReg >=0 rop register
+ * @param ssaSpec {@code non-null;} SSA register
+ * @param ropReg {@code >=0;} rop register
* @param maxAllowedCategory 1 or 2, the maximum category that the SSA
* register is allowed to be.
* @return true if map succeeded, false if not.
@@ -312,8 +315,8 @@
/**
* Marks a range of Rop registers as "reserved for a local variable"
*
- * @param ropReg >= 0 rop register to reserve
- * @param category > 0 width to reserve
+ * @param ropReg {@code >= 0;} rop register to reserve
+ * @param category {@code > 0;} width to reserve
*/
private void markReserved(int ropReg, int category) {
reservedRopRegs.set(ropReg, ropReg + category, true);
@@ -323,8 +326,8 @@
* Checks to see if any Rop registers in the specified range are reserved
* for local variables or parameters
*
- * @param ropRangeStart >= 0 lowest Rop register
- * @param width > 0 number of Rop registers in range.
+ * @param ropRangeStart {@code >= 0;} lowest Rop register
+ * @param width {@code > 0;} number of Rop registers in range.
* @return true if any register in range is marked reserved
*/
private boolean rangeContainsReserved(int ropRangeStart, int width) {
@@ -351,9 +354,9 @@
/**
* Finds a range of unreserved Rop registers.
*
- * @param startReg >= 0; a Rop register to start the search at
- * @param width > 0; the width, in registers, required.
- * @return >= 0; start of available register range.
+ * @param startReg {@code >= 0;} a Rop register to start the search at
+ * @param width {@code > 0;} the width, in registers, required.
+ * @return {@code >= 0;} start of available register range.
*/
private int findNextUnreservedRopReg(int startReg, int width) {
if (minimizeRegisters && !isThisPointerReg(startReg)) {
@@ -381,12 +384,12 @@
/**
* Finds a range of rop regs that can be used for local variables.
- * If <code>MIX_LOCALS_AND_OTHER</code> is false, this means any
+ * If {@code MIX_LOCALS_AND_OTHER} is false, this means any
* rop register that has not yet been used.
*
- * @param startReg >= 0; a Rop register to start the search at
- * @param width > 0; the width, in registers, required.
- * @return >= 0; start of available register range.
+ * @param startReg {@code >= 0;} a Rop register to start the search at
+ * @param width {@code > 0;} the width, in registers, required.
+ * @return {@code >= 0;} start of available register range.
*/
private int findRopRegForLocal(int startReg, int width) {
if (minimizeRegisters && !isThisPointerReg(startReg)) {
@@ -418,6 +421,7 @@
*/
private void handleUnassociatedParameters() {
int szSsaRegs = ssaMeth.getRegCount();
+
for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) {
if (ssaRegsMapped.get(ssaReg)) {
// We already did this one above
@@ -437,7 +441,7 @@
* Handles all insns that want a register range for their sources.
*/
private void handleInvokeRangeInsns() {
- for(NormalSsaInsn insn: invokeRangeInsns) {
+ for(NormalSsaInsn insn : invokeRangeInsns) {
adjustAndMapSourceRangeRange(insn);
}
}
@@ -503,6 +507,7 @@
*/
private void handleNormalUnassociated() {
int szSsaRegs = ssaMeth.getRegCount();
+
for (int ssaReg = 0; ssaReg < szSsaRegs; ssaReg++) {
if (ssaRegsMapped.get(ssaReg)) {
// We already did this one
@@ -525,11 +530,11 @@
}
/**
- * Checks to see if <code>ssaSpec</code> can be mapped to
- * <code>ropReg</code>. Checks interference graph and ensures
+ * Checks to see if {@code ssaSpec} can be mapped to
+ * {@code ropReg}. Checks interference graph and ensures
* the range does not cross the parameter range.
*
- * @param ssaSpec non-null; SSA spec
+ * @param ssaSpec {@code non-null;} SSA spec
* @param ropReg prosepctive new-namespace reg
* @return true if mapping is possible
*/
@@ -541,7 +546,7 @@
/**
* Returns true if the specified Rop register + category
- * will cross the boundry between the lower <code>paramWidth</code>
+ * will cross the boundry between the lower {@code paramWidth}
* registers reserved for method params and the upper registers. We cannot
* allocate a register that spans the param block and the normal block,
* because we will be moving the param block to high registers later.
@@ -561,7 +566,6 @@
*/
private void analyzeInstructions() {
ssaMeth.forEachInsn(new SsaInsn.Visitor() {
-
/** {@inheritDoc} */
public void visitMoveInsn(NormalSsaInsn insn) {
processInsn(insn);
@@ -580,14 +584,14 @@
/**
* This method collects three types of instructions:
* 1) Adds a local variable assignment to the
- * <code>localVariables</code> map.
+ * {@code localVariables} map.
* 2) Add move-result-pseudo to the
- * <code>moveResultPseudoInsns</code> list.
+ * {@code moveResultPseudoInsns} list.
* 3) Add invoke-range to the
- * <code>invokeRangeInsns</code> list.
+ * {@code invokeRangeInsns} list.
*
- * @param insn non-null; insn that may represent a local variable
- * assignment.
+ * @param insn {@code non-null;} insn that may represent a
+ * local variable assignment
*/
private void processInsn(SsaInsn insn) {
RegisterSpec assignment;
@@ -596,7 +600,8 @@
if (assignment != null) {
LocalItem local = assignment.getLocalItem();
- ArrayList<RegisterSpec> regList = localVariables.get(local);
+ ArrayList<RegisterSpec> regList
+ = localVariables.get(local);
if (regList == null) {
regList = new ArrayList<RegisterSpec>();
@@ -622,11 +627,11 @@
}
/**
- * Adds a mapping from an SSA register to a Rop register. <code>
- * canMapReg</code> should have already been called.
+ * Adds a mapping from an SSA register to a Rop register.
+ * {@link #canMapReg} should have already been called.
*
- * @param ssaSpec non-null; SSA register to map from
- * @param ropReg >=0; Rop register to map to
+ * @param ssaSpec {@code non-null;} SSA register to map from
+ * @param ropReg {@code >=0;} Rop register to map to
*/
private void addMapping(RegisterSpec ssaSpec, int ropReg) {
int ssaReg = ssaSpec.getReg();
@@ -639,8 +644,7 @@
if (DEBUG) {
System.out.printf("Add mapping s%d -> v%d c:%d\n",
- ssaSpec.getReg(), ropReg, ssaSpec.getCategory());
-
+ ssaSpec.getReg(), ropReg, ssaSpec.getCategory());
}
int category = ssaSpec.getCategory();
@@ -655,16 +659,15 @@
* will fall in a contiguous range in Rop form. Moves are inserted as
* necessary to allow the range to be allocated.
*
- * @param insn non-null; insn whos sources to process
+ * @param insn {@code non-null;} insn whos sources to process
*/
private void adjustAndMapSourceRangeRange(NormalSsaInsn insn) {
- int newRegStart;
-
- newRegStart = findRangeAndAdjust(insn);
+ int newRegStart = findRangeAndAdjust(insn);
RegisterSpecList sources = insn.getSources();
int szSources = sources.size();
int nextRopReg = newRegStart;
+
for (int i = 0; i < szSources; i++) {
RegisterSpec source = sources.get(i);
int sourceReg = source.getReg();
@@ -708,10 +711,10 @@
* instruction's sources. First, try to center the range around
* sources that have already been mapped to Rop registers. If that fails,
* just find a new contiguous range that doesn't interfere.
-
- * @param insn non-null; the insn whose sources need to fit. Must be
- * last insn in basic block.
- * @return >= 0 rop register of start of range
+ *
+ * @param insn {@code non-null;} the insn whose sources need to
+ * fit. Must be last insn in basic block.
+ * @return {@code >= 0;} rop register of start of range
*/
private int findRangeAndAdjust(NormalSsaInsn insn) {
RegisterSpecList sources = insn.getSources();
@@ -811,11 +814,11 @@
* specified instruction. Does not bother trying to center the range
* around an already-mapped source register;
*
- * @param insn non-null; insn to build range for
- * @param rangeLength >=0 length required in register units.
- * @param categoriesForIndex non-null; indexed by source index;
+ * @param insn {@code non-null;} insn to build range for
+ * @param rangeLength {@code >=0;} length required in register units.
+ * @param categoriesForIndex {@code non-null;} indexed by source index;
* the category for each source.
- * @param outMovesRequired non-null; an output parameter indexed by
+ * @param outMovesRequired {@code non-null;} an output parameter indexed by
* source index that will contain the set of sources which need
* moves inserted.
* @return the rop register that starts the fitting range.
@@ -842,11 +845,11 @@
* Attempts to build a plan for fitting a range of sources into rop
* registers.
*
- * @param ropReg >=0 rop reg that begins range
- * @param insn non-null; insn to plan range for
- * @param categoriesForIndex non-null; indexed by source index;
+ * @param ropReg {@code >= 0;} rop reg that begins range
+ * @param insn {@code non-null;} insn to plan range for
+ * @param categoriesForIndex {@code non-null;} indexed by source index;
* the category for each source.
- * @param outMovesRequired non-null; an output parameter indexed by
+ * @param outMovesRequired {@code non-null;} an output parameter indexed by
* source index that will contain the set of sources which need
* moves inserted.
* @return the width of the fit that that does not involve added moves or
@@ -912,7 +915,7 @@
* Converts a bit set of SSA registers into a RegisterSpecList containing
* the definition specs of all the registers.
*
- * @param ssaSet non-null; set of SSA registers
+ * @param ssaSet {@code non-null;} set of SSA registers
* @return list of RegisterSpecs as noted above
*/
RegisterSpecList ssaSetToSpecs(IntSet ssaSet) {
@@ -931,14 +934,14 @@
/**
* Gets a local item associated with an ssa register, if one exists
*
- * @param ssaReg >= 0 SSA register
- * @return null-ok; associated local item or null
+ * @param ssaReg {@code >= 0;} SSA register
+ * @return {@code null-ok;} associated local item or null
*/
private LocalItem getLocalItemForReg(int ssaReg) {
for(Map.Entry<LocalItem, ArrayList<RegisterSpec>> entry:
localVariables.entrySet()) {
- for (RegisterSpec spec: entry.getValue()) {
+ for (RegisterSpec spec : entry.getValue()) {
if (spec.getReg() == ssaReg) {
return entry.getKey();
}
diff --git a/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java b/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java
index abc5fca..a639af5 100644
--- a/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java
+++ b/dx/src/com/android/dx/ssa/back/IdenticalBlockCombiner.java
@@ -34,14 +34,14 @@
* frequently are created when catch blocks are edge-split.
*/
public class IdenticalBlockCombiner {
-
- private RopMethod ropMethod;
- private BasicBlockList blocks;
- private BasicBlockList newBlocks;
+ private final RopMethod ropMethod;
+ private final BasicBlockList blocks;
+ private final BasicBlockList newBlocks;
/**
- * Constructs instance. Call <code>process()</code> to run.
- * @param rm instance to process
+ * Constructs instance. Call {@code process()} to run.
+ *
+ * @param rm {@code non-null;} instance to process
*/
public IdenticalBlockCombiner(RopMethod rm) {
ropMethod = rm;
@@ -50,10 +50,11 @@
}
/**
- * Runs algorithm. TODO: this is n^2, and could be made linear-ish with
- * a hash.
+ * Runs algorithm. TODO: This is n^2, and could be made linear-ish with
+ * a hash. In particular, hash the contents of each block and only
+ * compare blocks with the same hash.
*
- * @return new method that has been processed
+ * @return {@code non-null;} new method that has been processed
*/
public RopMethod process() {
int szBlocks = blocks.size();
@@ -78,14 +79,15 @@
BasicBlock iBlock = blocks.labelToBlock(iLabel);
- if (toDelete.get(iLabel) || iBlock.getSuccessors().size() > 1) {
+ if (toDelete.get(iLabel)
+ || iBlock.getSuccessors().size() > 1) {
continue;
}
IntList toCombine = new IntList();
// ...and see if they can be combined with any other preds...
- for (int j = i + 1; j <szPreds; j++) {
+ for (int j = i + 1; j < szPreds; j++) {
int jLabel = preds.get(j);
BasicBlock jBlock = blocks.labelToBlock(jLabel);
@@ -101,7 +103,7 @@
}
}
- for (int i = szBlocks - 1; i > 0; i--) {
+ for (int i = szBlocks - 1; i >= 0; i--) {
if (toDelete.get(newBlocks.get(i).getLabel())) {
newBlocks.set(i, null);
}
@@ -113,7 +115,14 @@
return new RopMethod(newBlocks, ropMethod.getFirstLabel());
}
- private boolean compareInsns(BasicBlock a, BasicBlock b) {
+ /**
+ * Helper method to compare the contents of two blocks.
+ *
+ * @param a {@code non-null;} a block to compare
+ * @param b {@code non-null;} another block to compare
+ * @return {@code true} iff the two blocks' instructions are the same
+ */
+ private static boolean compareInsns(BasicBlock a, BasicBlock b) {
return a.getInsns().contentEquals(b.getInsns());
}
@@ -131,11 +140,7 @@
for (int i = 0; i < szBetas; i++) {
int betaLabel = betaLabels.get(i);
BasicBlock bb = blocks.labelToBlock(betaLabel);
-
- IntList preds;
-
- preds = ropMethod.labelToPredecessors(bb.getLabel());
-
+ IntList preds = ropMethod.labelToPredecessors(bb.getLabel());
int szPreds = preds.size();
for (int j = 0; j < szPreds; j++) {
@@ -147,19 +152,19 @@
/**
* Replaces one of a block's successors with a different label. Constructs
- * an updated BasicBlock instance and places it in <code>newBlocks</code>.
+ * an updated BasicBlock instance and places it in {@code newBlocks}.
*
* @param block block to replace
* @param oldLabel label of successor to replace
* @param newLabel label of new successor
*/
private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
-
IntList newSuccessors = block.getSuccessors().mutableCopy();
int newPrimarySuccessor;
newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
newPrimarySuccessor = block.getPrimarySuccessor();
+
if (newPrimarySuccessor == oldLabel) {
newPrimarySuccessor = newLabel;
}
diff --git a/dx/src/com/android/dx/ssa/back/InterferenceGraph.java b/dx/src/com/android/dx/ssa/back/InterferenceGraph.java
index 282420b..e6cde62 100644
--- a/dx/src/com/android/dx/ssa/back/InterferenceGraph.java
+++ b/dx/src/com/android/dx/ssa/back/InterferenceGraph.java
@@ -34,14 +34,17 @@
* A register interference graph
*/
public class InterferenceGraph {
- /** interference graph, indexed by register in both dimensions */
+ /**
+ * {@code non-null;} interference graph, indexed by register in
+ * both dimensions
+ */
private final ArrayList<IntSet> interference;
/**
* Creates a new graph.
*
- * @param countRegs >=0 the start count of registers in the namespace.
- * New registers can be added subsequently.
+ * @param countRegs {@code >= 0;} the start count of registers in
+ * the namespace. New registers can be added subsequently.
*/
public InterferenceGraph(int countRegs) {
interference = new ArrayList<IntSet>(countRegs);
@@ -83,9 +86,9 @@
/**
* Merges the interference set for a register into a given bit set
*
- * @param reg >=0 register
- * @param set non-null; interference set; will be merged with set for
- * given register
+ * @param reg {@code >= 0;} register
+ * @param set {@code non-null;} interference set; will be merged
+ * with set for given register
*/
public void mergeInterferenceSet(int reg, IntSet set) {
if (reg < interference.size()) {
@@ -100,8 +103,10 @@
*/
private void ensureCapacity(int size) {
int countRegs = interference.size();
+
interference.ensureCapacity(size);
- for (int i = countRegs ; i < size; i++) {
+
+ for (int i = countRegs; i < size; i++) {
interference.add(SetFactory.makeInterferenceSet(size));
}
}
diff --git a/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java b/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java
index 5ae6e07..6d60651 100644
--- a/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java
+++ b/dx/src/com/android/dx/ssa/back/LivenessAnalyzer.java
@@ -28,28 +28,27 @@
/**
* From Appel "Modern Compiler Implementation in Java" algorithm 19.17
- * Calculate the live ranges for register <code>reg</code>.<p>
+ * Calculate the live ranges for register {@code reg}.<p>
*
* v = regV <p>
* s = insn <p>
* M = visitedBlocks <p>
*/
public class LivenessAnalyzer {
-
/**
- * non-null; index by basic block indexed set of basic blocks
+ * {@code non-null;} index by basic block indexed set of basic blocks
* that have already been visited. "M" as written in the original Appel
* algorithm.
*/
private final BitSet visitedBlocks;
/**
- * non-null; set of blocks remaing to visit as "live out as block"
+ * {@code non-null;} set of blocks remaing to visit as "live out as block"
*/
private final BitSet liveOutBlocks;
/**
- * >=0; SSA register currently being analyzed.
+ * {@code >=0;} SSA register currently being analyzed.
* "v" in the original Appel algorithm.
*/
private final int regV;
@@ -63,7 +62,7 @@
/** block "n" in Appel 19.17 */
SsaBasicBlock blockN;
- /** index of statement <code>s</code> in <code>blockN</code>*/
+ /** index of statement {@code s} in {@code blockN}*/
private int statementIndex;
/** the next function to call. one of the four constants below */
@@ -77,12 +76,12 @@
/**
* Runs register liveness algorithm for a method, updating the
- * live in/out information in <code>SsaBasicBlock</code> instances and
+ * live in/out information in {@code SsaBasicBlock} instances and
* returning an interference graph.
*
- * @param ssaMeth non-null; Method to process.
- * @return non-null; interference graph indexed by SSA registers in both
- * directions.
+ * @param ssaMeth {@code non-null;} Method to process.
+ * @return {@code non-null;} interference graph indexed by SSA
+ * registers in both directions.
*/
public static InterferenceGraph constructInterferenceGraph(
SsaMethod ssaMeth) {
@@ -102,13 +101,13 @@
/**
* Makes liveness analyzer instance for specific register.
*
- * @param ssaMeth non-null; method to process
+ * @param ssaMeth {@code non-null;} method to process
* @param reg register whose liveness to analyze
- * @param interference non-null; indexed by SSA reg in both dimensions;
- * graph to update
+ * @param interference {@code non-null;} indexed by SSA reg in
+ * both dimensions; graph to update
*
*/
- private LivenessAnalyzer(final SsaMethod ssaMeth, final int reg,
+ private LivenessAnalyzer(SsaMethod ssaMeth, int reg,
InterferenceGraph interference) {
this.ssaMeth = ssaMeth;
this.regV = reg;
@@ -118,10 +117,9 @@
}
/**
- * The algorithm in Appel is presented in
- * partial tail-recursion form. Obviously, that's not
- * efficient in java, so this function serves
- * as the dispatcher instead.
+ * The algorithm in Appel is presented in partial tail-recursion
+ * form. Obviously, that's not efficient in java, so this function
+ * serves as the dispatcher instead.
*/
private void handleTailRecursion() {
while (nextFunction != DONE) {
@@ -152,7 +150,7 @@
public void run() {
List<SsaInsn> useList = ssaMeth.getUseListForRegister(regV);
- for (SsaInsn insn: useList) {
+ for (SsaInsn insn : useList) {
nextFunction = DONE;
if (insn instanceof PhiInsn) {
@@ -212,7 +210,6 @@
* "v is live-in at s"
*/
private void liveInAtStatement() {
-
// if s is the first statement in block N
if (statementIndex == 0) {
// v is live-in at n
@@ -232,7 +229,6 @@
* "v is live-out at s"
*/
private void liveOutAtStatement() {
-
SsaInsn statement = blockN.getInsns().get(statementIndex);
RegisterSpec rs = statement.getResult();
@@ -253,12 +249,12 @@
* as the result of another phi, and the phi removal move scheduler may
* generate moves that over-write the live result.
*
- * @param ssaMeth non-null; method to pricess
- * @param interference non-null; interference graph
+ * @param ssaMeth {@code non-null;} method to pricess
+ * @param interference {@code non-null;} interference graph
*/
private static void coInterferePhis(SsaMethod ssaMeth,
InterferenceGraph interference) {
- for (SsaBasicBlock b: ssaMeth.getBlocks()) {
+ for (SsaBasicBlock b : ssaMeth.getBlocks()) {
List<SsaInsn> phis = b.getPhiInsns();
int szPhis = phis.size();
diff --git a/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java b/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java
index cd3b2f1..f6dc961 100644
--- a/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java
+++ b/dx/src/com/android/dx/ssa/back/NullRegisterAllocator.java
@@ -29,11 +29,9 @@
* about normal or wide categories. Used for debugging.
*/
public class NullRegisterAllocator extends RegisterAllocator {
-
/** {@inheritDoc} */
- public NullRegisterAllocator(
- final SsaMethod ssaMeth, final InterferenceGraph interference) {
-
+ public NullRegisterAllocator(SsaMethod ssaMeth,
+ InterferenceGraph interference) {
super(ssaMeth, interference);
}
@@ -49,8 +47,7 @@
public RegisterMapper allocateRegisters() {
int oldRegCount = ssaMeth.getRegCount();
- BasicRegisterMapper mapper
- = new BasicRegisterMapper(oldRegCount);
+ BasicRegisterMapper mapper = new BasicRegisterMapper(oldRegCount);
for (int i = 0; i < oldRegCount; i++) {
mapper.addMapping(i, i*2, 2);
diff --git a/dx/src/com/android/dx/ssa/back/RegisterAllocator.java b/dx/src/com/android/dx/ssa/back/RegisterAllocator.java
index 764b03a..127fc83 100644
--- a/dx/src/com/android/dx/ssa/back/RegisterAllocator.java
+++ b/dx/src/com/android/dx/ssa/back/RegisterAllocator.java
@@ -37,7 +37,6 @@
* Base class of all register allocators
*/
public abstract class RegisterAllocator {
-
/** method being processed */
protected final SsaMethod ssaMeth;
@@ -45,13 +44,13 @@
protected final InterferenceGraph interference;
/**
- * Creates an instance. Call <code>allocateRegisters</code> to run.
+ * Creates an instance. Call {@code allocateRegisters} to run.
* @param ssaMeth method to process.
* @param interference Interference graph, indexed by register in both
* dimensions.
*/
- public RegisterAllocator(
- final SsaMethod ssaMeth, final InterferenceGraph interference) {
+ public RegisterAllocator(SsaMethod ssaMeth,
+ InterferenceGraph interference) {
this.ssaMeth = ssaMeth;
this.interference = interference;
}
@@ -61,24 +60,25 @@
* of the namespace, and thus should be moved up to the top of the
* namespace after phi removal.
*
- * @return true if params should be moved from low to high.
+ * @return {@code true} if params should be moved from low to high
*/
public abstract boolean wantsParamsMovedHigh();
/**
* Runs the algorithm.
- * @return a register mapper to apply to the <code>SsaMethod</code>
+ *
+ * @return a register mapper to apply to the {@code SsaMethod}
*/
public abstract RegisterMapper allocateRegisters();
/**
* Returns the category (width) of the definition site of the register.
- * Returns 1 for undefined registers.
+ * Returns {@code 1} for undefined registers.
*
* @param reg register
- * @return 1 or 2
+ * @return {@code 1..2}
*/
- protected int getCategoryForSsaReg(int reg) {
+ protected final int getCategoryForSsaReg(int reg) {
SsaInsn definition;
definition = ssaMeth.getDefinitionForRegister(reg);
@@ -93,25 +93,26 @@
/**
* Returns the RegisterSpec of the definition of the register.
*
- * @param reg >= 0 SSA register
+ * @param reg {@code >= 0;} SSA register
* @return definition spec of the register or null if it is never defined
- * (for the case of "version 0" SSA registers).
+ * (for the case of "version 0" SSA registers)
*/
- protected RegisterSpec getDefinitionSpecForSsaReg(int reg) {
- SsaInsn definition;
- definition = ssaMeth.getDefinitionForRegister(reg);
+ protected final RegisterSpec getDefinitionSpecForSsaReg(int reg) {
+ SsaInsn definition = ssaMeth.getDefinitionForRegister(reg);
return definition == null ? null : definition.getResult();
}
/**
* Returns true if the definition site of this register is a
- * move-param (ie, this is a method parameter)
+ * move-param (ie, this is a method parameter).
+ *
* @param reg register in question
* @return true if this is a method parameter
*/
protected boolean isDefinitionMoveParam(int reg) {
SsaInsn defInsn = ssaMeth.getDefinitionForRegister(reg);
+
if (defInsn instanceof NormalSsaInsn) {
NormalSsaInsn ndefInsn = (NormalSsaInsn) defInsn;
@@ -127,10 +128,10 @@
* interference graph in the process. The insn currently must be the
* last insn in a block.
*
- * @param insn non-null; insn to insert move before, must be last insn
- * in block.
- * @param reg non-null; SSA register to duplicate
- * @return non-null; spec of new SSA register created by move
+ * @param insn {@code non-null;} insn to insert move before, must
+ * be last insn in block
+ * @param reg {@code non-null;} SSA register to duplicate
+ * @return {@code non-null;} spec of new SSA register created by move
*/
protected final RegisterSpec insertMoveBefore(SsaInsn insn,
RegisterSpec reg) {
@@ -155,19 +156,17 @@
}
/*
- * Get new register and make new move instruction
+ * Get new register and make new move instruction.
*/
- // new result must not have associated local variable
+ // The new result must not have an associated local variable.
RegisterSpec newRegSpec = RegisterSpec.make(ssaMeth.makeNewSsaReg(),
reg.getTypeBearer());
- SsaInsn toAdd;
-
- toAdd = SsaInsn.makeFromRop(
- new PlainInsn(Rops.opMove(newRegSpec.getType()),
- SourcePosition.NO_INFO, newRegSpec,
- RegisterSpecList.make(reg)), block);
+ SsaInsn toAdd = SsaInsn.makeFromRop(
+ new PlainInsn(Rops.opMove(newRegSpec.getType()),
+ SourcePosition.NO_INFO, newRegSpec,
+ RegisterSpecList.make(reg)), block);
insns.add(insnIndex, toAdd);
diff --git a/dx/src/com/android/dx/ssa/back/SsaToRop.java b/dx/src/com/android/dx/ssa/back/SsaToRop.java
index 1c59549..817912f 100644
--- a/dx/src/com/android/dx/ssa/back/SsaToRop.java
+++ b/dx/src/com/android/dx/ssa/back/SsaToRop.java
@@ -38,7 +38,9 @@
import com.android.dx.util.Hex;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.BitSet;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
@@ -46,55 +48,67 @@
* Converts a method in SSA form to ROP form.
*/
public class SsaToRop {
-
+ /** local debug flag */
private static final boolean DEBUG = false;
- /** non-null; method to process */
+ /** {@code non-null;} method to process */
private final SsaMethod ssaMeth;
/**
- * true if the converter should attempt to minimize
+ * {@code true} if the converter should attempt to minimize
* the rop-form register count
*/
private final boolean minimizeRegisters;
- /** interference graph */
- private InterferenceGraph interference;
+ /** {@code non-null;} interference graph */
+ private final InterferenceGraph interference;
/**
* Converts a method in SSA form to ROP form.
- * @param ssaMeth input
- * @return non-null; rop-form output
+ *
+ * @param ssaMeth {@code non-null;} method to process
+ * @param minimizeRegisters {@code true} if the converter should
+ * attempt to minimize the rop-form register count
+ * @return {@code non-null;} rop-form output
*/
public static RopMethod convertToRopMethod(SsaMethod ssaMeth,
boolean minimizeRegisters) {
return new SsaToRop(ssaMeth, minimizeRegisters).convert();
}
- private SsaToRop(final SsaMethod ssaMethod, boolean minimizeRegisters) {
+ /**
+ * Constructs an instance.
+ *
+ * @param ssaMeth {@code non-null;} method to process
+ * @param minimizeRegisters {@code true} if the converter should
+ * attempt to minimize the rop-form register count
+ */
+ private SsaToRop(SsaMethod ssaMethod, boolean minimizeRegisters) {
this.minimizeRegisters = minimizeRegisters;
this.ssaMeth = ssaMethod;
+ this.interference =
+ LivenessAnalyzer.constructInterferenceGraph(ssaMethod);
}
+ /**
+ * Performs the conversion.
+ *
+ * @return {@code non-null;} rop-form output
+ */
private RopMethod convert() {
- interference = LivenessAnalyzer.constructInterferenceGraph(ssaMeth);
-
if (DEBUG) {
interference.dumpToStdout();
}
- RegisterAllocator allocator;
- RegisterMapper mapper;
+ // These are other allocators for debugging or historical comparison:
+ // allocator = new NullRegisterAllocator(ssaMeth, interference);
+ // allocator = new FirstFitAllocator(ssaMeth, interference);
- // These are other allocators for debugging or historical comparison
+ RegisterAllocator allocator =
+ new FirstFitLocalCombiningAllocator(ssaMeth, interference,
+ minimizeRegisters);
- //allocator = new NullRegisterAllocator(ssaMeth, interference);
- //allocator = new FirstFitAllocator(ssaMeth, interference);
-
- allocator = new FirstFitLocalCombiningAllocator(ssaMeth, interference,
- minimizeRegisters);
-
- mapper = allocator.allocateRegisters();
+ RegisterMapper mapper = allocator.allocateRegisters();
if (DEBUG) {
System.out.println("Printing reg map");
@@ -113,22 +127,20 @@
removeEmptyGotos();
- RopMethod ropMethod;
-
- ropMethod = convertToRop();
-
+ RopMethod ropMethod = new RopMethod(convertBasicBlocks(),
+ ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex()));
ropMethod = new IdenticalBlockCombiner(ropMethod).process();
return ropMethod;
}
-
/**
- * Removes all blocks containing only GOTOs from the control flow. Although
- * much of this work will be done later when converting from rop to dex,
- * not all simplification cases can be handled there. Furthermore, any no-op
- * block between the exit block and blocks containing the real return or
- * throw statements must be removed.
+ * Removes all blocks containing only GOTOs from the control flow.
+ * Although much of this work will be done later when converting
+ * from rop to dex, not all simplification cases can be handled
+ * there. Furthermore, any no-op block between the exit block and
+ * blocks containing the real return or throw statements must be
+ * removed.
*/
private void removeEmptyGotos() {
final ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks();
@@ -139,8 +151,7 @@
if ((insns.size() == 1)
&& (insns.get(0).getOpcode() == Rops.GOTO)) {
-
- BitSet preds = (BitSet)b.getPredecessors().clone();
+ BitSet preds = (BitSet) b.getPredecessors().clone();
for (int i = preds.nextSetBit(0); i >= 0;
i = preds.nextSetBit(i + 1)) {
@@ -154,89 +165,52 @@
}
/**
- * This method is not presently used.
- * @return a list of registers ordered by most-frequently-used
- * to least-frequently-used. Each register is listed once and only once.
- */
- public int[] getRegistersByFrequency() {
- int regCount = ssaMeth.getRegCount();
- Integer[] ret = new Integer[ssaMeth.getRegCount()];
-
- for (int i = 0; i < regCount; i++) {
- ret[i] = i;
- }
-
- java.util.Arrays.sort(ret, new java.util.Comparator<Integer>() {
- public int compare (Integer o1, Integer o2) {
- return ssaMeth.getUseListForRegister(o2).size()
- - ssaMeth.getUseListForRegister(o1).size();
- }
-
- public boolean equals(Object o) {
- return o == this;
- }
- });
-
- int result[] = new int[regCount];
-
- for (int i = 0; i < regCount; i++) {
- result[i] = ret[i];
- }
-
- return result;
- }
-
- /**
- * See Appel 19.6
- * To remove the phi instructions in an edge-split SSA representation
- * we know we can always insert a move in a predecessor block
+ * See Appel 19.6. To remove the phi instructions in an edge-split
+ * SSA representation we know we can always insert a move in a
+ * predecessor block.
*/
private void removePhiFunctions() {
- for (SsaBasicBlock block: ssaMeth.getBlocks()) {
- // Add moves in all the pred blocks for each phi insn`
- block.forEachPhiInsn(new PhiVisitor(block));
- // Delete the phi insns
+ ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks();
+
+ for (SsaBasicBlock block : blocks) {
+ // Add moves in all the pred blocks for each phi insn.
+ block.forEachPhiInsn(new PhiVisitor(block, blocks));
+
+ // Delete the phi insns.
block.removeAllPhiInsns();
}
/*
- * After all move insns have been added: sort them so they don't
- * destructively interfere
+ * After all move insns have been added, sort them so they don't
+ * destructively interfere.
*/
- for (SsaBasicBlock block: ssaMeth.getBlocks()) {
+ for (SsaBasicBlock block : blocks) {
block.scheduleMovesFromPhis();
}
}
/**
- * PhiSuccessorUpdater for adding move instructions to predecessors based
- * on phi insns.
+ * Helper for {@link #removePhiFunctions}: PhiSuccessorUpdater for
+ * adding move instructions to predecessors based on phi insns.
*/
- private class PhiVisitor implements PhiInsn.Visitor {
- SsaBasicBlock block;
+ private static class PhiVisitor implements PhiInsn.Visitor {
+ private final SsaBasicBlock block;
+ private final ArrayList<SsaBasicBlock> blocks;
- PhiVisitor (final SsaBasicBlock block) {
+ public PhiVisitor(SsaBasicBlock block,
+ ArrayList<SsaBasicBlock> blocks) {
this.block = block;
+ this.blocks = blocks;
}
- public void visitPhiInsn (PhiInsn insn) {
- RegisterSpecList sources;
- RegisterSpec result;
- ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks();
-
- sources = insn.getSources();
- result = insn.getResult();
-
+ public void visitPhiInsn(PhiInsn insn) {
+ RegisterSpecList sources = insn.getSources();
+ RegisterSpec result = insn.getResult();
int sz = sources.size();
- for (int i = 0; i <sz; i++) {
- RegisterSpec source;
-
- source = sources.get(i);
-
- SsaBasicBlock predBlock;
-
- predBlock = blocks.get(
+ for (int i = 0; i < sz; i++) {
+ RegisterSpec source = sources.get(i);
+ SsaBasicBlock predBlock = blocks.get(
insn.predBlockIndexForSourcesIndex(i));
predBlock.addMoveToEnd(result, source);
@@ -250,9 +224,7 @@
* Dalvik calling convention.
*/
private void moveParametersToHighRegisters() {
-
int paramWidth = ssaMeth.getParamWidth();
-
BasicRegisterMapper mapper
= new BasicRegisterMapper(ssaMeth.getRegCount());
int regCount = ssaMeth.getRegCount();
@@ -273,29 +245,25 @@
ssaMeth.mapRegisters(mapper);
}
- private RopMethod convertToRop() {
- return new RopMethod(convertBasicBlocks(),
- ssaMeth.blockIndexToRopLabel(ssaMeth.getEntryBlockIndex()));
- }
-
/**
* @return rop-form basic block list
*/
private BasicBlockList convertBasicBlocks() {
ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks();
- // Exit block may be null
+
+ // Exit block may be null.
SsaBasicBlock exitBlock = ssaMeth.getExitBlock();
int ropBlockCount = ssaMeth.getCountReachableBlocks();
- // Don't count the exit block, if it exists
+ // Don't count the exit block, if it exists.
ropBlockCount -= (exitBlock == null) ? 0 : 1;
BasicBlockList result = new BasicBlockList(ropBlockCount);
- // Convert all the reachable blocks except the exit block
+ // Convert all the reachable blocks except the exit block.
int ropBlockIndex = 0;
- for(SsaBasicBlock b : blocks) {
+ for (SsaBasicBlock b : blocks) {
if (b.isReachable() && b != exitBlock) {
result.set(ropBlockIndex++, convertBasicBlock(b));
}
@@ -303,8 +271,8 @@
// The exit block, which is discarded, must do nothing.
if (exitBlock != null && exitBlock.getInsns().size() != 0) {
- throw new RuntimeException
- ("Exit block must have no insns when leaving SSA form");
+ throw new RuntimeException(
+ "Exit block must have no insns when leaving SSA form");
}
return result;
@@ -314,11 +282,10 @@
* Validates that a basic block is a valid end predecessor. It must
* end in a RETURN or a THROW. Throws a runtime exception on error.
*
- * @param b non-null; block to validate
+ * @param b {@code non-null;} block to validate
* @throws RuntimeException on error
*/
private void verifyValidExitPredecessor(SsaBasicBlock b) {
-
ArrayList<SsaInsn> insns = b.getInsns();
SsaInsn lastInsn = insns.get(insns.size() - 1);
Rop opcode = lastInsn.getOpcode();
@@ -334,22 +301,21 @@
* Converts a single basic block to rop form.
*
* @param block SSA block to process
- * @return ROP block
+ * @return {@code non-null;} ROP block
*/
private BasicBlock convertBasicBlock(SsaBasicBlock block) {
- BasicBlock result;
IntList successorList = block.getRopLabelSuccessorList();
int primarySuccessorLabel = block.getPrimarySuccessorRopLabel();
- // Filter out any reference to the SSA form's exit block
- // exit block may be null
+ // Filter out any reference to the SSA form's exit block.
+
+ // Exit block may be null.
SsaBasicBlock exitBlock = ssaMeth.getExitBlock();
-
int exitRopLabel = (exitBlock == null) ? -1 : exitBlock.getRopLabel();
if (successorList.contains(exitRopLabel)) {
if (successorList.size() > 1) {
- throw new RuntimeException (
+ throw new RuntimeException(
"Exit predecessor must have no other successors"
+ Hex.u2(block.getRopLabel()));
} else {
@@ -362,7 +328,7 @@
successorList.setImmutable();
- result = new BasicBlock(
+ BasicBlock result = new BasicBlock(
block.getRopLabel(), convertInsns(block.getInsns()),
successorList,
primarySuccessorLabel);
@@ -371,16 +337,14 @@
}
/**
- * Converts an insn list to rop form
- * @param ssaInsns non-null;old instructions
- * @return non-null; immutable instruction list
+ * Converts an insn list to rop form.
+ *
+ * @param ssaInsns {@code non-null;} old instructions
+ * @return {@code non-null;} immutable instruction list
*/
private InsnList convertInsns(ArrayList<SsaInsn> ssaInsns) {
- InsnList result;
- int insnCount;
-
- insnCount = ssaInsns.size();
- result = new InsnList (insnCount);
+ int insnCount = ssaInsns.size();
+ InsnList result = new InsnList(insnCount);
for (int i = 0; i < insnCount; i++) {
result.set(i, ssaInsns.get(i).toRopInsn());
@@ -390,4 +354,35 @@
return result;
}
+
+ /**
+ * <b>Note:</b> This method is not presently used.
+ *
+ * @return a list of registers ordered by most-frequently-used to
+ * least-frequently-used. Each register is listed once and only
+ * once.
+ */
+ public int[] getRegistersByFrequency() {
+ int regCount = ssaMeth.getRegCount();
+ Integer[] ret = new Integer[regCount];
+
+ for (int i = 0; i < regCount; i++) {
+ ret[i] = i;
+ }
+
+ Arrays.sort(ret, new Comparator<Integer>() {
+ public int compare(Integer o1, Integer o2) {
+ return ssaMeth.getUseListForRegister(o2).size()
+ - ssaMeth.getUseListForRegister(o1).size();
+ }
+ });
+
+ int result[] = new int[regCount];
+
+ for (int i = 0; i < regCount; i++) {
+ result[i] = ret[i];
+ }
+
+ return result;
+ }
}
diff --git a/dx/src/com/android/dx/ssa/package-info.java b/dx/src/com/android/dx/ssa/package-info.java
index 45d9ad6..582a327 100644
--- a/dx/src/com/android/dx/ssa/package-info.java
+++ b/dx/src/com/android/dx/ssa/package-info.java
@@ -19,7 +19,7 @@
/**
* <h1>An introduction to SSA Form</h1>
*
- * This package contains classes associated with dx's <code>SSA</code>
+ * This package contains classes associated with dx's {@code SSA}
* intermediate form. This form is a static-single-assignment representation of
* Rop-form a method with Rop-form-like instructions (with the addition of a
* {@link PhiInsn phi instriction}. This form is intended to make it easy to
@@ -47,7 +47,7 @@
* <li> {@link PhiInsn} instances represent "phi" operators defined in SSA
* literature. They must be the first N instructions in a basic block.
* <li> {@link NormalSsaInsn} instances represent instructions that directly
- * correspond to <code>Rop</code> form.
+ * correspond to {@code Rop} form.
* </ul>
*
* <h3>Classes related to optimization steps</h3>
@@ -74,14 +74,14 @@
*
* <h3>Conversion into SSA Form</h3>
*
- * {@link SsaConverter#convertToSsaMethod} takes a <code>RopMethod</code> and
- * returns a fully-converted <code>SsaMethod</code>. The conversion process
+ * {@link SsaConverter#convertToSsaMethod} takes a {@code RopMethod} and
+ * returns a fully-converted {@code SsaMethod}. The conversion process
* is roughly as follows:
*
* <ol>
* <li> The Rop-form method, its blocks and their instructions are directly
- * wrapped in <code>SsaMethod</code>, <code>SsaBasicBlock</code> and
- * <code>SsaInsn</code> instances. Nothing else changes.
+ * wrapped in {@code SsaMethod}, {@code SsaBasicBlock} and
+ * {@code SsaInsn} instances. Nothing else changes.
* <li> Critical control-flow graph edges are {@link SsaConverter#edgeSplit
* split} and new basic blocks inserted as required to meet the constraints
* necessary for the ultimate SSA representation.
@@ -89,7 +89,7 @@
* Rop registers to local variables necessary during phi placement. This
* step could also be done in Rop form and then updated through the preceding
* steps.
- * <li> <code>Phi</code> instructions are {link SsaConverter#placePhiFunctions}
+ * <li> {@code Phi} instructions are {link SsaConverter#placePhiFunctions}
* placed in a semi-pruned fashion, which requires computation of {@link
* Dominators dominance graph} and each node's {@link DomFront
* dominance-frontier set}.
diff --git a/dx/src/com/android/dx/util/AnnotatedOutput.java b/dx/src/com/android/dx/util/AnnotatedOutput.java
index 0d95041..9b69a36 100644
--- a/dx/src/com/android/dx/util/AnnotatedOutput.java
+++ b/dx/src/com/android/dx/util/AnnotatedOutput.java
@@ -25,7 +25,7 @@
/**
* Get whether this instance will actually keep annotations.
*
- * @return <code>true</code> iff annotations are being kept
+ * @return {@code true} iff annotations are being kept
*/
public boolean annotates();
@@ -34,7 +34,7 @@
* Annotators may use the result of calling this method to inform their
* annotation activity.
*
- * @return <code>true</code> iff annotations are to be verbose
+ * @return {@code true} iff annotations are to be verbose
*/
public boolean isVerbose();
@@ -44,7 +44,7 @@
* annotation marks all subsequent output until another annotation
* call.
*
- * @param msg non-null; the annotation message
+ * @param msg {@code non-null;} the annotation message
*/
public void annotate(String msg);
@@ -55,9 +55,9 @@
* previous calls to this method, the new call "consumes" output
* after all the output covered by the previous calls.
*
- * @param amt >= 0; the amount of output for this annotation to
+ * @param amt {@code >= 0;} the amount of output for this annotation to
* cover
- * @param msg non-null; the annotation message
+ * @param msg {@code non-null;} the annotation message
*/
public void annotate(int amt, String msg);
@@ -73,7 +73,7 @@
* output, but annotaters are encouraged to attempt to avoid exceeding
* the indicated width.
*
- * @return >= 1; the maximum width
+ * @return {@code >= 1;} the maximum width
*/
public int getAnnotationWidth();
}
diff --git a/dx/src/com/android/dx/util/BitIntSet.java b/dx/src/com/android/dx/util/BitIntSet.java
index c8588f8..9baae6d 100644
--- a/dx/src/com/android/dx/util/BitIntSet.java
+++ b/dx/src/com/android/dx/util/BitIntSet.java
@@ -44,7 +44,7 @@
/**
* Ensures that the bit set has the capacity to represent the given value.
*
- * @param value >= 0 value to represent
+ * @param value {@code >= 0;} value to represent
*/
private void ensureCapacity(int value) {
if (value >= Bits.getMax(bits)) {
diff --git a/dx/src/com/android/dx/util/Bits.java b/dx/src/com/android/dx/util/Bits.java
index 0bc124c..1f45bd3 100644
--- a/dx/src/com/android/dx/util/Bits.java
+++ b/dx/src/com/android/dx/util/Bits.java
@@ -17,7 +17,7 @@
package com.android.dx.util;
/**
- * Utilities for treating <code>int[]</code>s as bit sets.
+ * Utilities for treating {@code int[]}s as bit sets.
*/
public final class Bits {
/**
@@ -30,8 +30,8 @@
/**
* Constructs a bit set to contain bits up to the given index (exclusive).
*
- * @param max >= 0; the maximum bit index (exclusive)
- * @return non-null; an appropriately-constructed instance
+ * @param max {@code >= 0;} the maximum bit index (exclusive)
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public static int[] makeBitSet(int max) {
int size = (max + 0x1f) >> 5;
@@ -41,8 +41,8 @@
/**
* Gets the maximum index (exclusive) for the given bit set.
*
- * @param bits non-null; bit set in question
- * @return >= 0; the maximum index (exclusive) that may be set
+ * @param bits {@code non-null;} bit set in question
+ * @return {@code >= 0;} the maximum index (exclusive) that may be set
*/
public static int getMax(int[] bits) {
return bits.length * 0x20;
@@ -51,8 +51,8 @@
/**
* Gets the value of the bit at the given index.
*
- * @param bits non-null; bit set to operate on
- * @param idx >= 0, < getMax(set); which bit
+ * @param bits {@code non-null;} bit set to operate on
+ * @param idx {@code >= 0, < getMax(set);} which bit
* @return the value of the indicated bit
*/
public static boolean get(int[] bits, int idx) {
@@ -64,8 +64,8 @@
/**
* Sets the given bit to the given value.
*
- * @param bits non-null; bit set to operate on
- * @param idx >= 0, < getMax(set); which bit
+ * @param bits {@code non-null;} bit set to operate on
+ * @param idx {@code >= 0, < getMax(set);} which bit
* @param value the new value for the bit
*/
public static void set(int[] bits, int idx, boolean value) {
@@ -80,10 +80,10 @@
}
/**
- * Sets the given bit to <code>true</code>.
+ * Sets the given bit to {@code true}.
*
- * @param bits non-null; bit set to operate on
- * @param idx >= 0, < getMax(set); which bit
+ * @param bits {@code non-null;} bit set to operate on
+ * @param idx {@code >= 0, < getMax(set);} which bit
*/
public static void set(int[] bits, int idx) {
int arrayIdx = idx >> 5;
@@ -92,10 +92,10 @@
}
/**
- * Sets the given bit to <code>false</code>.
+ * Sets the given bit to {@code false}.
*
- * @param bits non-null; bit set to operate on
- * @param idx >= 0, < getMax(set); which bit
+ * @param bits {@code non-null;} bit set to operate on
+ * @param idx {@code >= 0, < getMax(set);} which bit
*/
public static void clear(int[] bits, int idx) {
int arrayIdx = idx >> 5;
@@ -105,10 +105,10 @@
/**
* Returns whether or not the given bit set is empty, that is, whether
- * no bit is set to <code>true</code>.
+ * no bit is set to {@code true}.
*
- * @param bits non-null; bit set to operate on
- * @return <code>true</code> iff all bits are <code>false</code>
+ * @param bits {@code non-null;} bit set to operate on
+ * @return {@code true} iff all bits are {@code false}
*/
public static boolean isEmpty(int[] bits) {
int len = bits.length;
@@ -123,10 +123,10 @@
}
/**
- * Gets the number of bits set to <code>true</code> in the given bit set.
+ * Gets the number of bits set to {@code true} in the given bit set.
*
- * @param bits non-null; bit set to operate on
- * @return >= 0; the bit count (aka population count) of the set
+ * @param bits {@code non-null;} bit set to operate on
+ * @return {@code >= 0;} the bit count (aka population count) of the set
*/
public static int bitCount(int[] bits) {
int len = bits.length;
@@ -140,13 +140,13 @@
}
/**
- * Returns whether any bits are set to <code>true</code> in the
+ * Returns whether any bits are set to {@code true} in the
* specified range.
*
- * @param bits non-null; bit set to operate on
- * @param start >= 0; index of the first bit in the range (inclusive)
- * @param end >= 0; index of the last bit in the range (exclusive)
- * @return <code>true</code> if any bit is set to <code>true</code> in
+ * @param bits {@code non-null;} bit set to operate on
+ * @param start {@code >= 0;} index of the first bit in the range (inclusive)
+ * @param end {@code >= 0;} index of the last bit in the range (exclusive)
+ * @return {@code true} if any bit is set to {@code true} in
* the indicated range
*/
public static boolean anyInRange(int[] bits, int start, int end) {
@@ -158,10 +158,10 @@
* Finds the lowest-order bit set at or after the given index in the
* given bit set.
*
- * @param bits non-null; bit set to operate on
- * @param idx >= 0; minimum index to return
- * @return >= -1; lowest-order bit set at or after <code>idx</code>,
- * or <code>-1</code> if there is no appropriate bit index to return
+ * @param bits {@code non-null;} bit set to operate on
+ * @param idx {@code >= 0;} minimum index to return
+ * @return {@code >= -1;} lowest-order bit set at or after {@code idx},
+ * or {@code -1} if there is no appropriate bit index to return
*/
public static int findFirst(int[] bits, int idx) {
int len = bits.length;
@@ -183,12 +183,12 @@
/**
* Finds the lowest-order bit set at or after the given index in the
- * given <code>int</code>.
+ * given {@code int}.
*
* @param value the value in question
* @param idx 0..31 the minimum bit index to return
- * @return >= -1; lowest-order bit set at or after <code>idx</code>,
- * or <code>-1</code> if there is no appropriate bit index to return
+ * @return {@code >= -1;} lowest-order bit set at or after {@code idx},
+ * or {@code -1} if there is no appropriate bit index to return
*/
public static int findFirst(int value, int idx) {
value &= ~((1 << idx) - 1); // Mask off too-low bits.
@@ -197,13 +197,13 @@
}
/**
- * Ors bit array <code>b</code> into bit array <code>a</code>.
- * <code>a.length</code> must be greater than or equal to
- * <code>b.length</code>.
+ * Ors bit array {@code b} into bit array {@code a}.
+ * {@code a.length} must be greater than or equal to
+ * {@code b.length}.
*
- * @param a non-null; int array to be ored with other argument. This
+ * @param a {@code non-null;} int array to be ored with other argument. This
* argument is modified.
- * @param b non-null; int array to be ored into <code>a</code>. This
+ * @param b {@code non-null;} int array to be ored into {@code a}. This
* argument is not modified.
*/
public static void or(int[] a, int[] b) {
diff --git a/dx/src/com/android/dx/util/ByteArray.java b/dx/src/com/android/dx/util/ByteArray.java
index 3fcf293..9bc43a7 100644
--- a/dx/src/com/android/dx/util/ByteArray.java
+++ b/dx/src/com/android/dx/util/ByteArray.java
@@ -21,28 +21,28 @@
import java.io.InputStream;
/**
- * Wrapper for a <code>byte[]</code>, which provides read-only access and
+ * Wrapper for a {@code byte[]}, which provides read-only access and
* can "reveal" a partial slice of the underlying array.
*
* <b>Note:</b> Multibyte accessors all use big-endian order.
*/
public final class ByteArray {
- /** non-null; underlying array */
+ /** {@code non-null;} underlying array */
private final byte[] bytes;
- /** <code>>= 0</code>; start index of the slice (inclusive) */
+ /** {@code >= 0}; start index of the slice (inclusive) */
private final int start;
- /** <code>>= 0, <= bytes.length</code>; size computed as
- * <code>end - start</code> (in the constructor) */
+ /** {@code >= 0, <= bytes.length}; size computed as
+ * {@code end - start} (in the constructor) */
private final int size;
/**
* Constructs an instance.
*
- * @param bytes non-null; the underlying array
- * @param start <code>>= 0</code>; start index of the slice (inclusive)
- * @param end <code>>= start, <= bytes.length</code>; end index of
+ * @param bytes {@code non-null;} the underlying array
+ * @param start {@code >= 0;} start index of the slice (inclusive)
+ * @param end {@code >= start, <= bytes.length;} end index of
* the slice (exclusive)
*/
public ByteArray(byte[] bytes, int start, int end) {
@@ -68,9 +68,9 @@
}
/**
- * Constructs an instance from an entire <code>byte[]</code>.
+ * Constructs an instance from an entire {@code byte[]}.
*
- * @param bytes non-null; the underlying array
+ * @param bytes {@code non-null;} the underlying array
*/
public ByteArray(byte[] bytes) {
this(bytes, 0, bytes.length);
@@ -79,7 +79,7 @@
/**
* Gets the size of the array, in bytes.
*
- * @return >= 0; the size
+ * @return {@code >= 0;} the size
*/
public int size() {
return size;
@@ -88,10 +88,10 @@
/**
* Returns a slice (that is, a sub-array) of this instance.
*
- * @param start <code>>= 0</code>; start index of the slice (inclusive)
- * @param end <code>>= start, <= size()</code>; end index of
+ * @param start {@code >= 0;} start index of the slice (inclusive)
+ * @param end {@code >= start, <= size();} end index of
* the slice (exclusive)
- * @return non-null; the slice
+ * @return {@code non-null;} the slice
*/
public ByteArray slice(int start, int end) {
checkOffsets(start, end);
@@ -103,9 +103,9 @@
* offset into this instance.
*
* @param offset offset into this instance
- * @param bytes non-null; (alleged) underlying array
- * @return corresponding offset into <code>bytes</code>
- * @throws IllegalArgumentException thrown if <code>bytes</code> is
+ * @param bytes {@code non-null;} (alleged) underlying array
+ * @return corresponding offset into {@code bytes}
+ * @throws IllegalArgumentException thrown if {@code bytes} is
* not the underlying array of this instance
*/
public int underlyingOffset(int offset, byte[] bytes) {
@@ -117,10 +117,10 @@
}
/**
- * Gets the <code>signed byte</code> value at a particular offset.
+ * Gets the {@code signed byte} value at a particular offset.
*
- * @param off <code>>= 0, < size(); offset to fetch
- * @return <code>signed byte</code> at that offset
+ * @param off {@code >= 0, < size();} offset to fetch
+ * @return {@code signed byte} at that offset
*/
public int getByte(int off) {
checkOffsets(off, off + 1);
@@ -128,10 +128,10 @@
}
/**
- * Gets the <code>signed short</code> value at a particular offset.
+ * Gets the {@code signed short} value at a particular offset.
*
- * @param off <code>>= 0, < (size() - 1); offset to fetch
- * @return <code>signed short</code> at that offset
+ * @param off {@code >= 0, < (size() - 1);} offset to fetch
+ * @return {@code signed short} at that offset
*/
public int getShort(int off) {
checkOffsets(off, off + 2);
@@ -139,10 +139,10 @@
}
/**
- * Gets the <code>signed int</code> value at a particular offset.
+ * Gets the {@code signed int} value at a particular offset.
*
- * @param off <code>>= 0, < (size() - 3); offset to fetch
- * @return <code>signed int</code> at that offset
+ * @param off {@code >= 0, < (size() - 3);} offset to fetch
+ * @return {@code signed int} at that offset
*/
public int getInt(int off) {
checkOffsets(off, off + 4);
@@ -153,10 +153,10 @@
}
/**
- * Gets the <code>signed long</code> value at a particular offset.
+ * Gets the {@code signed long} value at a particular offset.
*
- * @param off <code>>= 0, < (size() - 7); offset to fetch
- * @return <code>signed int</code> at that offset
+ * @param off {@code >= 0, < (size() - 7);} offset to fetch
+ * @return {@code signed int} at that offset
*/
public long getLong(int off) {
checkOffsets(off, off + 8);
@@ -173,10 +173,10 @@
}
/**
- * Gets the <code>unsigned byte</code> value at a particular offset.
+ * Gets the {@code unsigned byte} value at a particular offset.
*
- * @param off <code>>= 0, < size(); offset to fetch
- * @return <code>unsigned byte</code> at that offset
+ * @param off {@code >= 0, < size();} offset to fetch
+ * @return {@code unsigned byte} at that offset
*/
public int getUnsignedByte(int off) {
checkOffsets(off, off + 1);
@@ -184,10 +184,10 @@
}
/**
- * Gets the <code>unsigned short</code> value at a particular offset.
+ * Gets the {@code unsigned short} value at a particular offset.
*
- * @param off <code>>= 0, < (size() - 1); offset to fetch
- * @return <code>unsigned short</code> at that offset
+ * @param off {@code >= 0, < (size() - 1);} offset to fetch
+ * @return {@code unsigned short} at that offset
*/
public int getUnsignedShort(int off) {
checkOffsets(off, off + 2);
@@ -196,11 +196,11 @@
/**
* Copies the contents of this instance into the given raw
- * <code>byte[]</code> at the given offset. The given array must be
+ * {@code byte[]} at the given offset. The given array must be
* large enough.
*
- * @param out non-null; array to hold the output
- * @param offset non-null; index into <code>out</code> for the first
+ * @param out {@code non-null;} array to hold the output
+ * @param offset {@code non-null;} index into {@code out} for the first
* byte of output
*/
public void getBytes(byte[] out, int offset) {
@@ -226,7 +226,7 @@
}
/**
- * Gets the <code>signed byte</code> value at the given offset,
+ * Gets the {@code signed byte} value at the given offset,
* without doing any argument checking.
*
* @param off offset to fetch
@@ -237,7 +237,7 @@
}
/**
- * Gets the <code>unsigned byte</code> value at the given offset,
+ * Gets the {@code unsigned byte} value at the given offset,
* without doing any argument checking.
*
* @param off offset to fetch
@@ -248,26 +248,26 @@
}
/**
- * Gets a <code>DataInputStream</code> that reads from this instance,
+ * Gets a {@code DataInputStream} that reads from this instance,
* with the cursor starting at the beginning of this instance's data.
* <b>Note:</b> The returned instance may be cast to {@link #GetCursor}
* if needed.
*
- * @return non-null; an appropriately-constructed
- * <code>DataInputStream</code> instance
+ * @return {@code non-null;} an appropriately-constructed
+ * {@code DataInputStream} instance
*/
public MyDataInputStream makeDataInputStream() {
return new MyDataInputStream(makeInputStream());
}
/**
- * Gets a <code>InputStream</code> that reads from this instance,
+ * Gets a {@code InputStream} that reads from this instance,
* with the cursor starting at the beginning of this instance's data.
* <b>Note:</b> The returned instance may be cast to {@link #GetCursor}
* if needed.
*
- * @return non-null; an appropriately-constructed
- * <code>InputStream</code> instancex
+ * @return {@code non-null;} an appropriately-constructed
+ * {@code InputStream} instancex
*/
public MyInputStream makeInputStream() {
return new MyInputStream();
@@ -280,7 +280,7 @@
/**
* Gets the current cursor.
*
- * @return 0..size(); the cursor
+ * @return {@code 0..size();} the cursor
*/
public int getCursor();
}
@@ -345,7 +345,7 @@
/**
* Gets the current cursor.
*
- * @return 0..size(); the cursor
+ * @return {@code 0..size();} the cursor
*/
public int getCursor() {
return cursor;
@@ -358,7 +358,7 @@
* instance may be easily determined.
*/
public class MyDataInputStream extends DataInputStream {
- /** non-null; the underlying {@link #MyInputStream} */
+ /** {@code non-null;} the underlying {@link #MyInputStream} */
private final MyInputStream wrapped;
public MyDataInputStream(MyInputStream wrapped) {
@@ -370,7 +370,7 @@
/**
* Gets the current cursor.
*
- * @return 0..size(); the cursor
+ * @return {@code 0..size();} the cursor
*/
public int getCursor() {
return wrapped.getCursor();
diff --git a/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java b/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java
index 457a603..5fcf5d8 100644
--- a/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java
+++ b/dx/src/com/android/dx/util/ByteArrayAnnotatedOutput.java
@@ -22,7 +22,7 @@
/**
* Implementation of {@link AnnotatedOutput} which stores the written data
- * into a <code>byte[]</code>.
+ * into a {@code byte[]}.
*
* <p><b>Note:</b> As per the {@link Output} interface, multi-byte
* writes all use little-endian order.</p>
@@ -38,26 +38,26 @@
*/
private final boolean stretchy;
- /** non-null; the data itself */
+ /** {@code non-null;} the data itself */
private byte[] data;
- /** >= 0; current output cursor */
+ /** {@code >= 0;} current output cursor */
private int cursor;
/** whether annotations are to be verbose */
private boolean verbose;
/**
- * null-ok; list of annotations, or <code>null</code> if this instance
+ * {@code null-ok;} list of annotations, or {@code null} if this instance
* isn't keeping them
*/
private ArrayList<Annotation> annotations;
- /** >= 40 (if used); the desired maximum annotation width */
+ /** {@code >= 40 (if used);} the desired maximum annotation width */
private int annotationWidth;
/**
- * >= 8 (if used); the number of bytes of hex output to use
+ * {@code >= 8 (if used);} the number of bytes of hex output to use
* in annotations
*/
private int hexCols;
@@ -69,7 +69,7 @@
* capacity of the resulting instance. Also, the constructed
* instance does not keep annotations by default.
*
- * @param data non-null; data array to use for output
+ * @param data {@code non-null;} data array to use for output
*/
public ByteArrayAnnotatedOutput(byte[] data) {
this(data, false);
@@ -87,7 +87,7 @@
/**
* Internal constructor.
*
- * @param data non-null; data array to use for output
+ * @param data {@code non-null;} data array to use for output
* @param stretchy whether the instance is to be stretchy
*/
private ByteArrayAnnotatedOutput(byte[] data, boolean stretchy) {
@@ -105,25 +105,25 @@
}
/**
- * Gets the underlying <code>byte[]</code> of this instance, which
+ * Gets the underlying {@code byte[]} of this instance, which
* may be larger than the number of bytes written
*
* @see #toByteArray
*
- * @return non-null; the <code>byte[]</code>
+ * @return {@code non-null;} the {@code byte[]}
*/
public byte[] getArray() {
return data;
}
/**
- * Constructs and returns a new <code>byte[]</code> that contains
+ * Constructs and returns a new {@code byte[]} that contains
* the written contents exactly (that is, with no extra unwritten
* bytes at the end).
*
* @see #getArray
*
- * @return non-null; an appropriately-constructed array
+ * @return {@code non-null;} an appropriately-constructed array
*/
public byte[] toByteArray() {
byte[] result = new byte[cursor];
@@ -419,7 +419,7 @@
* be called only once per instance, and only before any data has been
* written to the it.
*
- * @param annotationWidth >= 40; the desired maximum annotation width
+ * @param annotationWidth {@code >= 40;} the desired maximum annotation width
* @param verbose whether or not to indicate verbose annotations
*/
public void enableAnnotations(int annotationWidth, boolean verbose) {
@@ -474,7 +474,7 @@
/**
* Writes the annotated content of this instance to the given writer.
*
- * @param out non-null; where to write to
+ * @param out {@code non-null;} where to write to
*/
public void writeAnnotationsTo(Writer out) throws IOException {
int width2 = getAnnotationWidth();
@@ -538,7 +538,7 @@
* Reallocates the underlying array if necessary. Calls to this method
* should be guarded by a test of {@link #stretchy}.
*
- * @param desiredSize >= 0; the desired minimum total size of the array
+ * @param desiredSize {@code >= 0;} the desired minimum total size of the array
*/
private void ensureCapacity(int desiredSize) {
if (data.length < desiredSize) {
@@ -552,25 +552,25 @@
* Annotation on output.
*/
private static class Annotation {
- /** >= 0; start of annotated range (inclusive) */
+ /** {@code >= 0;} start of annotated range (inclusive) */
private final int start;
/**
- * >= 0; end of annotated range (exclusive);
- * <code>Integer.MAX_VALUE</code> if unclosed
+ * {@code >= 0;} end of annotated range (exclusive);
+ * {@code Integer.MAX_VALUE} if unclosed
*/
private int end;
- /** non-null; annotation text */
+ /** {@code non-null;} annotation text */
private final String text;
/**
* Constructs an instance.
*
- * @param start >= 0; start of annotated range
- * @param end >= start; end of annotated range (exclusive) or
- * <code>Integer.MAX_VALUE</code> if unclosed
- * @param text non-null; annotation text
+ * @param start {@code >= 0;} start of annotated range
+ * @param end {@code >= start;} end of annotated range (exclusive) or
+ * {@code Integer.MAX_VALUE} if unclosed
+ * @param text {@code non-null;} annotation text
*/
public Annotation(int start, int end, String text) {
this.start = start;
@@ -581,8 +581,8 @@
/**
* Constructs an instance. It is initally unclosed.
*
- * @param start >= 0; start of annotated range
- * @param text non-null; annotation text
+ * @param start {@code >= 0;} start of annotated range
+ * @param text {@code non-null;} annotation text
*/
public Annotation(int start, String text) {
this(start, Integer.MAX_VALUE, text);
@@ -592,7 +592,7 @@
* Sets the end as given, but only if the instance is unclosed;
* otherwise, do nothing.
*
- * @param end >= start; the end
+ * @param end {@code >= start;} the end
*/
public void setEndIfUnset(int end) {
if (this.end == Integer.MAX_VALUE) {
@@ -603,7 +603,7 @@
/**
* Sets the end as given.
*
- * @param end >= start; the end
+ * @param end {@code >= start;} the end
*/
public void setEnd(int end) {
this.end = end;
@@ -630,7 +630,7 @@
/**
* Gets the text.
*
- * @return non-null; the text
+ * @return {@code non-null;} the text
*/
public String getText() {
return text;
diff --git a/dx/src/com/android/dx/util/ExceptionWithContext.java b/dx/src/com/android/dx/util/ExceptionWithContext.java
index 035546e..7f8523c 100644
--- a/dx/src/com/android/dx/util/ExceptionWithContext.java
+++ b/dx/src/com/android/dx/util/ExceptionWithContext.java
@@ -24,7 +24,7 @@
*/
public class ExceptionWithContext
extends RuntimeException {
- /** non-null; human-oriented context of the exception */
+ /** {@code non-null;} human-oriented context of the exception */
private StringBuffer context;
/**
@@ -33,9 +33,9 @@
* {@link ExceptionWithContext}, or a newly-constructed exception if it
* was not.
*
- * @param ex non-null; the exception to augment
- * @param str non-null; context to add
- * @return non-null; an appropriate instance
+ * @param ex {@code non-null;} the exception to augment
+ * @param str {@code non-null;} context to add
+ * @return {@code non-null;} an appropriate instance
*/
public static ExceptionWithContext withContext(Throwable ex, String str) {
ExceptionWithContext ewc;
@@ -62,7 +62,7 @@
/**
* Constructs an instance.
*
- * @param cause null-ok; exception that caused this one
+ * @param cause {@code null-ok;} exception that caused this one
*/
public ExceptionWithContext(Throwable cause) {
this(null, cause);
@@ -72,7 +72,7 @@
* Constructs an instance.
*
* @param message human-oriented message
- * @param cause null-ok; exception that caused this one
+ * @param cause {@code null-ok;} exception that caused this one
*/
public ExceptionWithContext(String message, Throwable cause) {
super((message != null) ? message :
@@ -105,7 +105,7 @@
/**
* Adds a line of context to this instance.
*
- * @param str non-null; new context
+ * @param str {@code non-null;} new context
*/
public void addContext(String str) {
if (str == null) {
@@ -121,7 +121,7 @@
/**
* Gets the context.
*
- * @return non-null; the context
+ * @return {@code non-null;} the context
*/
public String getContext() {
return context.toString();
@@ -130,7 +130,7 @@
/**
* Prints the message and context.
*
- * @param out non-null; where to print to
+ * @param out {@code non-null;} where to print to
*/
public void printContext(PrintStream out) {
out.println(getMessage());
@@ -140,7 +140,7 @@
/**
* Prints the message and context.
*
- * @param out non-null; where to print to
+ * @param out {@code non-null;} where to print to
*/
public void printContext(PrintWriter out) {
out.println(getMessage());
diff --git a/dx/src/com/android/dx/util/FileUtils.java b/dx/src/com/android/dx/util/FileUtils.java
index 07a7c7e..3f51207 100644
--- a/dx/src/com/android/dx/util/FileUtils.java
+++ b/dx/src/com/android/dx/util/FileUtils.java
@@ -35,8 +35,8 @@
* Reads the named file, translating {@link IOException} to a
* {@link RuntimeException} of some sort.
*
- * @param fileName non-null; name of the file to read
- * @return non-null; contents of the file
+ * @param fileName {@code non-null;} name of the file to read
+ * @return {@code non-null;} contents of the file
*/
public static byte[] readFile(String fileName) {
File file = new File(fileName);
@@ -47,8 +47,8 @@
* Reads the given file, translating {@link IOException} to a
* {@link RuntimeException} of some sort.
*
- * @param file non-null; the file to read
- * @return non-null; contents of the file
+ * @param file {@code non-null;} the file to read
+ * @return {@code non-null;} contents of the file
*/
public static byte[] readFile(File file) {
if (!file.exists()) {
diff --git a/dx/src/com/android/dx/util/FixedSizeList.java b/dx/src/com/android/dx/util/FixedSizeList.java
index 7b7d325..17d773c 100644
--- a/dx/src/com/android/dx/util/FixedSizeList.java
+++ b/dx/src/com/android/dx/util/FixedSizeList.java
@@ -23,11 +23,11 @@
*/
public class FixedSizeList
extends MutabilityControl implements ToHuman {
- /** non-null; array of elements */
+ /** {@code non-null;} array of elements */
private Object[] arr;
/**
- * Constructs an instance. All indices initially contain <code>null</code>.
+ * Constructs an instance. All indices initially contain {@code null}.
*
* @param size the size of the list
*/
@@ -94,10 +94,10 @@
/**
* Gets a customized string form for this instance.
*
- * @param prefix null-ok; prefix for the start of the result
- * @param separator null-ok; separator to insert between each item
- * @param suffix null-ok; suffix for the end of the result
- * @return non-null; the custom string
+ * @param prefix {@code null-ok;} prefix for the start of the result
+ * @param separator {@code null-ok;} separator to insert between each item
+ * @param suffix {@code null-ok;} suffix for the end of the result
+ * @return {@code non-null;} the custom string
*/
public String toString(String prefix, String separator, String suffix) {
return toString0(prefix, separator, suffix, false);
@@ -108,10 +108,10 @@
* only work if every element of the list implements {@link
* ToHuman}.
*
- * @param prefix null-ok; prefix for the start of the result
- * @param separator null-ok; separator to insert between each item
- * @param suffix null-ok; suffix for the end of the result
- * @return non-null; the custom string
+ * @param prefix {@code null-ok;} prefix for the start of the result
+ * @param separator {@code null-ok;} separator to insert between each item
+ * @param suffix {@code null-ok;} suffix for the end of the result
+ * @return {@code non-null;} the custom string
*/
public String toHuman(String prefix, String separator, String suffix) {
return toString0(prefix, separator, suffix, true);
@@ -126,7 +126,7 @@
/**
* Shrinks this instance to fit, by removing any unset
- * (<code>null</code>) elements, leaving the remaining elements in
+ * ({@code null}) elements, leaving the remaining elements in
* their original order.
*/
public void shrinkToFit() {
@@ -165,12 +165,12 @@
/**
* Gets the indicated element. It is an error to call this with the
* index for an element which was never set; if you do that, this
- * will throw <code>NullPointerException</code>. This method is
+ * will throw {@code NullPointerException}. This method is
* protected so that subclasses may offer a safe type-checked
* public interface to their clients.
*
- * @param n >= 0, < size(); which element
- * @return non-null; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code non-null;} the indicated element
*/
protected final Object get0(int n) {
try {
@@ -188,13 +188,13 @@
}
/**
- * Gets the indicated element, allowing <code>null</code>s to be
+ * Gets the indicated element, allowing {@code null}s to be
* returned. This method is protected so that subclasses may
* (optionally) offer a safe type-checked public interface to
* their clients.
*
- * @param n >= 0, < size(); which element
- * @return null-ok; the indicated element
+ * @param n {@code >= 0, < size();} which element
+ * @return {@code null-ok;} the indicated element
*/
protected final Object getOrNull0(int n) {
return arr[n];
@@ -206,8 +206,8 @@
* subclasses may offer a safe type-checked public interface to
* their clients.
*
- * @param n >= 0, < size(); which element
- * @param obj null-ok; the value to store
+ * @param n {@code >= 0, < size();} which element
+ * @param obj {@code null-ok;} the value to store
*/
protected final void set0(int n, Object obj) {
throwIfImmutable();
@@ -239,11 +239,11 @@
* Helper for {@link #toString} and {@link #toHuman}, which both of
* those call to pretty much do everything.
*
- * @param prefix null-ok; prefix for the start of the result
- * @param separator null-ok; separator to insert between each item
- * @param suffix null-ok; suffix for the end of the result
+ * @param prefix {@code null-ok;} prefix for the start of the result
+ * @param separator {@code null-ok;} separator to insert between each item
+ * @param suffix {@code null-ok;} suffix for the end of the result
* @param human whether the output is to be human
- * @return non-null; the custom string
+ * @return {@code non-null;} the custom string
*/
private String toString0(String prefix, String separator, String suffix,
boolean human) {
diff --git a/dx/src/com/android/dx/util/Hex.java b/dx/src/com/android/dx/util/Hex.java
index cf4c130..cb71e5e 100644
--- a/dx/src/com/android/dx/util/Hex.java
+++ b/dx/src/com/android/dx/util/Hex.java
@@ -28,10 +28,10 @@
}
/**
- * Formats a <code>long</code> as an 8-byte unsigned hex value.
+ * Formats a {@code long} as an 8-byte unsigned hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u8(long v) {
char[] result = new char[16];
@@ -44,10 +44,10 @@
}
/**
- * Formats an <code>int</code> as a 4-byte unsigned hex value.
+ * Formats an {@code int} as a 4-byte unsigned hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u4(int v) {
char[] result = new char[8];
@@ -60,10 +60,10 @@
}
/**
- * Formats an <code>int</code> as a 3-byte unsigned hex value.
+ * Formats an {@code int} as a 3-byte unsigned hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u3(int v) {
char[] result = new char[6];
@@ -76,10 +76,10 @@
}
/**
- * Formats an <code>int</code> as a 2-byte unsigned hex value.
+ * Formats an {@code int} as a 2-byte unsigned hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u2(int v) {
char[] result = new char[4];
@@ -92,12 +92,12 @@
}
/**
- * Formats an <code>int</code> as either a 2-byte unsigned hex value
+ * Formats an {@code int} as either a 2-byte unsigned hex value
* (if the value is small enough) or a 4-byte unsigned hex value (if
* not).
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u2or4(int v) {
if (v == (char) v) {
@@ -108,10 +108,10 @@
}
/**
- * Formats an <code>int</code> as a 1-byte unsigned hex value.
+ * Formats an {@code int} as a 1-byte unsigned hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String u1(int v) {
char[] result = new char[2];
@@ -124,10 +124,10 @@
}
/**
- * Formats an <code>int</code> as a 4-bit unsigned hex nibble.
+ * Formats an {@code int} as a 4-bit unsigned hex nibble.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String uNibble(int v) {
char[] result = new char[1];
@@ -137,10 +137,10 @@
}
/**
- * Formats a <code>long</code> as an 8-byte signed hex value.
+ * Formats a {@code long} as an 8-byte signed hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String s8(long v) {
char[] result = new char[17];
@@ -161,10 +161,10 @@
}
/**
- * Formats an <code>int</code> as a 4-byte signed hex value.
+ * Formats an {@code int} as a 4-byte signed hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String s4(int v) {
char[] result = new char[9];
@@ -185,10 +185,10 @@
}
/**
- * Formats an <code>int</code> as a 2-byte signed hex value.
+ * Formats an {@code int} as a 2-byte signed hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String s2(int v) {
char[] result = new char[5];
@@ -209,10 +209,10 @@
}
/**
- * Formats an <code>int</code> as a 1-byte signed hex value.
+ * Formats an {@code int} as a 1-byte signed hex value.
*
* @param v value to format
- * @return non-null; formatted form
+ * @return {@code non-null;} formatted form
*/
public static String s1(int v) {
char[] result = new char[3];
@@ -233,18 +233,18 @@
}
/**
- * Formats a hex dump of a portion of a <code>byte[]</code>. The result
+ * Formats a hex dump of a portion of a {@code byte[]}. The result
* is always newline-terminated, unless the passed-in length was zero,
- * in which case the result is always the empty string (<code>""</code>).
+ * in which case the result is always the empty string ({@code ""}).
*
- * @param arr non-null; array to format
- * @param offset >= 0; offset to the part to dump
- * @param length >= 0; number of bytes to dump
- * @param outOffset >= 0; first output offset to print
- * @param bpl >= 0; number of bytes of output per line
- * @param addressLength {2,4,6,8}; number of characters for each address
+ * @param arr {@code non-null;} array to format
+ * @param offset {@code >= 0;} offset to the part to dump
+ * @param length {@code >= 0;} number of bytes to dump
+ * @param outOffset {@code >= 0;} first output offset to print
+ * @param bpl {@code >= 0;} number of bytes of output per line
+ * @param addressLength {@code {2,4,6,8};} number of characters for each address
* header
- * @return non-null; a string of the dump
+ * @return {@code non-null;} a string of the dump
*/
public static String dump(byte[] arr, int offset, int length,
int outOffset, int bpl, int addressLength) {
diff --git a/dx/src/com/android/dx/util/HexParser.java b/dx/src/com/android/dx/util/HexParser.java
index 4b6b7b2..3d0c992 100644
--- a/dx/src/com/android/dx/util/HexParser.java
+++ b/dx/src/com/android/dx/util/HexParser.java
@@ -28,7 +28,7 @@
}
/**
- * Parses the given text as hex, returning a <code>byte[]</code>
+ * Parses the given text as hex, returning a {@code byte[]}
* corresponding to the text. The format is simple: Each line may
* start with a hex offset followed by a colon (which is verified
* and presumably used just as a comment), and then consists of
@@ -38,8 +38,8 @@
* of the subsequent characters is used, until the next double
* quote. Quoted strings may not span multiple lines.
*
- * @param src non-null; the source string
- * @return non-null; the parsed form
+ * @param src {@code non-null;} the source string
+ * @return {@code non-null;} the parsed form
*/
public static byte[] parse(String src) {
int len = src.length();
diff --git a/dx/src/com/android/dx/util/IndentingWriter.java b/dx/src/com/android/dx/util/IndentingWriter.java
index db4e0a2..92f0b55 100644
--- a/dx/src/com/android/dx/util/IndentingWriter.java
+++ b/dx/src/com/android/dx/util/IndentingWriter.java
@@ -27,31 +27,31 @@
* line.
*/
public final class IndentingWriter extends FilterWriter {
- /** null-ok; optional prefix for every line */
+ /** {@code null-ok;} optional prefix for every line */
private final String prefix;
- /** > 0; the maximum output width */
+ /** {@code > 0;} the maximum output width */
private final int width;
- /** > 0; the maximum indent */
+ /** {@code > 0;} the maximum indent */
private final int maxIndent;
- /** >= 0; current output column (zero-based) */
+ /** {@code >= 0;} current output column (zero-based) */
private int column;
/** whether indent spaces are currently being collected */
private boolean collectingIndent;
- /** >= 0; current indent amount */
+ /** {@code >= 0;} current indent amount */
private int indent;
/**
* Constructs an instance.
*
- * @param out non-null; writer to send final output to
- * @param width >= 0; the maximum output width (not including
- * <code>prefix</code>), or <code>0</code> for no maximum
- * @param prefix non-null; the prefix for each line
+ * @param out {@code non-null;} writer to send final output to
+ * @param width {@code >= 0;} the maximum output width (not including
+ * {@code prefix}), or {@code 0} for no maximum
+ * @param prefix {@code non-null;} the prefix for each line
*/
public IndentingWriter(Writer out, int width, String prefix) {
super(out);
@@ -78,9 +78,9 @@
/**
* Constructs a no-prefix instance.
*
- * @param out non-null; writer to send final output to
- * @param width >= 0; the maximum output width (not including
- * <code>prefix</code>), or <code>0</code> for no maximum
+ * @param out {@code non-null;} writer to send final output to
+ * @param width {@code >= 0;} the maximum output width (not including
+ * {@code prefix}), or {@code 0} for no maximum
*/
public IndentingWriter(Writer out, int width) {
this(out, width, "");
diff --git a/dx/src/com/android/dx/util/IntList.java b/dx/src/com/android/dx/util/IntList.java
index f60bbb5..c51c028 100644
--- a/dx/src/com/android/dx/util/IntList.java
+++ b/dx/src/com/android/dx/util/IntList.java
@@ -19,16 +19,16 @@
import java.util.Arrays;
/**
- * Simple list of <code>int</code>s.
+ * Simple list of {@code int}s.
*/
public final class IntList extends MutabilityControl {
- /** non-null; immutable, no-element instance */
+ /** {@code non-null;} immutable, no-element instance */
public static final IntList EMPTY = new IntList(0);
- /** non-null; array of elements */
+ /** {@code non-null;} array of elements */
private int[] values;
- /** >= 0; current size of the list */
+ /** {@code >= 0;} current size of the list */
private int size;
/** whether the values are currently sorted */
@@ -78,7 +78,7 @@
/**
* Constructs an empty instance.
*
- * @param initialCapacity >= 0; initial capacity of the list
+ * @param initialCapacity {@code >= 0;} initial capacity of the list
*/
public IntList(int initialCapacity) {
super(true);
@@ -165,7 +165,7 @@
/**
* Gets the indicated value.
*
- * @param n >= 0, < size(); which element
+ * @param n {@code >= 0, < size();} which element
* @return the indicated element's value
*/
public int get(int n) {
@@ -184,7 +184,7 @@
/**
* Sets the value at the given index.
*
- * @param n >= 0, < size(); which element
+ * @param n {@code >= 0, < size();} which element
* @param value value to store
*/
public void set(int n, int value) {
@@ -229,7 +229,7 @@
* current size (that is, insertion as a last element is legal but
* no further).
*
- * @param n >=0 <=size(); index of where to insert
+ * @param n {@code >= 0, <=size();} index of where to insert
* @param value value to insert
*/
public void insert(int n, int value) {
@@ -252,7 +252,7 @@
* Removes an element at a given index, shifting elements at greater
* indicies down one.
*
- * @param n >=0 < size(); index of element to remove
+ * @param n {@code >=0, < size();} index of element to remove
*/
public void removeIndex(int n) {
if (n >= size) {
@@ -307,7 +307,7 @@
/**
* Pops N elements off the end of the list and decreasing the size by N.
*
- * @param n >= 0; number of elements to remove from end.
+ * @param n {@code >= 0;} number of elements to remove from end.
* @exception IndexOutOfBoundsException if stack is smaller than N
*/
public void pop(int n) {
@@ -319,7 +319,7 @@
/**
* Shrinks the size of the list.
*
- * @param newSize >= 0; the new size
+ * @param newSize {@code >= 0;} the new size
*/
public void shrink(int newSize) {
if (newSize < 0) {
@@ -338,7 +338,7 @@
/**
* Makes and returns a mutable copy of the list.
*
- * @return non-null; an appropriately-constructed instance
+ * @return {@code non-null;} an appropriately-constructed instance
*/
public IntList mutableCopy() {
int sz = size;
@@ -380,12 +380,12 @@
/**
* Performs a binary search on a sorted list, returning the index of
* the given value if it is present or
- * <code>(-(insertion point) - 1)</code> if the value is not present.
+ * {@code (-(insertion point) - 1)} if the value is not present.
* If the list is not sorted, then reverts to linear search and returns
- * <code>-size()</code> if the element is not found.
+ * {@code -size()} if the element is not found.
*
* @param value value to find
- * @return index of value or <code>(-(insertion point) - 1)</code> if the
+ * @return index of value or {@code (-(insertion point) - 1)} if the
* value is not present
*/
public int binarysearch(int value) {
diff --git a/dx/src/com/android/dx/util/IntSet.java b/dx/src/com/android/dx/util/IntSet.java
index 10b6ee0..33b6bdd 100644
--- a/dx/src/com/android/dx/util/IntSet.java
+++ b/dx/src/com/android/dx/util/IntSet.java
@@ -44,24 +44,24 @@
boolean has(int value);
/**
- * Merges <code>other</code> into this set, so this set becomes the
+ * Merges {@code other} into this set, so this set becomes the
* union of the two.
*
- * @param other non-null; other set to merge with.
+ * @param other {@code non-null;} other set to merge with.
*/
void merge(IntSet other);
/**
* Returns the count of unique elements in this set.
*
- * @return > = 0; count of unique elements
+ * @return {@code > = 0;} count of unique elements
*/
int elements();
/**
* Iterates the set
*
- * @return non-null; a set iterator
+ * @return {@code non-null;} a set iterator
*/
IntIterator iterator();
}
diff --git a/dx/src/com/android/dx/util/LabeledItem.java b/dx/src/com/android/dx/util/LabeledItem.java
index cc6a0d2..b4856cf 100644
--- a/dx/src/com/android/dx/util/LabeledItem.java
+++ b/dx/src/com/android/dx/util/LabeledItem.java
@@ -24,7 +24,7 @@
/*
* Gets the label of this block.
*
- * @return >= 0; the label
+ * @return {@code >= 0;} the label
*/
public int getLabel();
}
diff --git a/dx/src/com/android/dx/util/LabeledList.java b/dx/src/com/android/dx/util/LabeledList.java
index 3168a38..28a148b 100644
--- a/dx/src/com/android/dx/util/LabeledList.java
+++ b/dx/src/com/android/dx/util/LabeledList.java
@@ -58,7 +58,7 @@
/**
* Gets the maximum label (exclusive) of any block added to this instance.
*
- * @return >= 0; the maximum label
+ * @return {@code >= 0;} the maximum label
*/
public int getMaxLabel() {
int sz = labelToIndex.size();
@@ -102,8 +102,8 @@
* Gets the index of the first item in the list with the given
* label, if any.
*
- * @param label >= 0; the label to look for
- * @return >= -1; the index of the so-labelled item, or <code>-1</code>
+ * @param label {@code >= 0;} the label to look for
+ * @return {@code >= -1;} the index of the so-labelled item, or {@code -1}
* if none is found
*/
public int indexOfLabel(int label) {
@@ -142,8 +142,8 @@
/**
* Sets the element at the given index.
*
- * @param n >= 0, < size(); which element
- * @param item null-ok; the value to store
+ * @param n {@code >= 0, < size();} which element
+ * @param item {@code null-ok;} the value to store
*/
protected void set(int n, LabeledItem item) {
LabeledItem old = (LabeledItem) getOrNull0(n);
diff --git a/dx/src/com/android/dx/util/MutabilityControl.java b/dx/src/com/android/dx/util/MutabilityControl.java
index 8b3383b..14e0f2e 100644
--- a/dx/src/com/android/dx/util/MutabilityControl.java
+++ b/dx/src/com/android/dx/util/MutabilityControl.java
@@ -36,7 +36,7 @@
/**
* Constructs an instance, explicitly indicating the mutability.
*
- * @param mutable <code>true</code> iff this instance is mutable
+ * @param mutable {@code true} iff this instance is mutable
*/
public MutabilityControl(boolean mutable) {
this.mutable = mutable;
@@ -51,9 +51,9 @@
/**
* Checks to see whether or not this instance is immutable. This is the
- * same as calling <code>!isMutable()</code>.
+ * same as calling {@code !isMutable()}.
*
- * @return <code>true</code> iff this instance is immutable
+ * @return {@code true} iff this instance is immutable
*/
public final boolean isImmutable() {
return !mutable;
@@ -62,7 +62,7 @@
/**
* Checks to see whether or not this instance is mutable.
*
- * @return <code>true</code> iff this instance is mutable
+ * @return {@code true} iff this instance is mutable
*/
public final boolean isMutable() {
return mutable;
diff --git a/dx/src/com/android/dx/util/Output.java b/dx/src/com/android/dx/util/Output.java
index b3c3747..5e737ae 100644
--- a/dx/src/com/android/dx/util/Output.java
+++ b/dx/src/com/android/dx/util/Output.java
@@ -18,7 +18,7 @@
/**
* Interface for a sink for binary output. This is similar to
- * <code>java.util.DataOutput</code>, but no <code>IOExceptions</code>
+ * {@code java.util.DataOutput}, but no {@code IOExceptions}
* are declared, and multibyte output is defined to be little-endian.
*/
public interface Output {
@@ -26,7 +26,7 @@
* Gets the current cursor position. This is the same as the number of
* bytes written to this instance.
*
- * @return >= 0; the cursor position
+ * @return {@code >= 0;} the cursor position
*/
public int getCursor();
@@ -34,34 +34,34 @@
* Asserts that the cursor is the given value.
*
* @param expectedCursor the expected cursor value
- * @throws RuntimeException thrown if <code>getCursor() !=
- * expectedCursor</code>
+ * @throws RuntimeException thrown if {@code getCursor() !=
+ * expectedCursor}
*/
public void assertCursor(int expectedCursor);
/**
- * Writes a <code>byte</code> to this instance.
+ * Writes a {@code byte} to this instance.
*
* @param value the value to write; all but the low 8 bits are ignored
*/
public void writeByte(int value);
/**
- * Writes a <code>short</code> to this instance.
+ * Writes a {@code short} to this instance.
*
* @param value the value to write; all but the low 16 bits are ignored
*/
public void writeShort(int value);
/**
- * Writes an <code>int</code> to this instance.
+ * Writes an {@code int} to this instance.
*
* @param value the value to write
*/
public void writeInt(int value);
/**
- * Writes a <code>long</code> to this instance.
+ * Writes a {@code long} to this instance.
*
* @param value the value to write
*/
@@ -73,7 +73,7 @@
* 7.6.
*
* @param value value to write, treated as an unsigned value
- * @return 1..5; the number of bytes actually written
+ * @return {@code 1..5;} the number of bytes actually written
*/
public int writeUnsignedLeb128(int value);
@@ -83,47 +83,47 @@
* 7.6.
*
* @param value value to write
- * @return 1..5; the number of bytes actually written
+ * @return {@code 1..5;} the number of bytes actually written
*/
public int writeSignedLeb128(int value);
/**
* Writes a {@link ByteArray} to this instance.
*
- * @param bytes non-null; the array to write
+ * @param bytes {@code non-null;} the array to write
*/
public void write(ByteArray bytes);
/**
- * Writes a portion of a <code>byte[]</code> to this instance.
+ * Writes a portion of a {@code byte[]} to this instance.
*
- * @param bytes non-null; the array to write
- * @param offset >= 0; offset into <code>bytes</code> for the first
+ * @param bytes {@code non-null;} the array to write
+ * @param offset {@code >= 0;} offset into {@code bytes} for the first
* byte to write
- * @param length >= 0; number of bytes to write
+ * @param length {@code >= 0;} number of bytes to write
*/
public void write(byte[] bytes, int offset, int length);
/**
- * Writes a <code>byte[]</code> to this instance. This is just
- * a convenient shorthand for <code>write(bytes, 0, bytes.length)</code>.
+ * Writes a {@code byte[]} to this instance. This is just
+ * a convenient shorthand for {@code write(bytes, 0, bytes.length)}.
*
- * @param bytes non-null; the array to write
+ * @param bytes {@code non-null;} the array to write
*/
public void write(byte[] bytes);
/**
- * Writes the given number of <code>0</code> bytes.
+ * Writes the given number of {@code 0} bytes.
*
- * @param count >= 0; the number of zeroes to write
+ * @param count {@code >= 0;} the number of zeroes to write
*/
public void writeZeroes(int count);
/**
- * Adds extra bytes if necessary (with value <code>0</code>) to
+ * Adds extra bytes if necessary (with value {@code 0}) to
* force alignment of the output cursor as given.
*
- * @param alignment > 0; the alignment; must be a power of two
+ * @param alignment {@code > 0;} the alignment; must be a power of two
*/
public void alignTo(int alignment);
}
diff --git a/dx/src/com/android/dx/util/ToHuman.java b/dx/src/com/android/dx/util/ToHuman.java
index 89bf4f7..b3a31a5 100644
--- a/dx/src/com/android/dx/util/ToHuman.java
+++ b/dx/src/com/android/dx/util/ToHuman.java
@@ -23,9 +23,9 @@
public interface ToHuman {
/**
* Return the "human" string form of this instance. This is
- * generally less "debuggy" than <code>toString()</code>.
+ * generally less "debuggy" than {@code toString()}.
*
- * @return non-null; the human string form
+ * @return {@code non-null;} the human string form
*/
public String toHuman();
}
diff --git a/dx/src/com/android/dx/util/TwoColumnOutput.java b/dx/src/com/android/dx/util/TwoColumnOutput.java
index cc9f7d4..a155c15 100644
--- a/dx/src/com/android/dx/util/TwoColumnOutput.java
+++ b/dx/src/com/android/dx/util/TwoColumnOutput.java
@@ -28,34 +28,34 @@
* one which goes on the right.
*/
public final class TwoColumnOutput {
- /** non-null; underlying writer for final output */
+ /** {@code non-null;} underlying writer for final output */
private final Writer out;
- /** > 0; the left column width */
+ /** {@code > 0;} the left column width */
private final int leftWidth;
- /** non-null; pending left column output */
+ /** {@code non-null;} pending left column output */
private final StringBuffer leftBuf;
- /** non-null; pending right column output */
+ /** {@code non-null;} pending right column output */
private final StringBuffer rightBuf;
- /** non-null; left column writer */
+ /** {@code non-null;} left column writer */
private final IndentingWriter leftColumn;
- /** non-null; right column writer */
+ /** {@code non-null;} right column writer */
private final IndentingWriter rightColumn;
/**
* Turns the given two strings (with widths) and spacer into a formatted
* two-column string.
*
- * @param s1 non-null; first string
- * @param width1 > 0; width of the first column
- * @param spacer non-null; spacer string
- * @param s2 non-null; second string
- * @param width2 > 0; width of the second column
- * @return non-null; an appropriately-formatted string
+ * @param s1 {@code non-null;} first string
+ * @param width1 {@code > 0;} width of the first column
+ * @param spacer {@code non-null;} spacer string
+ * @param s2 {@code non-null;} second string
+ * @param width2 {@code > 0;} width of the second column
+ * @return {@code non-null;} an appropriately-formatted string
*/
public static String toString(String s1, int width1, String spacer,
String s2, int width2) {
@@ -80,10 +80,10 @@
/**
* Constructs an instance.
*
- * @param out non-null; writer to send final output to
- * @param leftWidth > 0; width of the left column, in characters
- * @param rightWidth > 0; width of the right column, in characters
- * @param spacer non-null; spacer string to sit between the two columns
+ * @param out {@code non-null;} writer to send final output to
+ * @param leftWidth {@code > 0;} width of the left column, in characters
+ * @param rightWidth {@code > 0;} width of the right column, in characters
+ * @param spacer {@code non-null;} spacer string to sit between the two columns
*/
public TwoColumnOutput(Writer out, int leftWidth, int rightWidth,
String spacer) {
@@ -118,10 +118,10 @@
/**
* Constructs an instance.
*
- * @param out non-null; stream to send final output to
- * @param leftWidth >= 1; width of the left column, in characters
- * @param rightWidth >= 1; width of the right column, in characters
- * @param spacer non-null; spacer string to sit between the two columns
+ * @param out {@code non-null;} stream to send final output to
+ * @param leftWidth {@code >= 1;} width of the left column, in characters
+ * @param rightWidth {@code >= 1;} width of the right column, in characters
+ * @param spacer {@code non-null;} spacer string to sit between the two columns
*/
public TwoColumnOutput(OutputStream out, int leftWidth, int rightWidth,
String spacer) {
@@ -131,7 +131,7 @@
/**
* Gets the writer to use to write to the left column.
*
- * @return non-null; the left column writer
+ * @return {@code non-null;} the left column writer
*/
public Writer getLeft() {
return leftColumn;
@@ -140,7 +140,7 @@
/**
* Gets the writer to use to write to the right column.
*
- * @return non-null; the right column writer
+ * @return {@code non-null;} the right column writer
*/
public Writer getRight() {
return rightColumn;
@@ -226,8 +226,8 @@
* Appends a newline to the given buffer via the given writer, but
* only if it isn't empty and doesn't already end with one.
*
- * @param buf non-null; the buffer in question
- * @param out non-null; the writer to use
+ * @param buf {@code non-null;} the buffer in question
+ * @param out {@code non-null;} the writer to use
*/
private static void appendNewlineIfNecessary(StringBuffer buf,
Writer out)
@@ -242,8 +242,8 @@
/**
* Writes the given number of spaces to the given writer.
*
- * @param out non-null; where to write
- * @param amt >= 0; the number of spaces to write
+ * @param out {@code non-null;} where to write
+ * @param amt {@code >= 0;} the number of spaces to write
*/
private static void writeSpaces(Writer out, int amt) throws IOException {
while (amt > 0) {
diff --git a/dx/src/com/android/dx/util/Writers.java b/dx/src/com/android/dx/util/Writers.java
index f10e400..632b082 100644
--- a/dx/src/com/android/dx/util/Writers.java
+++ b/dx/src/com/android/dx/util/Writers.java
@@ -20,7 +20,7 @@
import java.io.Writer;
/**
- * Utilities for dealing with <code>Writer</code>s.
+ * Utilities for dealing with {@code Writer}s.
*/
public final class Writers {
/**
@@ -31,12 +31,12 @@
}
/**
- * Makes a <code>PrintWriter</code> for the given <code>Writer</code>,
+ * Makes a {@code PrintWriter} for the given {@code Writer},
* returning the given writer if it already happens to be the right
* class.
*
- * @param writer non-null; writer to (possibly) wrap
- * @return non-null; an appropriate instance
+ * @param writer {@code non-null;} writer to (possibly) wrap
+ * @return {@code non-null;} an appropriate instance
*/
public static PrintWriter printWriterFor(Writer writer) {
if (writer instanceof PrintWriter) {
diff --git a/dx/src/com/android/dx/util/_tests/_Bits.java b/dx/src/com/android/dx/util/_tests/_Bits.java
index e529b50..a95fc14 100644
--- a/dx/src/com/android/dx/util/_tests/_Bits.java
+++ b/dx/src/com/android/dx/util/_tests/_Bits.java
@@ -21,7 +21,7 @@
import junit.framework.TestCase;
/**
- * Test the class <code>com.android.dx.util.Bits</code>.
+ * Test the class {@code com.android.dx.util.Bits}.
*/
public class _Bits
extends TestCase {
diff --git a/dx/src/com/android/dx/util/_tests/_IntList.java b/dx/src/com/android/dx/util/_tests/_IntList.java
index 241e8be..dadbd54 100644
--- a/dx/src/com/android/dx/util/_tests/_IntList.java
+++ b/dx/src/com/android/dx/util/_tests/_IntList.java
@@ -21,7 +21,7 @@
import junit.framework.TestCase;
/**
- * Test the class <code>com.android.dx.util.IntList</code>.
+ * Test the class {@code com.android.dx.util.IntList}.
*/
public class _IntList
extends TestCase {
diff --git a/dx/tests/111-use-null-as-array/Blort.java b/dx/tests/111-use-null-as-array/Blort.java
new file mode 100644
index 0000000..c16684f
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/Blort.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Blort {
+ public static boolean test_getBooleanArray() {
+ boolean[] arr = null;
+ return arr[1];
+ }
+
+ public static byte test_getByteArray() {
+ byte[] arr = null;
+ return arr[2];
+ }
+
+ public static char test_getCharArray() {
+ char[] arr = null;
+ return arr[3];
+ }
+
+ public static double test_getDoubleArray() {
+ double[] arr = null;
+ return arr[4];
+ }
+
+ public static float test_getFloatArray() {
+ float[] arr = null;
+ return arr[5];
+ }
+
+ public static int test_getIntArray() {
+ int[] arr = null;
+ return arr[6];
+ }
+
+ public static long test_getLongArray() {
+ long[] arr = null;
+ return arr[7];
+ }
+
+ public static Object test_getObjectArray() {
+ Object[] arr = null;
+ return arr[8];
+ }
+
+ public static short test_getShortArray() {
+ short[] arr = null;
+ return arr[9];
+ }
+
+ public static void test_setBooleanArray() {
+ boolean[] arr = null;
+ arr[1] = true;
+ }
+
+ public static void test_setByteArray() {
+ byte[] arr = null;
+ arr[2] = (byte) 3;
+ }
+
+ public static void test_setCharArray() {
+ char[] arr = null;
+ arr[4] = (char) 5;
+ }
+
+ public static void test_setDoubleArray() {
+ double[] arr = null;
+ arr[6] = 7.0F;
+ }
+
+ public static void test_setFloatArray() {
+ float[] arr = null;
+ arr[8] = 9.0F;
+ }
+
+ public static void test_setIntArray() {
+ int[] arr = null;
+ arr[10] = 11;
+ }
+
+ public static void test_setLongArray() {
+ long[] arr = null;
+ arr[12] = 13;
+ }
+
+ public static void test_setObjectArray() {
+ Object[] arr = null;
+ arr[14] = "blort";
+ }
+
+ public static void test_setShortArray() {
+ short[] arr = null;
+ arr[15] = (short) 16;
+ }
+}
+
diff --git a/dx/tests/111-use-null-as-array/expected.txt b/dx/tests/111-use-null-as-array/expected.txt
new file mode 100644
index 0000000..7e2116b
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/expected.txt
@@ -0,0 +1,116 @@
+Blort.test_getBooleanArray:()Z:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 1 // #1
+ 0002: aget-byte v0, v0, v1
+ 0004: return v0
+Blort.test_getByteArray:()B:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 2 // #2
+ 0002: aget-byte v0, v0, v1
+ 0004: return v0
+Blort.test_getCharArray:()C:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 3 // #3
+ 0002: aget-char v0, v0, v1
+ 0004: return v0
+Blort.test_getDoubleArray:()D:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 4 // #4
+ 0002: aget-wide v0, v0, v1
+ 0004: return-wide v0
+Blort.test_getFloatArray:()F:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 5 // #5
+ 0002: aget v0, v0, v1
+ 0004: return v0
+Blort.test_getIntArray:()I:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 6 // #6
+ 0002: aget v0, v0, v1
+ 0004: return v0
+Blort.test_getLongArray:()J:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 7 // #7
+ 0002: aget-wide v0, v0, v1
+ 0004: return-wide v0
+Blort.test_getObjectArray:()Ljava/lang/Object;:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 8 // #0008
+ 0003: aget-object v0, v0, v1
+ 0005: return-object v0
+Blort.test_getShortArray:()S:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 9 // #0009
+ 0003: aget-short v0, v0, v1
+ 0005: return v0
+Blort.test_setBooleanArray:()V:
+regs: 0002; ins: 0000; outs: 0000
+ 0000: const/4 v1, #int 1 // #1
+ 0001: const/4 v0, #null // #0
+ 0002: aput v1, v0, v1
+ 0004: return-void
+Blort.test_setByteArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 2 // #2
+ 0002: const/4 v2, #int 3 // #3
+ 0003: aput v2, v0, v1
+ 0005: return-void
+Blort.test_setCharArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 4 // #4
+ 0002: const/4 v2, #int 5 // #5
+ 0003: aput v2, v0, v1
+ 0005: return-void
+Blort.test_setDoubleArray:()V:
+regs: 0004; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/4 v1, #int 6 // #6
+ 0002: const-wide/high16 v2, #double 7.0 // #401c000000000000
+ 0004: aput-wide v2, v0, v1
+ 0006: return-void
+Blort.test_setFloatArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 8 // #0008
+ 0003: const/high16 v2, #float 9.0 // #41100000
+ 0005: aput v2, v0, v1
+ 0007: return-void
+Blort.test_setIntArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 10 // #000a
+ 0003: const/16 v2, #int 11 // #000b
+ 0005: aput v2, v0, v1
+ 0007: return-void
+Blort.test_setLongArray:()V:
+regs: 0004; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 12 // #000c
+ 0003: const-wide/16 v2, #long 13 // #000d
+ 0005: aput-wide v2, v0, v1
+ 0007: return-void
+Blort.test_setObjectArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 14 // #000e
+ 0003: const-string v2, "blort"
+ 0005: aput-object v2, v0, v1
+ 0007: return-void
+Blort.test_setShortArray:()V:
+regs: 0003; ins: 0000; outs: 0000
+ 0000: const/4 v0, #null // #0
+ 0001: const/16 v1, #int 15 // #000f
+ 0003: const/16 v2, #int 16 // #0010
+ 0005: aput v2, v0, v1
+ 0007: return-void
diff --git a/dx/tests/111-use-null-as-array/info.txt b/dx/tests/111-use-null-as-array/info.txt
new file mode 100644
index 0000000..624386d
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/info.txt
@@ -0,0 +1,18 @@
+This is a smoke test of dex conversion, which checks to see that uses
+of a known-null in contexts that require a specific type end up getting
+converted to the type in question. When executed, this sort of code
+will inevitably throw a NullPointerException, but if the opcode weren't
+correct, they would instead incorrectly fail verification.
+
+If you inspect the expected output of this test, you will see that
+there are some surprising instructions in there, such as using
+aget-byte for what was a boolean[] in the source code. In these cases,
+the resulting output is still correct (passes verification and will
+throw a NullPointerException if ever executed). However, it happens
+that during translation there simply wasn't enough information to
+recover the "true" original meaning at the level of actual opcode
+selection.
+
+This test compares emitted code against a known-good (via eyeballing)
+version, so it is possible for this test to spuriously fail if other
+aspects of conversion end up altering the output in innocuous ways.
diff --git a/dx/tests/111-use-null-as-array/run b/dx/tests/111-use-null-as-array/run
new file mode 100644
index 0000000..7e4e1e8
--- /dev/null
+++ b/dx/tests/111-use-null-as-array/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+$JAVAC -g -d . Blort.java
+dx --debug --dex --positions=none --no-locals \
+ --dump-to=- --dump-method="Blort.test*" *.class
diff --git a/libcore/dalvik/src/main/java/dalvik/system/PathClassLoader.java b/libcore/dalvik/src/main/java/dalvik/system/PathClassLoader.java
index c80aef8..55e61a9 100644
--- a/libcore/dalvik/src/main/java/dalvik/system/PathClassLoader.java
+++ b/libcore/dalvik/src/main/java/dalvik/system/PathClassLoader.java
@@ -56,8 +56,8 @@
/**
* Creates a {@code PathClassLoader} that operates on a given list of files
* and directories. This method is equivalent to calling
- * {@link #PathClassLoader(String, String, ClassLoader) with a {@code null}
- * value for the second argument (see description there).
+ * {@link #PathClassLoader(String, String, ClassLoader)} with a
+ * {@code null} value for the second argument (see description there).
*
* @param path
* the list of files and directories
diff --git a/libcore/dalvik/src/main/java/dalvik/system/VMDebug.java b/libcore/dalvik/src/main/java/dalvik/system/VMDebug.java
index d9f11ce..fd2d8ba 100644
--- a/libcore/dalvik/src/main/java/dalvik/system/VMDebug.java
+++ b/libcore/dalvik/src/main/java/dalvik/system/VMDebug.java
@@ -260,6 +260,13 @@
*/
public static native void dumpHprofData(String fileName) throws IOException;
+ /**
+ * Primes the register map cache.
+ *
+ * @hide
+ */
+ public static native boolean cacheRegisterMap(String classAndMethodDesc);
+
/* don't ask */
static native void printThis(Object thisThing, int count, int thing);
diff --git a/libcore/icu/src/main/native/ResourceInterface.cpp b/libcore/icu/src/main/native/ResourceInterface.cpp
index 5f9d442..442d688 100644
--- a/libcore/icu/src/main/native/ResourceInterface.cpp
+++ b/libcore/icu/src/main/native/ResourceInterface.cpp
@@ -1207,7 +1207,8 @@
intCurrencySymbol = env->NewStringUTF("XXX");
}
if(currencySymbol == NULL) {
- currencySymbol = env->NewStringUTF("\u00a4");
+ // creating a new string explicitly with the UTF-8 encoding of "\u00a4"
+ currencySymbol = env->NewStringUTF("\xc2\xa4");
}
counter += 2;
diff --git a/libcore/luni-kernel/src/main/native/java_lang_ProcessManager.c b/libcore/luni-kernel/src/main/native/java_lang_ProcessManager.c
index ee2fc58..a572237 100644
--- a/libcore/luni-kernel/src/main/native/java_lang_ProcessManager.c
+++ b/libcore/luni-kernel/src/main/native/java_lang_ProcessManager.c
@@ -91,7 +91,8 @@
while (1) {
int status;
- pid_t pid = wait(&status);
+ /* wait for children in our process group */
+ pid_t pid = waitpid(0, &status, 0);
if (pid >= 0) {
// Extract real status.
diff --git a/libcore/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddressFactory.java b/libcore/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddressFactory.java
index 5c31980..9ec0fcd 100644
--- a/libcore/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddressFactory.java
+++ b/libcore/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddressFactory.java
@@ -24,15 +24,63 @@
public class PlatformAddressFactory {
+ // BEGIN android-added
+ /**
+ * Defines the number of PlatformAddress objects to be cached. Must be a
+ * power of two. Caching PlatformAddress objects minimizes the creation
+ * of garbage and reduces the number of GC-hiccups in OpenGL animations.
+ */
+ private final static int CACHE_SIZE = 1<<8;
+
+ /**
+ * A mask with all bits set, matching the size of the cache.
+ */
+ private final static int CACHE_MASK = CACHE_SIZE - 1;
+
+ /**
+ * Defines the maximum number of probes taken per hash, used for looking
+ * up an empty cache slot or a previously stored PlatformAddress.
+ */
+ private final static int MAX_PROBES = 5;
+
+ /**
+ * A cycling index (0 to MAX_PROBES-1) used to replace elements in the cache.
+ */
+ private static int replacementIndex = 0;
+
+ /**
+ * Array of PlatformAddress references kept from garbage collection.
+ */
+ private static PlatformAddress[] cache = new PlatformAddress[CACHE_SIZE];
+ // END android-added
+
+
+ // BEGIN android-changed
+ public synchronized static PlatformAddress on(int value, long size) {
+ if (value == 0) {
+ return PlatformAddress.NULL;
+ }
+ int idx = value >> 5;
+ for (int probe = 0; probe < MAX_PROBES; probe++) {
+ PlatformAddress cachedObj = cache[(idx + probe) & CACHE_MASK];
+ if (cachedObj == null) {
+ return cache[(idx + probe) & CACHE_MASK] =
+ new PlatformAddress(value, size);
+ }
+ if (cachedObj.osaddr == value && cachedObj.size == size) {
+ return cachedObj;
+ }
+ }
+ replacementIndex = (replacementIndex + 1) % MAX_PROBES;
+ return cache[(idx + replacementIndex) & CACHE_MASK] =
+ new PlatformAddress(value, size);
+ }
+ // END android-changed
+
public static PlatformAddress on(int value) {
return PlatformAddressFactory.on(value, PlatformAddress.UNKNOWN);
}
- public static PlatformAddress on(int value, long size) {
- PlatformAddress addr = (value == 0) ? PlatformAddress.NULL : new PlatformAddress(value, size);
- return addr;
- }
-
public static MappedPlatformAddress mapOn(int value, long size) {
MappedPlatformAddress addr = new MappedPlatformAddress(value, size);
return addr;
diff --git a/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
index f79c019..fd355e0 100755
--- a/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
+++ b/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
@@ -1379,7 +1379,7 @@
// LOGD("ENTER readSocketDirectImpl");
int handle;
- jbyte *message = (jbyte *)address;
+ jbyte *message = (jbyte *)address + offset;
int result, ret, localCount;
handle = jniGetFDFromFileDescriptor(env, fileDescriptor);
@@ -1437,7 +1437,7 @@
}
result = osNetworkSystem_readSocketDirectImpl(env, clazz, fileDescriptor,
- (jint) message, offset, count, timeout);
+ (jint) message, 0, localCount, timeout);
if (result > 0) {
env->SetByteArrayRegion(data, offset, result, (jbyte *)message);
@@ -1455,7 +1455,7 @@
// LOGD("ENTER writeSocketDirectImpl");
int handle;
- jbyte *message = (jbyte *)address;
+ jbyte *message = (jbyte *)address + offset;
int result = 0, sent = 0;
if (count <= 0) {
@@ -1499,7 +1499,7 @@
if (!socketExConstructor) {
return 0;
}
- socketEx = env->NewObject(socketExClass, socketExConstructor, errorMessageString);
+ socketEx = env->NewObject(socketExClass, socketExConstructor, errorMessageString);
socketExCauseMethod = env->GetMethodID(socketExClass,"initCause","(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
env->CallObjectMethod(socketEx,socketExCauseMethod,errorCodeEx);
env->Throw((jthrowable)socketEx);
@@ -1539,13 +1539,13 @@
env->GetByteArrayRegion(data, offset, count, message);
result = osNetworkSystem_writeSocketDirectImpl(env, clazz, fileDescriptor,
- (jint) message, offset, count);
+ (jint) message, 0, count);
if (( jbyte *)message != internalBuffer) {
- free(( jbyte *)message);
+ free(( jbyte *)message);
}
#undef INTERNAL_SEND_BUFFER_MAX
- return result;
+ return result;
}
static void osNetworkSystem_setNonBlockingImpl(JNIEnv* env, jclass clazz,
@@ -2256,7 +2256,7 @@
}
int actualLength = osNetworkSystem_receiveDatagramDirectImpl(env, clazz, fd,
- packet, (jint)bytes, offset, localLength, receiveTimeout, peek);
+ packet, (jint)bytes, 0, localLength, receiveTimeout, peek);
if (actualLength > 0) {
env->SetByteArrayRegion(data, offset, actualLength, bytes);
@@ -2315,7 +2315,7 @@
}
int actualLength = osNetworkSystem_recvConnectedDatagramDirectImpl(env,
- clazz, fd, packet, (jint)bytes, offset, localLength,
+ clazz, fd, packet, (jint)bytes, 0, localLength,
receiveTimeout, peek);
if (actualLength > 0) {
@@ -2757,10 +2757,10 @@
}
if (0 < result) {
- /*output the result to a int array*/
- flagArray = env->GetIntArrayElements(outFlags, &isCopy);
+ /*output the result to a int array*/
+ flagArray = env->GetIntArrayElements(outFlags, &isCopy);
- for (val=0; val<countReadC; val++) {
+ for (val=0; val<countReadC; val++) {
gotFD = env->GetObjectArrayElement(readFDArray,val);
handle = jniGetFDFromFileDescriptor(env, gotFD);
@@ -3056,7 +3056,7 @@
break;
}
- case JAVASOCKOPT_MCAST_TTL: {
+ case JAVASOCKOPT_MCAST_TTL: {
if ((anOption >> 16) & BROKEN_MULTICAST_TTL) {
return;
}
@@ -3071,13 +3071,13 @@
case JAVASOCKOPT_MCAST_ADD_MEMBERSHIP: {
mcastAddDropMembership(env, handle, optVal,
(anOption >> 16) & BROKEN_MULTICAST_IF, IP_ADD_MEMBERSHIP);
- return;
+ break;
}
case JAVASOCKOPT_MCAST_DROP_MEMBERSHIP: {
mcastAddDropMembership(env, handle, optVal,
(anOption >> 16) & BROKEN_MULTICAST_IF, IP_DROP_MEMBERSHIP);
- return;
+ break;
}
case JAVASOCKOPT_MCAST_INTERFACE: {
diff --git a/libcore/nio/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java b/libcore/nio/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
index 069623d..c586f59 100755
--- a/libcore/nio/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
+++ b/libcore/nio/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
@@ -28,6 +28,8 @@
import java.io.OutputStream;
import java.net.BindException;
import java.net.ConnectException;
+import java.net.Inet4Address;
+import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -4112,6 +4114,95 @@
}
}
+ /**
+ * @throws IOException
+ * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
+ */
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "read",
+ args = {java.nio.ByteBuffer[].class}
+ )
+ public void test_socketChannel_read_DirectByteBuffer() throws InterruptedException, IOException {
+
+ ServerThread server = new ServerThread();
+ server.start();
+ Thread.currentThread().sleep(1000);
+
+ InetSocketAddress address = new InetSocketAddress(InetAddress
+ .getByName("localhost"), port);
+
+ // First test with array based byte buffer
+ SocketChannel sc = SocketChannel.open();
+ sc.connect(address);
+
+ ByteBuffer buf = ByteBuffer.allocate(data.length);
+ buf.limit(data.length / 2);
+ sc.read(buf);
+
+ buf.limit(buf.capacity());
+ sc.read(buf);
+ sc.close();
+
+ // Make sure the buffer is filled correctly
+ buf.rewind();
+ assertSameContent(data, buf);
+
+ // Now test with direct byte buffer
+ sc = SocketChannel.open();
+ sc.connect(address);
+
+ buf = ByteBuffer.allocateDirect(data.length);
+ buf.limit(data.length / 2);
+ sc.read(buf);
+
+ buf.limit(buf.capacity());
+ sc.read(buf);
+ sc.close();
+
+ // Make sure the buffer is filled correctly
+ buf.rewind();
+ assertSameContent(data, buf);
+ }
+
+ private void assertSameContent(byte[] data, ByteBuffer buf) {
+ for (byte b : data) {
+ if (b != buf.get()) {
+ int pos = buf.position() - 1;
+ fail("Content not equal. Buffer position: " +
+ (pos) + " expected: " + b + " was: " + buf.get(pos));
+ }
+ }
+ }
+
+ public static boolean done = false;
+ public static int port = Support_PortManager.getNextPort();
+ public static byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+
+ static class ServerThread extends Thread {
+ @Override
+ public void run() {
+ try {
+ ServerSocketChannel ssc = ServerSocketChannel.open();
+ InetSocketAddress addr = new InetSocketAddress(InetAddress
+ .getByAddress(new byte[] {0, 0, 0, 0}), port);
+ ssc.socket().bind(addr, 0);
+
+ ByteBuffer buf = ByteBuffer.allocate(10);
+ buf.put(data);
+
+ while (!done) {
+ SocketChannel sc = ssc.accept();
+ buf.rewind();
+ sc.write(buf);
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+
class MockSocketChannel extends SocketChannel {
private boolean isWriteCalled = false;
diff --git a/libcore/prefs/src/main/java/java/util/prefs/Preferences.java b/libcore/prefs/src/main/java/java/util/prefs/Preferences.java
index b7a0c70..719c89a 100644
--- a/libcore/prefs/src/main/java/java/util/prefs/Preferences.java
+++ b/libcore/prefs/src/main/java/java/util/prefs/Preferences.java
@@ -1006,15 +1006,11 @@
//parse node's absolute path from class instance
private static String getNodeName(Class<?> c){
- // ??? PREFS TODO change back to harmony code once getPackage
- // delivers the correct results
- // Package p = c.getPackage();
- // if(null == p){
- // return "/<unnamed>"; //$NON-NLS-1$
- // }
- // return "/"+p.getName().replace('.', '/'); //$NON-NLS-1$
- int dotIndex = c.getName().lastIndexOf(".");
- return "/" + c.getName().substring(0, dotIndex).replace(".", "/");
+ Package p = c.getPackage();
+ if(null == p){
+ return "/<unnamed>"; //$NON-NLS-1$
+ }
+ return "/"+p.getName().replace('.', '/'); //$NON-NLS-1$
}
/**
diff --git a/libcore/text/src/main/java/java/text/RuleBasedCollator.java b/libcore/text/src/main/java/java/text/RuleBasedCollator.java
index 41a51e2..6418962 100644
--- a/libcore/text/src/main/java/java/text/RuleBasedCollator.java
+++ b/libcore/text/src/main/java/java/text/RuleBasedCollator.java
@@ -390,7 +390,7 @@
/**
* Returns the collation rules of this collator. These {@code rules} can be
- * fed into the {@link #RuleBasedCollator(String)} constructor.
+ * fed into the {@code RuleBasedCollator(String)} constructor.
* <p>
* Note that the {@code rules} are actually interpreted as a delta to the
* standard Unicode Collation Algorithm (UCA). Hence, an empty {@code rules}
diff --git a/libdex/CmdUtils.c b/libdex/CmdUtils.c
index ca1054c..073d5f9 100644
--- a/libdex/CmdUtils.c
+++ b/libdex/CmdUtils.c
@@ -97,12 +97,12 @@
*
* If "quiet" is set, don't report common errors.
*
- * Returns 0 on success.
+ * Returns 0 (kUTFRSuccess) on success.
*/
UnzipToFileResult dexOpenAndMap(const char* fileName, const char* tempFileName,
MemMapping* pMap, bool quiet)
{
- UnzipToFileResult result = kUTFRSuccess;
+ UnzipToFileResult result = kUTFRGenericFailure;
int len = strlen(fileName);
char tempName[32];
bool removeTemp = false;
diff --git a/libdex/CmdUtils.h b/libdex/CmdUtils.h
index fa354a9..e0b0105 100644
--- a/libdex/CmdUtils.h
+++ b/libdex/CmdUtils.h
@@ -34,6 +34,7 @@
/* encode the result of unzipping to a file */
typedef enum UnzipToFileResult {
kUTFRSuccess = 0,
+ kUTFRGenericFailure,
kUTFRBadArgs,
kUTFRNotZip,
kUTFRNoClassesDex,
diff --git a/libdex/DexFile.c b/libdex/DexFile.c
index 2639d7b..a8b5345 100644
--- a/libdex/DexFile.c
+++ b/libdex/DexFile.c
@@ -643,6 +643,10 @@
}
indexMapType = *pAux;
break;
+ case kDexChunkRegisterMaps:
+ LOGV("+++ found register maps, size=%u\n", size);
+ pDexFile->pRegisterMapPool = data;
+ break;
default:
LOGI("Unknown chunk 0x%08x (%c%c%c%c), size=%d in aux data area\n",
*pAux,
diff --git a/libdex/DexFile.h b/libdex/DexFile.h
index d1ea5eb..4d8d151 100644
--- a/libdex/DexFile.h
+++ b/libdex/DexFile.h
@@ -163,6 +163,7 @@
/* auxillary data section chunk codes */
enum {
kDexChunkClassLookup = 0x434c4b50, /* CLKP */
+ kDexChunkRegisterMaps = 0x524d4150, /* RMAP */
kDexChunkReducingIndexMap = 0x5249584d, /* RIXM */
kDexChunkExpandingIndexMap = 0x4549584d, /* EIXM */
@@ -514,11 +515,13 @@
const DexClassDef* pClassDefs;
const DexLink* pLinkData;
- /* mapped in "auxillary" section */
+ /*
+ * These are mapped out of the "auxillary" section, and may not be
+ * included in the file.
+ */
const DexClassLookup* pClassLookup;
-
- /* mapped in "auxillary" section */
DexIndexMap indexMap;
+ const void* pRegisterMapPool; // RegisterMapClassPool
/* points to start of DEX file data */
const u1* baseAddr;
@@ -672,6 +675,15 @@
return &pDexFile->pClassDefs[idx];
}
+/* given a ClassDef pointer, recover its index */
+DEX_INLINE u4 dexGetIndexForClassDef(const DexFile* pDexFile,
+ const DexClassDef* pClassDef)
+{
+ assert(pClassDef >= pDexFile->pClassDefs &&
+ pClassDef < pDexFile->pClassDefs + pDexFile->pHeader->classDefsSize);
+ return pClassDef - pDexFile->pClassDefs;
+}
+
/* get the interface list for a DexClass */
DEX_INLINE const DexTypeList* dexGetInterfacesList(const DexFile* pDexFile,
const DexClassDef* pClassDef)
diff --git a/libdex/DexSwapVerify.c b/libdex/DexSwapVerify.c
index 5ecda9f..bc6f51f 100644
--- a/libdex/DexSwapVerify.c
+++ b/libdex/DexSwapVerify.c
@@ -362,12 +362,15 @@
static bool swapMap(CheckState* state, DexMapList* pMap)
{
DexMapItem* item = pMap->list;
- u4 count = pMap->size;
+ u4 count;
u4 dataItemCount = 0; // Total count of items in the data section.
u4 dataItemsLeft = state->pHeader->dataSize; // See use below.
u4 usedBits = 0; // Bit set: one bit per section
bool first = true;
u4 lastOffset = 0;
+
+ SWAP_FIELD4(pMap->size);
+ count = pMap->size;
CHECK_LIST_SIZE(item, count, sizeof(DexMapItem));
@@ -392,21 +395,21 @@
}
if (isDataSectionType(item->type)) {
- u4 count = item->size;
+ u4 icount = item->size;
/*
* This sanity check on the data section items ensures that
* there are no more items than the number of bytes in
* the data section.
*/
- if (count > dataItemsLeft) {
+ if (icount > dataItemsLeft) {
LOGE("Unrealistically many items in the data section: "
- "at least %d\n", dataItemCount + count);
+ "at least %d\n", dataItemCount + icount);
return false;
}
- dataItemsLeft -= count;
- dataItemCount += count;
+ dataItemsLeft -= icount;
+ dataItemCount += icount;
}
u4 bit = mapTypeToBitMask(item->type);
@@ -2077,6 +2080,7 @@
while (size--) {
data = verifyEncodedValue(state, data, crossVerify);
if (data == NULL) {
+ LOGE("Bogus encoded_array value\n");
return NULL;
}
}
diff --git a/libdex/Leb128.h b/libdex/Leb128.h
index 215ae30..41799fe 100644
--- a/libdex/Leb128.h
+++ b/libdex/Leb128.h
@@ -124,4 +124,41 @@
*/
int readAndVerifySignedLeb128(const u1** pStream, const u1* limit, bool* okay);
+
+/*
+ * Writes a 32-bit value in unsigned ULEB128 format.
+ *
+ * Returns the updated pointer.
+ */
+DEX_INLINE u1* writeUnsignedLeb128(u1* ptr, u4 data)
+{
+ while (true) {
+ u1 out = data & 0x7f;
+ if (out != data) {
+ *ptr++ = out | 0x80;
+ data >>= 7;
+ } else {
+ *ptr++ = out;
+ break;
+ }
+ }
+
+ return ptr;
+}
+
+/*
+ * Returns the number of bytes needed to encode "val" in ULEB128 form.
+ */
+DEX_INLINE int unsignedLeb128Size(u4 data)
+{
+ int count = 0;
+
+ do {
+ data >>= 7;
+ count++;
+ } while (data != 0);
+
+ return count;
+}
+
#endif
diff --git a/libdex/SysUtil.c b/libdex/SysUtil.c
index 530ac2e..bf1be88 100644
--- a/libdex/SysUtil.c
+++ b/libdex/SysUtil.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* System utilities.
*/
@@ -64,6 +65,25 @@
#endif
}
+/*
+ * Create a private anonymous storage area.
+ */
+int sysCreatePrivateMap(size_t length, MemMapping* pMap)
+{
+ void* memPtr;
+
+ memPtr = sysCreateAnonShmem(length);
+ if (memPtr == NULL)
+ return -1;
+
+ pMap->addr = pMap->baseAddr = memPtr;
+ pMap->length = pMap->baseLength = length;
+ return 0;
+}
+
+/*
+ * Determine the current offset and remaining length of the open file.
+ */
static int getFileStartAndLength(int fd, off_t *start_, size_t *length_)
{
off_t start, end;
diff --git a/libdex/SysUtil.h b/libdex/SysUtil.h
index 8d85efa..8b80503 100644
--- a/libdex/SysUtil.h
+++ b/libdex/SysUtil.h
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* System utilities.
*/
@@ -63,6 +64,13 @@
MemMapping* pMap);
/*
+ * Create a private anonymous mapping, useful for large allocations.
+ *
+ * On success, "pMap" is filled in, and zero is returned.
+ */
+int sysCreatePrivateMap(size_t length, MemMapping* pMap);
+
+/*
* Release the pages associated with a shared memory segment.
*
* This does not free "pMap"; it just releases the memory.
diff --git a/libdex/ZipArchive.c b/libdex/ZipArchive.c
index a75a85b..3f88e7d 100644
--- a/libdex/ZipArchive.c
+++ b/libdex/ZipArchive.c
@@ -285,6 +285,8 @@
LOGV("Opening archive '%s' %p\n", fileName, pArchive);
+ memset(pArchive, 0, sizeof(ZipArchive));
+
fd = open(fileName, O_RDONLY, 0);
if (fd < 0) {
err = errno ? errno : -1;
diff --git a/tests/042-new-instance/src/Main.java b/tests/042-new-instance/src/Main.java
index 49894fe..037aa2a 100644
--- a/tests/042-new-instance/src/Main.java
+++ b/tests/042-new-instance/src/Main.java
@@ -1,4 +1,20 @@
-// Copyright 2007 The Android Open Source Project
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Constructor;
import java.lang.reflect.Constructor;
@@ -29,7 +45,7 @@
try {
Class c = Class.forName("otherpackage.PackageAccess");
Object obj = c.newInstance();
- System.out.println("ERROR: PackageAccess succeeded unexpectedly");
+ System.err.println("ERROR: PackageAccess succeeded unexpectedly");
} catch (IllegalAccessException iae) {
System.out.println("Got expected PackageAccess complaint");
} catch (Exception ex) {
diff --git a/tests/071-dexfile/src/Main.java b/tests/071-dexfile/src/Main.java
index 0e6cce7..42c841d 100644
--- a/tests/071-dexfile/src/Main.java
+++ b/tests/071-dexfile/src/Main.java
@@ -15,6 +15,7 @@
*/
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Constructor;
/**
@@ -28,10 +29,49 @@
private static final String LIB_DIR = "/nowhere/nothing/";
/**
+ * Prep the environment then run the test.
+ */
+ public static void main(String[] args) {
+ Process p;
+ try {
+ /*
+ * Create a sub-process to see if the ProcessManager wait
+ * interferes with the dexopt invocation wait.
+ *
+ * /dev/random never hits EOF, so we're sure that we'll still
+ * be waiting for the process to complete. On the device it
+ * stops pretty quickly (which means the child won't be
+ * spinning).
+ */
+ ProcessBuilder pb = new ProcessBuilder("cat", "/dev/random");
+ p = pb.start();
+ } catch (IOException ioe) {
+ System.err.println("cmd failed: " + ioe.getMessage());
+ p = null;
+ }
+
+ try {
+ testDexClassLoader();
+ } finally {
+ // shouldn't be necessary, but it's good to be tidy
+ if (p != null)
+ p.destroy();
+
+ // let the ProcessManager's daemon thread finish before we shut down
+ // (avoids the occasional segmentation fault)
+ try {
+ Thread.sleep(500);
+ } catch (Exception ex) {}
+ }
+
+ System.out.println("done");
+ }
+
+ /**
* Create a class loader, explicitly specifying the source DEX and
* the location for the optimized DEX.
*/
- public static void main(String[] args) {
+ private static void testDexClassLoader() {
ClassLoader dexClassLoader = getDexClassLoader();
Class anotherClass;
@@ -50,10 +90,8 @@
throw new RuntimeException("new another", ie);
}
- /* not expected to work; just exercises the call */
+ // not expected to work; just exercises the call
dexClassLoader.getResource("nonexistent");
-
- System.out.println("done");
}
/*
@@ -94,6 +132,7 @@
throw new RuntimeException("DCL ctor", nsme);
}
+ // create an instance, using the path we found
Object dclObj;
try {
dclObj = ctor.newInstance(CLASS_PATH, odexDir, LIB_DIR, myLoader);
diff --git a/tests/072-precise-gc/expected.txt b/tests/072-precise-gc/expected.txt
new file mode 100644
index 0000000..18ec087
--- /dev/null
+++ b/tests/072-precise-gc/expected.txt
@@ -0,0 +1,2 @@
+Valid refs: 0
+String0String1String2String3String4String5String6String7String8String9
diff --git a/tests/072-precise-gc/info.txt b/tests/072-precise-gc/info.txt
new file mode 100644
index 0000000..b0b2cea
--- /dev/null
+++ b/tests/072-precise-gc/info.txt
@@ -0,0 +1 @@
+Try to detect whether precise GC is working.
diff --git a/tests/072-precise-gc/src/Main.java b/tests/072-precise-gc/src/Main.java
new file mode 100644
index 0000000..9b2315d
--- /dev/null
+++ b/tests/072-precise-gc/src/Main.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.ref.WeakReference;
+
+public class Main {
+ public static void main(String[] args) {
+ staleStackTest();
+ }
+
+ public static void staleStackTest() {
+ WeakReference wrefs[] = new WeakReference[10];
+
+ populate(wrefs);
+
+ check(wrefs);
+ }
+
+ static void populate(WeakReference[] wrefs) {
+ /*
+ * Get a bunch of non-constant String objects into registers. These
+ * should be the first locals declared.
+ */
+ String str0 = generateString("String", 0);
+ String str1 = generateString("String", 1);
+ String str2 = generateString("String", 2);
+ String str3 = generateString("String", 3);
+ String str4 = generateString("String", 4);
+ String str5 = generateString("String", 5);
+ String str6 = generateString("String", 6);
+ String str7 = generateString("String", 7);
+ String str8 = generateString("String", 8);
+ String str9 = generateString("String", 9);
+
+ /* stuff them into the weak references array */
+ wrefs[0] = new WeakReference(str0);
+ wrefs[1] = new WeakReference(str1);
+ wrefs[2] = new WeakReference(str2);
+ wrefs[3] = new WeakReference(str3);
+ wrefs[4] = new WeakReference(str4);
+ wrefs[5] = new WeakReference(str5);
+ wrefs[6] = new WeakReference(str6);
+ wrefs[7] = new WeakReference(str7);
+ wrefs[8] = new WeakReference(str8);
+ wrefs[9] = new WeakReference(str9);
+ }
+
+ static String generateString(String base, int num) {
+ return base + num;
+ }
+
+ static void check(WeakReference[] wrefs) {
+ /*
+ * Declare locals so that our stack overlaps the same region
+ * that populate() did.
+ */
+ String str0;
+ String str1;
+ String str2;
+ String str3;
+ String str4;
+ String str5;
+ String str6;
+ String str7;
+ String str8;
+ String str9;
+ int numValid = 0;
+
+ /*
+ * This *should* blow out all the weakly-reference objects. If
+ * we still have stale copies of references on the stack, a
+ * conservative GC will try to hold on to those objects and the
+ * count will be nonzero.
+ *
+ * Getting a zero result here isn't conclusive, but it's a strong
+ * indicator that precise GC is having an impact.
+ */
+ System.gc();
+
+ for (int i = 0; i < wrefs.length; i++) {
+ if (wrefs[i].get() != null)
+ numValid++;
+ }
+
+ System.out.println("Valid refs: " + numValid);
+
+ /* use the locals in case the compiler gets smart */
+ str0 = generateString("String", 0);
+ str1 = generateString("String", 1);
+ str2 = generateString("String", 2);
+ str3 = generateString("String", 3);
+ str4 = generateString("String", 4);
+ str5 = generateString("String", 5);
+ str6 = generateString("String", 6);
+ str7 = generateString("String", 7);
+ str8 = generateString("String", 8);
+ str9 = generateString("String", 9);
+ System.out.println(str0+str1+str2+str3+str4+str5+str6+str7+str8+str9);
+ }
+}
+
diff --git a/tests/073-mismatched-field/expected.txt b/tests/073-mismatched-field/expected.txt
new file mode 100644
index 0000000..90fbab8
--- /dev/null
+++ b/tests/073-mismatched-field/expected.txt
@@ -0,0 +1 @@
+Got expected failure
diff --git a/tests/073-mismatched-field/info.txt b/tests/073-mismatched-field/info.txt
new file mode 100644
index 0000000..4a15263
--- /dev/null
+++ b/tests/073-mismatched-field/info.txt
@@ -0,0 +1,3 @@
+Test behavior when an instance field is overlapped (through separate
+compilation) by a static field. The VM is expected to detect the conflict
+and throw an IncompatibleClassChangeError when the field is accessed.
diff --git a/tests/073-mismatched-field/src/IMain.java b/tests/073-mismatched-field/src/IMain.java
new file mode 100644
index 0000000..301dd21
--- /dev/null
+++ b/tests/073-mismatched-field/src/IMain.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface IMain {
+ //static int f = 123;
+}
+
diff --git a/tests/073-mismatched-field/src/Main.java b/tests/073-mismatched-field/src/Main.java
new file mode 100644
index 0000000..fb9f32a
--- /dev/null
+++ b/tests/073-mismatched-field/src/Main.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main extends SuperMain implements IMain {
+ public static void main(String[] args) {
+ Main main = new Main();
+ main.doit();
+ }
+
+ void doit() {
+ try {
+ System.out.println("value=" + this.f);
+ System.err.println("Succeeded unexpectedly");
+ } catch (IncompatibleClassChangeError icce) {
+ System.out.println("Got expected failure");
+ }
+ }
+}
+
diff --git a/tests/073-mismatched-field/src/SuperMain.java b/tests/073-mismatched-field/src/SuperMain.java
new file mode 100644
index 0000000..7447739
--- /dev/null
+++ b/tests/073-mismatched-field/src/SuperMain.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class SuperMain {
+ public int f = 456;
+}
+
diff --git a/tests/073-mismatched-field/src2/IMain.java b/tests/073-mismatched-field/src2/IMain.java
new file mode 100644
index 0000000..585c738
--- /dev/null
+++ b/tests/073-mismatched-field/src2/IMain.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface IMain {
+ static int f = 123;
+}
+
diff --git a/tests/074-gc-thrash/expected.txt b/tests/074-gc-thrash/expected.txt
new file mode 100644
index 0000000..2669165
--- /dev/null
+++ b/tests/074-gc-thrash/expected.txt
@@ -0,0 +1,2 @@
+Running (10 seconds) ...
+Done.
diff --git a/tests/074-gc-thrash/info.txt b/tests/074-gc-thrash/info.txt
new file mode 100644
index 0000000..c195adb
--- /dev/null
+++ b/tests/074-gc-thrash/info.txt
@@ -0,0 +1,2 @@
+This thrashes the memory allocator and garbage collector for a brief period.
+
diff --git a/tests/074-gc-thrash/src/Main.java b/tests/074-gc-thrash/src/Main.java
new file mode 100644
index 0000000..f79e5ce
--- /dev/null
+++ b/tests/074-gc-thrash/src/Main.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+public class Main {
+ public static volatile boolean quit = false;
+ public static final boolean DEBUG = false;
+
+ private static final boolean WRITE_HPROF_DATA = false;
+ private static final int TEST_TIME = 10;
+ private static final String OUTPUT_FILE = "gc-thrash.hprof";
+
+ public static void main(String[] args) {
+ // dump heap before
+
+ System.out.println("Running (" + TEST_TIME + " seconds) ...");
+ runTests();
+
+ Method dumpHprofDataMethod = null;
+ String dumpFile = null;
+
+ if (WRITE_HPROF_DATA) {
+ dumpHprofDataMethod = getDumpHprofDataMethod();
+ if (dumpHprofDataMethod != null) {
+ dumpFile = getDumpFileName();
+ System.out.println("Sending output to " + dumpFile);
+ }
+ }
+
+ System.gc();
+ System.runFinalization();
+ System.gc();
+
+ if (WRITE_HPROF_DATA && dumpHprofDataMethod != null) {
+ try {
+ dumpHprofDataMethod.invoke(null, dumpFile);
+ } catch (IllegalAccessException iae) {
+ System.err.println(iae);
+ } catch (InvocationTargetException ite) {
+ System.err.println(ite);
+ }
+ }
+
+ System.out.println("Done.");
+ }
+
+ /**
+ * Finds VMDebug.dumpHprofData() through reflection. In the reference
+ * implementation this will not be available.
+ *
+ * @return the reflection object, or null if the method can't be found
+ */
+ private static Method getDumpHprofDataMethod() {
+ ClassLoader myLoader = Main.class.getClassLoader();
+ Class vmdClass;
+ try {
+ vmdClass = myLoader.loadClass("dalvik.system.VMDebug");
+ } catch (ClassNotFoundException cnfe) {
+ return null;
+ }
+
+ Method meth;
+ try {
+ meth = vmdClass.getMethod("dumpHprofData",
+ new Class[] { String.class });
+ } catch (NoSuchMethodException nsme) {
+ System.err.println("Found VMDebug but not dumpHprofData method");
+ return null;
+ }
+
+ return meth;
+ }
+
+ private static String getDumpFileName() {
+ File tmpDir = new File("/tmp");
+ if (tmpDir.exists() && tmpDir.isDirectory()) {
+ return "/tmp/" + OUTPUT_FILE;
+ }
+
+ File sdcard = new File("/sdcard");
+ if (sdcard.exists() && sdcard.isDirectory()) {
+ return "/sdcard/" + OUTPUT_FILE;
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Run the various tests for a set period.
+ */
+ public static void runTests() {
+ Robin robin = new Robin();
+ Deep deep = new Deep();
+ Large large = new Large();
+
+ /* start all threads */
+ robin.start();
+ deep.start();
+ large.start();
+
+ /* let everybody run for 10 seconds */
+ sleep(TEST_TIME * 1000);
+
+ quit = true;
+
+ try {
+ /* wait for all threads to stop */
+ robin.join();
+ deep.join();
+ large.join();
+ } catch (InterruptedException ie) {
+ System.err.println("join was interrupted");
+ }
+ }
+
+ /**
+ * Sleeps for the "ms" milliseconds.
+ */
+ public static void sleep(int ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException ie) {
+ System.err.println("sleep was interrupted");
+ }
+ }
+
+ /**
+ * Sleeps briefly, allowing other threads some CPU time to get started.
+ */
+ public static void startupDelay() {
+ sleep(500);
+ }
+}
+
+
+/**
+ * Allocates useless objects and holds on to several of them.
+ *
+ * Uses a single large array of references, replaced repeatedly in round-robin
+ * order.
+ */
+class Robin extends Thread {
+ private static final int ARRAY_SIZE = 40960;
+ int sleepCount = 0;
+
+ public void run() {
+ Main.startupDelay();
+
+ String strings[] = new String[ARRAY_SIZE];
+ int idx = 0;
+
+ while (!Main.quit) {
+ strings[idx] = makeString(idx);
+
+ if (idx % (ARRAY_SIZE / 4) == 0) {
+ Main.sleep(400);
+ sleepCount++;
+ }
+
+ idx = (idx + 1) % ARRAY_SIZE;
+ }
+
+ if (Main.DEBUG)
+ System.out.println("Robin: sleepCount=" + sleepCount);
+ }
+
+ private String makeString(int val) {
+ return new String("Robin" + val);
+ }
+}
+
+
+/**
+ * Allocates useless objects in recursive calls.
+ */
+class Deep extends Thread {
+ private static final int MAX_DEPTH = 61;
+
+ private static String strong[] = new String[MAX_DEPTH];
+ private static WeakReference weak[] = new WeakReference[MAX_DEPTH];
+
+ public void run() {
+ int iter = 0;
+ boolean once = false;
+
+ Main.startupDelay();
+
+ while (!Main.quit) {
+ dive(0, iter);
+ once = true;
+ iter += MAX_DEPTH;
+ }
+
+ if (!once) {
+ System.err.println("not even once?");
+ return;
+ }
+
+ /*
+ * Check the results of the last trip through. Everything in
+ * "weak" should be matched in "strong", and the two should be
+ * equivalent (object-wise, not just string-equality-wise).
+ */
+ for (int i = 0; i < MAX_DEPTH; i++) {
+ if (strong[i] != weak[i].get()) {
+ System.err.println("Deep: " + i + " strong=" + strong[i] +
+ ", weak=" + weak[i].get());
+ }
+ }
+
+ /*
+ * Wipe "strong", do a GC, see if "weak" got collected.
+ */
+ for (int i = 0; i < MAX_DEPTH; i++)
+ strong[i] = null;
+
+ System.gc();
+
+ for (int i = 0; i < MAX_DEPTH; i++) {
+ if (weak[i].get() != null) {
+ System.err.println("Deep: weak still has " + i);
+ }
+ }
+
+ if (Main.DEBUG)
+ System.out.println("Deep: iters=" + iter / MAX_DEPTH);
+ }
+
+ /**
+ * Recursively dive down, setting one or more local variables.
+ *
+ * We pad the stack out with locals, attempting to create a mix of
+ * valid and invalid references on the stack.
+ */
+ private String dive(int depth, int iteration) {
+ String str0;
+ String str1;
+ String str2;
+ String str3;
+ String str4;
+ String str5;
+ String str6;
+ String str7;
+ String funStr;
+
+ funStr = "";
+
+ switch (iteration % 8) {
+ case 0:
+ funStr = str0 = makeString(iteration);
+ break;
+ case 1:
+ funStr = str1 = makeString(iteration);
+ break;
+ case 2:
+ funStr = str2 = makeString(iteration);
+ break;
+ case 3:
+ funStr = str3 = makeString(iteration);
+ break;
+ case 4:
+ funStr = str4 = makeString(iteration);
+ break;
+ case 5:
+ funStr = str5 = makeString(iteration);
+ break;
+ case 6:
+ funStr = str6 = makeString(iteration);
+ break;
+ case 7:
+ funStr = str7 = makeString(iteration);
+ break;
+ }
+
+ strong[depth] = funStr;
+ weak[depth] = new WeakReference(funStr);
+
+ if (depth+1 < MAX_DEPTH)
+ dive(depth+1, iteration+1);
+ else
+ Main.sleep(100);
+
+ return funStr;
+ }
+
+ private String makeString(int val) {
+ return new String("Deep" + val);
+ }
+}
+
+
+/**
+ * Allocates large useless objects.
+ */
+class Large extends Thread {
+ public void run() {
+ byte[] chunk;
+ int count = 0;
+ int sleepCount = 0;
+
+ Main.startupDelay();
+
+ while (!Main.quit) {
+ chunk = new byte[100000];
+ pretendToUse(chunk);
+
+ count++;
+ if ((count % 500) == 0) {
+ Main.sleep(400);
+ sleepCount++;
+ }
+ }
+
+ if (Main.DEBUG)
+ System.out.println("Large: sleepCount=" + sleepCount);
+ }
+
+ public void pretendToUse(byte[] chunk) {}
+}
+
diff --git a/tests/etc/local-run-test-jar b/tests/etc/local-run-test-jar
index 0c802ba..641306d 100755
--- a/tests/etc/local-run-test-jar
+++ b/tests/etc/local-run-test-jar
@@ -26,6 +26,7 @@
VALGRIND="n"
DEV_MODE="n"
QUIET="n"
+PRECISE="y"
while true; do
if [ "x$1" = "x--quiet" ]; then
@@ -57,6 +58,9 @@
elif [ "x$1" = "x--no-optimize" ]; then
OPTIMIZE="n"
shift
+ elif [ "x$1" = "x--no-precise" ]; then
+ PRECISE="n"
+ shift
elif [ "x$1" = "x--" ]; then
shift
break
@@ -101,6 +105,12 @@
valgrind_cmd=""
fi
+if [ "$PRECISE" = "y" ]; then
+ GC_OPTS="-Xgc:precise -Xgenregmap"
+else
+ GC_OPTS="-Xgc:noprecise"
+fi
+
msg "------------------------------"
BASE="$OUT" # from build environment
@@ -109,9 +119,9 @@
export ANDROID_PRINTF_LOG=brief
if [ "$DEV_MODE" = "y" ]; then
- export ANDROID_LOG_TAGS='*:d'
+ export ANDROID_LOG_TAGS='*:d'
else
- export ANDROID_LOG_TAGS='*:s'
+ export ANDROID_LOG_TAGS='*:s'
fi
export ANDROID_DATA="$DATA_DIR"
export ANDROID_ROOT="${BASE}/system"
@@ -134,5 +144,5 @@
fi
$valgrind_cmd $gdb $exe $gdbargs "-Xbootclasspath:${bpath}" \
- $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG "-Xint:${INTERP}" -ea \
+ $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG $GC_OPTS "-Xint:${INTERP}" -ea \
-cp test.jar Main "$@"
diff --git a/tests/etc/push-and-run-test-jar b/tests/etc/push-and-run-test-jar
index e2a1e06..db7addc 100755
--- a/tests/etc/push-and-run-test-jar
+++ b/tests/etc/push-and-run-test-jar
@@ -9,8 +9,10 @@
# --portable -- use the portable interpreter
# --debug -- wait for debugger to attach
# --zygote -- use the zygote (if so, all other options are ignored)
+# --dev -- development mode
# --no-verify -- turn off verification (on by default)
# --no-optimize -- turn off optimization (on by default)
+# --no-precise -- turn off precise GC (on by default)
msg() {
if [ "$QUIET" = "n" ]; then
@@ -24,6 +26,7 @@
OPTIMIZE="y"
ZYGOTE="n"
QUIET="n"
+PRECISE="y"
while true; do
if [ "x$1" = "x--quiet" ]; then
@@ -44,12 +47,18 @@
ZYGOTE="y"
msg "Spawning from zygote"
shift
+ elif [ "x$1" = "x--dev" ]; then
+ # not used; ignore
+ shift
elif [ "x$1" = "x--no-verify" ]; then
VERIFY="n"
shift
elif [ "x$1" = "x--no-optimize" ]; then
OPTIMIZE="n"
shift
+ elif [ "x$1" = "x--no-precise" ]; then
+ PRECISE="n"
+ shift
elif [ "x$1" = "x--" ]; then
shift
break
@@ -102,9 +111,15 @@
DEX_DEBUG="-agentlib:jdwp=transport=dt_android_adb,server=y,suspend=y"
fi
+if [ "$PRECISE" = "y" ]; then
+ GC_OPTS="-Xgc:precise -Xgenregmap"
+else
+ GC_OPTS="-Xgc:noprecise"
+fi
+
if [ "$ZYGOTE" = "y" ]; then
adb shell cd /data \; dvz -classpath test.jar Main "$@"
else
adb shell cd /data \; dalvikvm $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG \
- -cp test.jar "-Xint:${INTERP}" -ea Main "$@"
+ $GC_OPTS -cp test.jar "-Xint:${INTERP}" -ea Main "$@"
fi
diff --git a/tests/etc/reference-run-test-classes b/tests/etc/reference-run-test-classes
index cc2c39d..94c8050 100755
--- a/tests/etc/reference-run-test-classes
+++ b/tests/etc/reference-run-test-classes
@@ -7,6 +7,7 @@
# --quiet -- don't chatter
# --debug -- wait for debugger to attach
# --no-verify -- turn off verification (on by default)
+# --dev -- development mode
msg() {
if [ "$QUIET" = "n" ]; then
@@ -28,6 +29,9 @@
elif [ "x$1" = "x--no-verify" ]; then
VERIFY="n"
shift
+ elif [ "x$1" = "x--dev" ]; then
+ # not used; ignore
+ shift
elif [ "x$1" = "x--" ]; then
shift
break
diff --git a/tests/run-test b/tests/run-test
index b503905..25bfb4e 100755
--- a/tests/run-test
+++ b/tests/run-test
@@ -79,6 +79,9 @@
elif [ "x$1" = "x--no-optimize" ]; then
run_args="${run_args} --no-optimize"
shift
+ elif [ "x$1" = "x--no-precise" ]; then
+ run_args="${run_args} --no-precise"
+ shift
elif [ "x$1" = "x--valgrind" ]; then
run_args="${run_args} --valgrind"
shift
@@ -146,6 +149,7 @@
#echo " --gdb Run under gdb; incompatible with some tests."
echo " --no-verify Turn off verification (on by default)."
echo " --no-optimize Turn off optimization (on by default)."
+ echo " --no-precise Turn off precise GC (on by default)."
echo " --zygote Spawn the process from the Zygote." \
"If used, then the"
echo " other runtime options are ignored."
diff --git a/tools/dexcheck b/tools/dexcheck
new file mode 100755
index 0000000..76662e8
--- /dev/null
+++ b/tools/dexcheck
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# This requires read permission on /data/dalvik-cache. On an eng build this
+# works, on userdebug you will need to "adb root", or "su" followed by
+# "chmod 777 /data/dalvik-cache".
+
+# Get the list of files. Use "sed" to drop the trailing carriage return.
+files=`adb shell "cd /data/dalvik-cache; echo *" | sed -e s/.$//`
+if [ "$files" = "*" ]; then
+ echo 'ERROR: commands must run as root on device (try "adb root" first?)'
+ exit 1
+fi
+
+failure=0
+
+# Check each file in turn. This is much faster with "dexdump -c", but that
+# was added post-cupcake.
+#
+# The dexdump found in older builds does not stop on checksum failures and
+# will likely crash.
+for file in $files; do
+ echo $file
+ errout=`adb shell "dexdump /data/dalvik-cache/$file > dev/null"`
+ errcount=`echo $errout | wc -w` > /dev/null
+ if [ $errcount != "0" ]; then
+ echo " Failure in $file: $errout"
+ failure=1
+ fi
+done
+
+exit $failure
+
diff --git a/tools/dexdeps/Android.mk b/tools/dexdeps/Android.mk
new file mode 100644
index 0000000..9c2cec7
--- /dev/null
+++ b/tools/dexdeps/Android.mk
@@ -0,0 +1,44 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+# We use copy-file-to-new-target so that the installed
+# script files' timestamps are at least as new as the
+# .jar files they wrap.
+
+# the dexdeps script
+# ============================================================
+include $(CLEAR_VARS)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE := dexdeps
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dexdeps$(COMMON_JAVA_PACKAGE_SUFFIX)
+$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/dexdeps | $(ACP)
+ @echo "Copy: $(PRIVATE_MODULE) ($@)"
+ $(copy-file-to-new-target)
+ $(hide) chmod 755 $@
+
+INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
+
+# the other stuff
+# ============================================================
+subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
+ src \
+ ))
+
+include $(subdirs)
diff --git a/tools/dexdeps/README.txt b/tools/dexdeps/README.txt
new file mode 100644
index 0000000..14d65b0
--- /dev/null
+++ b/tools/dexdeps/README.txt
@@ -0,0 +1,28 @@
+dexdeps -- DEX external dependency dump
+
+
+This tool dumps a list of fields and methods that a DEX file uses but does
+not define. When combined with a list of public APIs, it can be used to
+determine whether an APK is accessing fields and calling methods that it
+shouldn't be. It may also be useful in determining whether an application
+requires a certain minimum API level to execute.
+
+Basic usage:
+
+ dexdeps [options] <file.{dex,apk,jar}>
+
+For zip archives (including .jar and .apk), dexdeps will look for a
+"classes.dex" entry.
+
+Supported options are:
+
+ --format={brief,xml}
+
+ Specifies the output format.
+
+ "brief" produces one line of output for each field and method. Field
+ and argument types are shown as descriptor strings.
+
+ "xml" produces a larger output file, readable with an XML browser. Types
+ are shown in a more human-readable form (e.g. "[I" becomes "int[]").
+
diff --git a/tools/dexdeps/etc/dexdeps b/tools/dexdeps/etc/dexdeps
new file mode 100644
index 0000000..dc628bd
--- /dev/null
+++ b/tools/dexdeps/etc/dexdeps
@@ -0,0 +1,69 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/`basename "${prog}"`
+cd "${oldwd}"
+
+jarfile=dexdeps.jar
+libdir="$progdir"
+if [ ! -r "$libdir/$jarfile" ]
+then
+ libdir=`dirname "$progdir"`/tools/lib
+fi
+if [ ! -r "$libdir/$jarfile" ]
+then
+ libdir=`dirname "$progdir"`/framework
+fi
+if [ ! -r "$libdir/$jarfile" ]
+then
+ echo `basename "$prog"`": can't find $jarfile"
+ exit 1
+fi
+
+javaOpts=""
+
+# Alternatively, this will extract any parameter "-Jxxx" from the command line
+# and pass them to Java (instead of to dexdeps).
+while expr "x$1" : 'x-J' >/dev/null; do
+ opt=`expr "$1" : '-J\(.*\)'`
+ javaOpts="${javaOpts} -${opt}"
+ shift
+done
+
+if [ "$OSTYPE" = "cygwin" ] ; then
+ jarpath=`cygpath -w "$libdir/$jarfile"`
+else
+ jarpath="$libdir/$jarfile"
+fi
+
+exec java $javaOpts -jar "$jarpath" "$@"
diff --git a/tools/dexdeps/etc/manifest.txt b/tools/dexdeps/etc/manifest.txt
new file mode 100644
index 0000000..7606744
--- /dev/null
+++ b/tools/dexdeps/etc/manifest.txt
@@ -0,0 +1 @@
+Main-Class: com.android.dexdeps.Main
diff --git a/tools/dexdeps/src/Android.mk b/tools/dexdeps/src/Android.mk
new file mode 100644
index 0000000..756a0b3
--- /dev/null
+++ b/tools/dexdeps/src/Android.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+
+# dexdeps java library
+# ============================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_JAR_MANIFEST := ../etc/manifest.txt
+
+LOCAL_MODULE:= dexdeps
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
+
+include $(BUILD_DROIDDOC)
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/DexData.java b/tools/dexdeps/src/com/android/dexdeps/DexData.java
new file mode 100644
index 0000000..fa79d60
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/DexData.java
@@ -0,0 +1,585 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.Arrays;
+
+/**
+ * Data extracted from a DEX file.
+ */
+public class DexData {
+ private RandomAccessFile mDexFile;
+ private HeaderItem mHeaderItem;
+ private String[] mStrings; // strings from string_data_*
+ private TypeIdItem[] mTypeIds;
+ private ProtoIdItem[] mProtoIds;
+ private FieldIdItem[] mFieldIds;
+ private MethodIdItem[] mMethodIds;
+ private ClassDefItem[] mClassDefs;
+
+ private byte tmpBuf[] = new byte[4];
+ private boolean isBigEndian = false;
+
+ /**
+ * Constructs a new DexData for this file.
+ */
+ public DexData(RandomAccessFile raf) {
+ mDexFile = raf;
+ }
+
+ /**
+ * Loads the contents of the DEX file into our data structures.
+ *
+ * @throws IOException if we encounter a problem while reading
+ * @throws DexDataException if the DEX contents look bad
+ */
+ public void load() throws IOException {
+ parseHeaderItem();
+
+ loadStrings();
+ loadTypeIds();
+ loadProtoIds();
+ loadFieldIds();
+ loadMethodIds();
+ loadClassDefs();
+
+ markInternalClasses();
+ }
+
+
+ /**
+ * Parses the interesting bits out of the header.
+ */
+ void parseHeaderItem() throws IOException {
+ mHeaderItem = new HeaderItem();
+
+ seek(0);
+
+ byte[] magic = new byte[8];
+ readBytes(magic);
+ if (!Arrays.equals(magic, HeaderItem.DEX_FILE_MAGIC)) {
+ System.err.println("Magic number is wrong -- are you sure " +
+ "this is a DEX file?");
+ throw new DexDataException();
+ }
+
+ /*
+ * Read the endian tag, so we properly swap things as we read
+ * them from here on.
+ */
+ seek(8+4+20+4+4);
+ mHeaderItem.endianTag = readInt();
+ if (mHeaderItem.endianTag == HeaderItem.ENDIAN_CONSTANT) {
+ /* do nothing */
+ } else if (mHeaderItem.endianTag == HeaderItem.REVERSE_ENDIAN_CONSTANT){
+ /* file is big-endian (!), reverse future reads */
+ isBigEndian = true;
+ } else {
+ System.err.println("Endian constant has unexpected value " +
+ Integer.toHexString(mHeaderItem.endianTag));
+ throw new DexDataException();
+ }
+
+ seek(8+4+20); // magic, checksum, signature
+ mHeaderItem.fileSize = readInt();
+ mHeaderItem.headerSize = readInt();
+ /*mHeaderItem.endianTag =*/ readInt();
+ /*mHeaderItem.linkSize =*/ readInt();
+ /*mHeaderItem.linkOff =*/ readInt();
+ /*mHeaderItem.mapOff =*/ readInt();
+ mHeaderItem.stringIdsSize = readInt();
+ mHeaderItem.stringIdsOff = readInt();
+ mHeaderItem.typeIdsSize = readInt();
+ mHeaderItem.typeIdsOff = readInt();
+ mHeaderItem.protoIdsSize = readInt();
+ mHeaderItem.protoIdsOff = readInt();
+ mHeaderItem.fieldIdsSize = readInt();
+ mHeaderItem.fieldIdsOff = readInt();
+ mHeaderItem.methodIdsSize = readInt();
+ mHeaderItem.methodIdsOff = readInt();
+ mHeaderItem.classDefsSize = readInt();
+ mHeaderItem.classDefsOff = readInt();
+ /*mHeaderItem.dataSize =*/ readInt();
+ /*mHeaderItem.dataOff =*/ readInt();
+ }
+
+ /**
+ * Loads the string table out of the DEX.
+ *
+ * First we read all of the string_id_items, then we read all of the
+ * string_data_item. Doing it this way should allow us to avoid
+ * seeking around in the file.
+ */
+ void loadStrings() throws IOException {
+ int count = mHeaderItem.stringIdsSize;
+ int stringOffsets[] = new int[count];
+
+ //System.out.println("reading " + count + " strings");
+
+ seek(mHeaderItem.stringIdsOff);
+ for (int i = 0; i < count; i++) {
+ stringOffsets[i] = readInt();
+ }
+
+ mStrings = new String[count];
+
+ seek(stringOffsets[0]);
+ for (int i = 0; i < count; i++) {
+ seek(stringOffsets[i]); // should be a no-op
+ mStrings[i] = readString();
+ //System.out.println("STR: " + i + ": " + mStrings[i]);
+ }
+ }
+
+ /**
+ * Loads the type ID list.
+ */
+ void loadTypeIds() throws IOException {
+ int count = mHeaderItem.typeIdsSize;
+ mTypeIds = new TypeIdItem[count];
+
+ //System.out.println("reading " + count + " typeIds");
+ seek(mHeaderItem.typeIdsOff);
+ for (int i = 0; i < count; i++) {
+ mTypeIds[i] = new TypeIdItem();
+ mTypeIds[i].descriptorIdx = readInt();
+
+ //System.out.println(i + ": " + mTypeIds[i].descriptorIdx +
+ // " " + mStrings[mTypeIds[i].descriptorIdx]);
+ }
+ }
+
+ /**
+ * Loads the proto ID list.
+ */
+ void loadProtoIds() throws IOException {
+ int count = mHeaderItem.protoIdsSize;
+ mProtoIds = new ProtoIdItem[count];
+
+ //System.out.println("reading " + count + " protoIds");
+ seek(mHeaderItem.protoIdsOff);
+
+ /*
+ * Read the proto ID items.
+ */
+ for (int i = 0; i < count; i++) {
+ mProtoIds[i] = new ProtoIdItem();
+ mProtoIds[i].shortyIdx = readInt();
+ mProtoIds[i].returnTypeIdx = readInt();
+ mProtoIds[i].parametersOff = readInt();
+
+ //System.out.println(i + ": " + mProtoIds[i].shortyIdx +
+ // " " + mStrings[mProtoIds[i].shortyIdx]);
+ }
+
+ /*
+ * Go back through and read the type lists.
+ */
+ for (int i = 0; i < count; i++) {
+ ProtoIdItem protoId = mProtoIds[i];
+
+ int offset = protoId.parametersOff;
+
+ if (offset == 0) {
+ protoId.types = new int[0];
+ continue;
+ } else {
+ seek(offset);
+ int size = readInt(); // #of entries in list
+ protoId.types = new int[size];
+
+ for (int j = 0; j < size; j++) {
+ protoId.types[j] = readShort() & 0xffff;
+ }
+ }
+ }
+ }
+
+ /**
+ * Loads the field ID list.
+ */
+ void loadFieldIds() throws IOException {
+ int count = mHeaderItem.fieldIdsSize;
+ mFieldIds = new FieldIdItem[count];
+
+ //System.out.println("reading " + count + " fieldIds");
+ seek(mHeaderItem.fieldIdsOff);
+ for (int i = 0; i < count; i++) {
+ mFieldIds[i] = new FieldIdItem();
+ mFieldIds[i].classIdx = readShort() & 0xffff;
+ mFieldIds[i].typeIdx = readShort() & 0xffff;
+ mFieldIds[i].nameIdx = readInt();
+
+ //System.out.println(i + ": " + mFieldIds[i].nameIdx +
+ // " " + mStrings[mFieldIds[i].nameIdx]);
+ }
+ }
+
+ /**
+ * Loads the method ID list.
+ */
+ void loadMethodIds() throws IOException {
+ int count = mHeaderItem.methodIdsSize;
+ mMethodIds = new MethodIdItem[count];
+
+ //System.out.println("reading " + count + " methodIds");
+ seek(mHeaderItem.methodIdsOff);
+ for (int i = 0; i < count; i++) {
+ mMethodIds[i] = new MethodIdItem();
+ mMethodIds[i].classIdx = readShort() & 0xffff;
+ mMethodIds[i].protoIdx = readShort() & 0xffff;
+ mMethodIds[i].nameIdx = readInt();
+
+ //System.out.println(i + ": " + mMethodIds[i].nameIdx +
+ // " " + mStrings[mMethodIds[i].nameIdx]);
+ }
+ }
+
+ /**
+ * Loads the class defs list.
+ */
+ void loadClassDefs() throws IOException {
+ int count = mHeaderItem.classDefsSize;
+ mClassDefs = new ClassDefItem[count];
+
+ //System.out.println("reading " + count + " classDefs");
+ seek(mHeaderItem.classDefsOff);
+ for (int i = 0; i < count; i++) {
+ mClassDefs[i] = new ClassDefItem();
+ mClassDefs[i].classIdx = readInt();
+
+ /* access_flags = */ readInt();
+ /* superclass_idx = */ readInt();
+ /* interfaces_off = */ readInt();
+ /* source_file_idx = */ readInt();
+ /* annotations_off = */ readInt();
+ /* class_data_off = */ readInt();
+ /* static_values_off = */ readInt();
+
+ //System.out.println(i + ": " + mClassDefs[i].classIdx + " " +
+ // mStrings[mTypeIds[mClassDefs[i].classIdx].descriptorIdx]);
+ }
+ }
+
+ /**
+ * Sets the "internal" flag on type IDs which are defined in the
+ * DEX file or within the VM (e.g. primitive classes and arrays).
+ */
+ void markInternalClasses() {
+ for (int i = mClassDefs.length -1; i >= 0; i--) {
+ mTypeIds[mClassDefs[i].classIdx].internal = true;
+ }
+
+ for (int i = 0; i < mTypeIds.length; i++) {
+ String className = mStrings[mTypeIds[i].descriptorIdx];
+
+ if (className.length() == 1) {
+ // primitive class
+ mTypeIds[i].internal = true;
+ } else if (className.charAt(0) == '[') {
+ mTypeIds[i].internal = true;
+ }
+
+ //System.out.println(i + " " +
+ // (mTypeIds[i].internal ? "INTERNAL" : "external") + " - " +
+ // mStrings[mTypeIds[i].descriptorIdx]);
+ }
+ }
+
+
+ /*
+ * =======================================================================
+ * Queries
+ * =======================================================================
+ */
+
+ /**
+ * Returns the class name, given an index into the type_ids table.
+ */
+ private String classNameFromTypeIndex(int idx) {
+ return mStrings[mTypeIds[idx].descriptorIdx];
+ }
+
+ /**
+ * Returns an array of method argument type strings, given an index
+ * into the proto_ids table.
+ */
+ private String[] argArrayFromProtoIndex(int idx) {
+ ProtoIdItem protoId = mProtoIds[idx];
+ String[] result = new String[protoId.types.length];
+
+ for (int i = 0; i < protoId.types.length; i++) {
+ result[i] = mStrings[mTypeIds[protoId.types[i]].descriptorIdx];
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns a string representing the method's return type, given an
+ * index into the proto_ids table.
+ */
+ private String returnTypeFromProtoIndex(int idx) {
+ ProtoIdItem protoId = mProtoIds[idx];
+ return mStrings[mTypeIds[protoId.returnTypeIdx].descriptorIdx];
+ }
+
+ /**
+ * Returns an array with all of the field references that don't
+ * correspond to classes in the DEX file.
+ */
+ public FieldRef[] getExternalFieldReferences() {
+ // get a count
+ int count = 0;
+ for (int i = 0; i < mFieldIds.length; i++) {
+ if (!mTypeIds[mFieldIds[i].classIdx].internal)
+ count++;
+ }
+
+ //System.out.println("count is " + count + " of " + mFieldIds.length);
+
+ FieldRef[] fieldRefs = new FieldRef[count];
+ count = 0;
+ for (int i = 0; i < mFieldIds.length; i++) {
+ if (!mTypeIds[mFieldIds[i].classIdx].internal) {
+ FieldIdItem fieldId = mFieldIds[i];
+ fieldRefs[count++] =
+ new FieldRef(classNameFromTypeIndex(fieldId.classIdx),
+ classNameFromTypeIndex(fieldId.typeIdx),
+ mStrings[fieldId.nameIdx]);
+ }
+ }
+
+ assert count == fieldRefs.length;
+
+ return fieldRefs;
+ }
+
+ /**
+ * Returns an array with all of the method references that don't
+ * correspond to classes in the DEX file.
+ */
+ public MethodRef[] getExternalMethodReferences() {
+ // get a count
+ int count = 0;
+ for (int i = 0; i < mMethodIds.length; i++) {
+ if (!mTypeIds[mMethodIds[i].classIdx].internal)
+ count++;
+ }
+
+ //System.out.println("count is " + count + " of " + mMethodIds.length);
+
+ MethodRef[] methodRefs = new MethodRef[count];
+ count = 0;
+ for (int i = 0; i < mMethodIds.length; i++) {
+ if (!mTypeIds[mMethodIds[i].classIdx].internal) {
+ MethodIdItem methodId = mMethodIds[i];
+ methodRefs[count++] =
+ new MethodRef(classNameFromTypeIndex(methodId.classIdx),
+ argArrayFromProtoIndex(methodId.protoIdx),
+ returnTypeFromProtoIndex(methodId.protoIdx),
+ mStrings[methodId.nameIdx]);
+ }
+ }
+
+ assert count == methodRefs.length;
+
+ return methodRefs;
+ }
+
+
+ /*
+ * =======================================================================
+ * Basic I/O functions
+ * =======================================================================
+ */
+
+ /**
+ * Seeks the DEX file to the specified absolute position.
+ */
+ void seek(int position) throws IOException {
+ mDexFile.seek(position);
+ }
+
+ /**
+ * Fills the buffer by reading bytes from the DEX file.
+ */
+ void readBytes(byte[] buffer) throws IOException {
+ mDexFile.readFully(buffer);
+ }
+
+ /**
+ * Reads a single signed byte value.
+ */
+ byte readByte() throws IOException {
+ mDexFile.readFully(tmpBuf, 0, 1);
+ return tmpBuf[0];
+ }
+
+ /**
+ * Reads a signed 16-bit integer, byte-swapping if necessary.
+ */
+ short readShort() throws IOException {
+ mDexFile.readFully(tmpBuf, 0, 2);
+ if (isBigEndian) {
+ return (short) ((tmpBuf[1] & 0xff) | ((tmpBuf[0] & 0xff) << 8));
+ } else {
+ return (short) ((tmpBuf[0] & 0xff) | ((tmpBuf[1] & 0xff) << 8));
+ }
+ }
+
+ /**
+ * Reads a signed 32-bit integer, byte-swapping if necessary.
+ */
+ int readInt() throws IOException {
+ mDexFile.readFully(tmpBuf, 0, 4);
+
+ if (isBigEndian) {
+ return (tmpBuf[3] & 0xff) | ((tmpBuf[2] & 0xff) << 8) |
+ ((tmpBuf[1] & 0xff) << 16) | ((tmpBuf[0] & 0xff) << 24);
+ } else {
+ return (tmpBuf[0] & 0xff) | ((tmpBuf[1] & 0xff) << 8) |
+ ((tmpBuf[2] & 0xff) << 16) | ((tmpBuf[3] & 0xff) << 24);
+ }
+ }
+
+ /**
+ * Reads a variable-length unsigned LEB128 value. Does not attempt to
+ * verify that the value is valid.
+ *
+ * @throws EOFException if we run off the end of the file
+ */
+ int readUnsignedLeb128() throws IOException {
+ int result = 0;
+ byte val;
+
+ do {
+ val = readByte();
+ result = (result << 7) | (val & 0x7f);
+ } while (val < 0);
+
+ return result;
+ }
+
+ /**
+ * Reads a UTF-8 string.
+ *
+ * We don't know how long the UTF-8 string is, so we have to read one
+ * byte at a time. We could make an educated guess based on the
+ * utf16_size and seek back if we get it wrong, but seeking backward
+ * may cause the underlying implementation to reload I/O buffers.
+ */
+ String readString() throws IOException {
+ int utf16len = readUnsignedLeb128();
+ byte inBuf[] = new byte[utf16len * 3]; // worst case
+ int idx;
+
+ for (idx = 0; idx < inBuf.length; idx++) {
+ byte val = readByte();
+ if (val == 0)
+ break;
+ inBuf[idx] = val;
+ }
+
+ return new String(inBuf, 0, idx, "UTF-8");
+ }
+
+
+ /*
+ * =======================================================================
+ * Internal "structure" declarations
+ * =======================================================================
+ */
+
+ /**
+ * Holds the contents of a header_item.
+ */
+ static class HeaderItem {
+ public int fileSize;
+ public int headerSize;
+ public int endianTag;
+ public int stringIdsSize, stringIdsOff;
+ public int typeIdsSize, typeIdsOff;
+ public int protoIdsSize, protoIdsOff;
+ public int fieldIdsSize, fieldIdsOff;
+ public int methodIdsSize, methodIdsOff;
+ public int classDefsSize, classDefsOff;
+
+ /* expected magic values */
+ public static final byte[] DEX_FILE_MAGIC = {
+ 0x64, 0x65, 0x78, 0x0a, 0x30, 0x33, 0x35, 0x00 };
+ public static final int ENDIAN_CONSTANT = 0x12345678;
+ public static final int REVERSE_ENDIAN_CONSTANT = 0x78563412;
+ }
+
+ /**
+ * Holds the contents of a type_id_item.
+ *
+ * This is chiefly a list of indices into the string table. We need
+ * some additional bits of data, such as whether or not the type ID
+ * represents a class defined in this DEX, so we use an object for
+ * each instead of a simple integer. (Could use a parallel array, but
+ * since this is a desktop app it's not essential.)
+ */
+ static class TypeIdItem {
+ public int descriptorIdx; // index into string_ids
+
+ public boolean internal; // defined within this DEX file?
+ }
+
+ /**
+ * Holds the contents of a proto_id_item.
+ */
+ static class ProtoIdItem {
+ public int shortyIdx; // index into string_ids
+ public int returnTypeIdx; // index into type_ids
+ public int parametersOff; // file offset to a type_list
+
+ public int types[]; // contents of type list
+ }
+
+ /**
+ * Holds the contents of a field_id_item.
+ */
+ static class FieldIdItem {
+ public int classIdx; // index into type_ids (defining class)
+ public int typeIdx; // index into type_ids (field type)
+ public int nameIdx; // index into string_ids
+ }
+
+ /**
+ * Holds the contents of a method_id_item.
+ */
+ static class MethodIdItem {
+ public int classIdx; // index into type_ids
+ public int protoIdx; // index into proto_ids
+ public int nameIdx; // index into string_ids
+ }
+
+ /**
+ * Holds the contents of a class_def_item.
+ *
+ * We don't really need a class for this, but there's some stuff in
+ * the class_def_item that we might want later.
+ */
+ static class ClassDefItem {
+ public int classIdx; // index into type_ids
+ }
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/DexDataException.java b/tools/dexdeps/src/com/android/dexdeps/DexDataException.java
new file mode 100644
index 0000000..e51853f
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/DexDataException.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+/**
+ * Bad data found inside a DEX file.
+ */
+public class DexDataException extends RuntimeException {
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/FieldRef.java b/tools/dexdeps/src/com/android/dexdeps/FieldRef.java
new file mode 100644
index 0000000..2726a7a
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/FieldRef.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+public class FieldRef {
+ private String mDeclClass, mFieldType, mFieldName;
+
+ /**
+ * Initializes a new field reference.
+ */
+ public FieldRef(String declClass, String fieldType, String fieldName) {
+ mDeclClass = declClass;
+ mFieldType = fieldType;
+ mFieldName = fieldName;
+ }
+
+ /**
+ * Gets the name of the field's declaring class.
+ */
+ public String getDeclClassName() {
+ return mDeclClass;
+ }
+
+ /**
+ * Gets the type name. Examples: "Ljava/lang/String;", "[I".
+ */
+ public String getTypeName() {
+ return mFieldType;
+ }
+
+ /**
+ * Gets the field name.
+ */
+ public String getName() {
+ return mFieldName;
+ }
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/Main.java b/tools/dexdeps/src/com/android/dexdeps/Main.java
new file mode 100644
index 0000000..7eba3aa
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/Main.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+public class Main {
+ private static final String CLASSES_DEX = "classes.dex";
+
+ private String mInputFileName;
+ private String mOutputFormat = "brief";
+
+ /**
+ * Entry point.
+ */
+ public static void main(String[] args) {
+ Main main = new Main();
+ main.run(args);
+ }
+
+ /**
+ * Start things up.
+ */
+ void run(String[] args) {
+ try {
+ parseArgs(args);
+ RandomAccessFile raf = openInputFile();
+ DexData dexData = new DexData(raf);
+ dexData.load();
+
+ Output.generate(dexData, mOutputFormat);
+ } catch (UsageException ue) {
+ usage();
+ System.exit(2);
+ } catch (IOException ioe) {
+ if (ioe.getMessage() != null)
+ System.err.println("Failed: " + ioe);
+ System.exit(1);
+ } catch (DexDataException dde) {
+ /* a message was already reported, just bail quietly */
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Opens the input file, which could be a .dex or a .jar/.apk with a
+ * classes.dex inside. If the latter, we extract the contents to a
+ * temporary file.
+ */
+ RandomAccessFile openInputFile() throws IOException {
+ RandomAccessFile raf;
+
+ raf = openInputFileAsZip();
+ if (raf == null) {
+ File inputFile = new File(mInputFileName);
+ raf = new RandomAccessFile(inputFile, "r");
+ }
+
+ return raf;
+ }
+
+ /**
+ * Tries to open the input file as a Zip archive (jar/apk) with a
+ * "classes.dex" inside.
+ *
+ * @return a RandomAccessFile for classes.dex, or null if the input file
+ * is not a zip archive
+ * @throws IOException if the file isn't found, or it's a zip and
+ * classes.dex isn't found inside
+ */
+ RandomAccessFile openInputFileAsZip() throws IOException {
+ ZipFile zipFile;
+
+ /*
+ * Try it as a zip file.
+ */
+ try {
+ zipFile = new ZipFile(mInputFileName);
+ } catch (FileNotFoundException fnfe) {
+ /* not found, no point in retrying as non-zip */
+ System.err.println("Unable to open '" + mInputFileName + "': " +
+ fnfe.getMessage());
+ throw fnfe;
+ } catch (ZipException ze) {
+ /* not a zip */
+ return null;
+ }
+
+ /*
+ * We know it's a zip; see if there's anything useful inside. A
+ * failure here results in some type of IOException (of which
+ * ZipException is a subclass).
+ */
+ ZipEntry entry = zipFile.getEntry(CLASSES_DEX);
+ if (entry == null) {
+ System.err.println("Unable to find '" + CLASSES_DEX +
+ "' in '" + mInputFileName + "'");
+ zipFile.close();
+ throw new ZipException();
+ }
+
+ InputStream zis = zipFile.getInputStream(entry);
+
+ /*
+ * Create a temp file to hold the DEX data, open it, and delete it
+ * to ensure it doesn't hang around if we fail.
+ */
+ File tempFile = File.createTempFile("dexdeps", ".dex");
+ //System.out.println("+++ using temp " + tempFile);
+ RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
+ tempFile.delete();
+
+ /*
+ * Copy all data from input stream to output file.
+ */
+ byte copyBuf[] = new byte[32768];
+ int actual;
+
+ while (true) {
+ actual = zis.read(copyBuf);
+ if (actual == -1)
+ break;
+
+ raf.write(copyBuf, 0, actual);
+ }
+
+ zis.close();
+ raf.seek(0);
+
+ return raf;
+ }
+
+
+ /**
+ * Parses command-line arguments.
+ *
+ * @throws UsageException if arguments are missing or poorly formed
+ */
+ void parseArgs(String[] args) {
+ int idx;
+
+ for (idx = 0; idx < args.length; idx++) {
+ String arg = args[idx];
+
+ if (arg.equals("--") || !arg.startsWith("--")) {
+ break;
+ } else if (arg.startsWith("--format=")) {
+ mOutputFormat = arg.substring(arg.indexOf('=') + 1);
+ if (!mOutputFormat.equals("brief") &&
+ !mOutputFormat.equals("xml"))
+ {
+ System.err.println("Unknown format '" + mOutputFormat +"'");
+ throw new UsageException();
+ }
+ //System.out.println("+++ using format " + mOutputFormat);
+ } else {
+ System.err.println("Unknown option '" + arg + "'");
+ throw new UsageException();
+ }
+ }
+
+ // expecting one argument left
+ if (idx != args.length - 1) {
+ throw new UsageException();
+ }
+
+ mInputFileName = args[idx];
+ }
+
+ /**
+ * Prints command-line usage info.
+ */
+ void usage() {
+ System.err.println("\nUsage: dexdeps [options] <file.{dex,apk,jar}>");
+ System.err.println("Options:");
+ System.err.println(" --format={brief,xml}");
+ }
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/MethodRef.java b/tools/dexdeps/src/com/android/dexdeps/MethodRef.java
new file mode 100644
index 0000000..96522eb
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/MethodRef.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+public class MethodRef {
+ private String mDeclClass, mReturnType, mMethodName;
+ private String[] mArgTypes;
+
+ /**
+ * Initializes a new field reference.
+ */
+ public MethodRef(String declClass, String[] argTypes, String returnType,
+ String methodName) {
+ mDeclClass = declClass;
+ mArgTypes = argTypes;
+ mReturnType = returnType;
+ mMethodName = methodName;
+ }
+
+ /**
+ * Gets the name of the method's declaring class.
+ */
+ public String getDeclClassName() {
+ return mDeclClass;
+ }
+
+ /**
+ * Gets the method's descriptor.
+ */
+ public String getDescriptor() {
+ return descriptorFromProtoArray(mArgTypes, mReturnType);
+ }
+
+ /**
+ * Gets the method's name.
+ */
+ public String getName() {
+ return mMethodName;
+ }
+
+ /**
+ * Gets an array of method argument types.
+ */
+ public String[] getArgumentTypeNames() {
+ return mArgTypes;
+ }
+
+ /**
+ * Gets the method's return type. Examples: "Ljava/lang/String;", "[I".
+ */
+ public String getReturnTypeName() {
+ return mReturnType;
+ }
+
+ /**
+ * Returns the method descriptor, given the argument and return type
+ * prototype strings.
+ */
+ private static String descriptorFromProtoArray(String[] protos,
+ String returnType) {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("(");
+ for (int i = 0; i < protos.length; i++) {
+ builder.append(protos[i]);
+ }
+
+ builder.append(")");
+ builder.append(returnType);
+
+ return builder.toString();
+ }
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/Output.java b/tools/dexdeps/src/com/android/dexdeps/Output.java
new file mode 100644
index 0000000..0039b33
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/Output.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+/**
+ * Generate fancy output.
+ */
+public class Output {
+ public static void generate(DexData dexData, String format) {
+ if (format.equals("brief")) {
+ printBrief(dexData);
+ } else if (format.equals("xml")) {
+ printXml(dexData);
+ } else {
+ /* should've been trapped in arg handler */
+ throw new RuntimeException("unknown output format");
+ }
+ }
+
+ /**
+ * Prints the data in a simple human-readable format.
+ */
+ static void printBrief(DexData dexData) {
+ FieldRef[] externFieldRefs = dexData.getExternalFieldReferences();
+ MethodRef[] externMethodRefs = dexData.getExternalMethodReferences();
+
+ printFieldRefs(externFieldRefs);
+ printMethodRefs(externMethodRefs);
+ }
+
+ /**
+ * Prints the list of fields in a simple human-readable format.
+ */
+ static void printFieldRefs(FieldRef[] fields) {
+ System.out.println("Fields:");
+ for (int i = 0; i < fields.length; i++) {
+ FieldRef ref = fields[i];
+
+ System.out.println(descriptorToDot(ref.getDeclClassName()) + "." +
+ ref.getName() + " : " + ref.getTypeName());
+ }
+ }
+
+ /**
+ * Prints the list of methods in a simple human-readable format.
+ */
+ static void printMethodRefs(MethodRef[] methods) {
+ System.out.println("Methods:");
+ for (int i = 0; i < methods.length; i++) {
+ MethodRef ref = methods[i];
+
+ System.out.println(descriptorToDot(ref.getDeclClassName()) +
+ "." + ref.getName() + " : " + ref.getDescriptor());
+ }
+ }
+
+
+ /**
+ * Prints the output in XML format.
+ *
+ * We shouldn't need to XML-escape the field/method info.
+ */
+ static void printXml(DexData dexData) {
+ final String IN0 = "";
+ final String IN1 = " ";
+ final String IN2 = " ";
+ final String IN3 = " ";
+ FieldRef[] externFieldRefs = dexData.getExternalFieldReferences();
+ MethodRef[] externMethodRefs = dexData.getExternalMethodReferences();
+ String prevClass = null;
+
+ System.out.println(IN0 + "<external>");
+
+ /* print fields */
+ for (int i = 0; i < externFieldRefs.length; i++) {
+ FieldRef fref = externFieldRefs[i];
+ String declClassName = fref.getDeclClassName();
+
+ if (prevClass != null && !prevClass.equals(declClassName)) {
+ System.out.println(IN1 + "</class>");
+ }
+ if (!declClassName.equals(prevClass)) {
+ String className = classNameOnly(declClassName);
+ String packageName = packageNameOnly(declClassName);
+ System.out.println(IN1 + "<class package=\"" + packageName +
+ "\" name=\"" + className + "\">");
+ prevClass = declClassName;
+ }
+
+ System.out.println(IN2 + "<field name=\"" + fref.getName() +
+ "\" type=\"" + descriptorToDot(fref.getTypeName()) + "\"/>");
+ }
+
+ /* print methods */
+ for (int i = 0; i < externMethodRefs.length; i++) {
+ MethodRef mref = externMethodRefs[i];
+ String declClassName = mref.getDeclClassName();
+ boolean constructor;
+
+ if (prevClass != null && !prevClass.equals(declClassName)) {
+ System.out.println(IN1 + "</class>");
+ }
+ if (!declClassName.equals(prevClass)) {
+ String className = classNameOnly(declClassName);
+ String packageName = packageNameOnly(declClassName);
+ System.out.println(IN1 + "<class package=\"" + packageName +
+ "\" name=\"" + className + "\">");
+ prevClass = declClassName;
+ }
+
+ constructor = mref.getName().equals("<init>");
+ if (constructor) {
+ /* use class name instead of method name */
+ System.out.println(IN2 + "<constructor name=\"" +
+ classNameOnly(declClassName) + "\" return=\"" +
+ descriptorToDot(mref.getReturnTypeName()) + "\">");
+ } else {
+ System.out.println(IN2 + "<method name=\"" + mref.getName() +
+ "\" return=\"" + descriptorToDot(mref.getReturnTypeName()) +
+ "\">");
+ }
+ String[] args = mref.getArgumentTypeNames();
+ for (int j = 0; j < args.length; j++) {
+ System.out.println(IN3 + "<parameter type=\"" +
+ descriptorToDot(args[j]) + "\"/>");
+ }
+ if (constructor) {
+ System.out.println(IN2 + "</constructor>");
+ } else {
+ System.out.println(IN2 + "</method>");
+ }
+ }
+
+ if (prevClass != null)
+ System.out.println(IN1 + "</class>");
+ System.out.println(IN0 + "</external>");
+ }
+
+
+ /*
+ * =======================================================================
+ * Utility functions
+ * =======================================================================
+ */
+
+ /**
+ * Converts a single-character primitive type into its human-readable
+ * equivalent.
+ */
+ static String primitiveTypeLabel(char typeChar) {
+ /* primitive type; substitute human-readable name in */
+ switch (typeChar) {
+ case 'B': return "byte";
+ case 'C': return "char";
+ case 'D': return "double";
+ case 'F': return "float";
+ case 'I': return "int";
+ case 'J': return "long";
+ case 'S': return "short";
+ case 'V': return "void";
+ case 'Z': return "boolean";
+ default:
+ /* huh? */
+ System.err.println("Unexpected class char " + typeChar);
+ assert false;
+ return "UNKNOWN";
+ }
+ }
+
+ /**
+ * Converts a type descriptor to human-readable "dotted" form. For
+ * example, "Ljava/lang/String;" becomes "java.lang.String", and
+ * "[I" becomes "int[].
+ */
+ static String descriptorToDot(String descr) {
+ int targetLen = descr.length();
+ int offset = 0;
+ int arrayDepth = 0;
+
+ /* strip leading [s; will be added to end */
+ while (targetLen > 1 && descr.charAt(offset) == '[') {
+ offset++;
+ targetLen--;
+ }
+ arrayDepth = offset;
+
+ if (targetLen == 1) {
+ descr = primitiveTypeLabel(descr.charAt(offset));
+ offset = 0;
+ targetLen = descr.length();
+ } else {
+ /* account for leading 'L' and trailing ';' */
+ if (targetLen >= 2 && descr.charAt(offset) == 'L' &&
+ descr.charAt(offset+targetLen-1) == ';')
+ {
+ targetLen -= 2; /* two fewer chars to copy */
+ offset++; /* skip the 'L' */
+ }
+ }
+
+ char[] buf = new char[targetLen + arrayDepth * 2];
+
+ /* copy class name over */
+ int i;
+ for (i = 0; i < targetLen; i++) {
+ char ch = descr.charAt(offset + i);
+ buf[i] = (ch == '/') ? '.' : ch;
+ }
+
+ /* add the appopriate number of brackets for arrays */
+ while (arrayDepth-- > 0) {
+ buf[i++] = '[';
+ buf[i++] = ']';
+ }
+ assert i == buf.length;
+
+ return new String(buf);
+ }
+
+ /**
+ * Extracts the class name from a type descriptor.
+ */
+ static String classNameOnly(String typeName) {
+ String dotted = descriptorToDot(typeName);
+
+ int start = dotted.lastIndexOf(".");
+ if (start < 0) {
+ return dotted;
+ } else {
+ return dotted.substring(start+1);
+ }
+ }
+
+ /**
+ * Extracts the package name from a type descriptor, and returns it in
+ * dotted form.
+ */
+ static String packageNameOnly(String typeName) {
+ String dotted = descriptorToDot(typeName);
+
+ int end = dotted.lastIndexOf(".");
+ if (end < 0) {
+ /* lives in default package */
+ return "";
+ } else {
+ return dotted.substring(0, end);
+ }
+ }
+}
+
diff --git a/tools/dexdeps/src/com/android/dexdeps/UsageException.java b/tools/dexdeps/src/com/android/dexdeps/UsageException.java
new file mode 100644
index 0000000..f9f971b
--- /dev/null
+++ b/tools/dexdeps/src/com/android/dexdeps/UsageException.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dexdeps;
+
+/**
+ * Tells the main entry point to show the usage information and bail.
+ */
+public class UsageException extends RuntimeException {
+}
+
diff --git a/tools/gclog.py b/tools/gclog.py
new file mode 100755
index 0000000..4696965
--- /dev/null
+++ b/tools/gclog.py
@@ -0,0 +1,204 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Version 1.0, 29-Apr-2009
+#
+# Parse event log output, looking for GC events. Format them for human
+# consumption.
+#
+# ALL OUTPUT VALUES ARE APPROXIMATE. The event log data format uses a
+# 12-bit floating-point representation, which means there aren't enough
+# bits to accurately represent anything but small integers. Larger
+# values will be rounded off.
+#
+# The data is generated by dalvik/vm/alloc/HeapDebug.c.
+#
+
+import os
+import re
+import time
+
+def unfloat12(f12):
+ """Unpack a float12 value"""
+ if f12 < 0:
+ raise DataParseError, "bad float12 value %s" % f12
+ return (f12 & 0x1ff) << ((f12 >> 9) * 4)
+
+
+def parseGlobalInfo(value):
+ """Parse event0 (global info)"""
+ value = int(value)
+
+ # Global information:
+ #
+ # [63 ] Must be zero
+ # [62-24] ASCII process identifier
+ # [23-12] GC time in ms
+ # [11- 0] Bytes freed
+ id = (value >> 24) & 0xffffffffff
+ gctime = unfloat12((value >> 12) & 0xfff)
+ bytes_freed = unfloat12(value & 0xfff)
+
+ idstr = "%c%c%c%c%c" % ( \
+ (id >> 32) & 0xff, \
+ (id >> 24) & 0xff, \
+ (id >> 16) & 0xff, \
+ (id >> 8) & 0xff, \
+ id & 0xff )
+
+ return ( idstr, gctime, bytes_freed )
+
+
+def parseAggHeapStats(value):
+ """Parse event1 (aggregated heap stats)"""
+ value = int(value)
+
+ # Aggregated heap stats:
+ #
+ # [63-62] 10
+ # [61-60] Reserved; must be zero
+ # [59-48] Objects freed
+ # [47-36] Actual size (current footprint)
+ # [35-24] Allowed size (current hard max)
+ # [23-12] Objects allocated
+ # [11- 0] Bytes allocated
+ freed = unfloat12((value >> 48) & 0xfff)
+ footprint = unfloat12((value >> 36) & 0xfff)
+ allowed = unfloat12((value >> 24) & 0xfff)
+ objs = unfloat12((value >> 12) & 0xfff)
+ bytes = unfloat12(value & 0xfff)
+
+ return ( freed, footprint, allowed, objs, bytes )
+
+
+def parseZygoteStats(value):
+ """Parse event2 (zygote heap stats)"""
+ value = int(value)
+
+ # Zygote heap stats (except for the soft limit, which belongs to the
+ # active heap):
+ #
+ # [63-62] 11
+ # [61-60] Reserved; must be zero
+ # [59-48] Soft Limit (for the active heap)
+ # [47-36] Actual size (current footprint)
+ # [35-24] Allowed size (current hard max)
+ # [23-12] Objects allocated
+ # [11- 0] Bytes allocated
+ soft_limit = unfloat12((value >> 48) & 0xfff)
+ actual = unfloat12((value >> 36) & 0xfff)
+ allowed = unfloat12((value >> 24) & 0xfff)
+ objs = unfloat12((value >> 12) & 0xfff)
+ bytes = unfloat12(value & 0xfff)
+
+ return ( soft_limit, actual, allowed, objs, bytes )
+
+
+def parseExternalStats(value):
+ """Parse event3 (external allocation stats)"""
+ value = int(value)
+
+ # Report the current external allocation stats and the native heap
+ # summary.
+ #
+ # [63-48] Reserved; must be zero (TODO: put new data in these slots)
+ # [47-36] dlmalloc_footprint
+ # [35-24] mallinfo: total allocated space
+ # [23-12] External byte limit
+ # [11- 0] External bytes allocated
+ footprint = unfloat12((value >> 36) & 0xfff) # currently disabled
+ total = unfloat12((value >> 24) & 0xfff) # currently disabled
+ limit = unfloat12((value >> 12) & 0xfff)
+ bytes = unfloat12(value & 0xfff)
+
+ return ( footprint, total, limit, bytes )
+
+
+def handleGcInfo(timestamp, pid, values):
+ """Handle a single dvm_gc_info event"""
+
+ pid = int(pid)
+
+ global_info = parseGlobalInfo(values[0])
+ heap_stats = parseAggHeapStats(values[1])
+ zygote = parseZygoteStats(values[2])
+ external = parseExternalStats(values[3])
+
+ debug = False
+ if debug:
+ print "RAW: %s %s (%s,%s,%s,%s)" % \
+ (timestamp, pid, values[0], values[1], values[2], values[3])
+
+ print "> id=\"%s\" time=%d freed=%d" % (global_info[0], global_info[1], global_info[2])
+ print "> freed=%d foot=%d allow=%d objs=%d bytes=%d" % \
+ (heap_stats[0], heap_stats[1], heap_stats[2], heap_stats[3], heap_stats[4])
+ print "> soft=%d act=%d allow=%d objs=%d bytes=%d" % \
+ (zygote[0], zygote[1], zygote[2], zygote[3], zygote[4])
+ print "> foot=%d total=%d limit=%d alloc=%d" % \
+ (external[0], external[1], external[2], external[3])
+
+ print "%s %s(%d) softlim=%dKB, extlim=%dKB, extalloc=%dKB" % \
+ (timestamp, global_info[0], pid, zygote[0]/1024, external[2]/1024, external[3]/1024)
+ print " freed %d objects / %d bytes in %dms" % \
+ (heap_stats[0], global_info[2], global_info[1])
+
+
+def filterInput(logPipe):
+ """Loop until EOF, pulling out GC events"""
+
+ # 04-29 20:31:00.334 I/dvm_gc_info( 69): [8320808730292729543,-8916699241518090181,-4006371297196337158,8165229]
+ gc_info_re = re.compile(r"""
+ (\d+-\d+\ \d+:\d+:\d+)\.\d+ # extract the date (#1), ignoring ms
+ .* # filler, usually " I/"
+ dvm_gc_info # only interested in GC info lines
+ \(\s*(\d+)\) # extract the pid (#2)
+ :\ \[ # filler
+ ([0-9-]+),([0-9-]+),([0-9-]+),([0-9-]+) # four values, may be negative
+ \].* # junk to end of line
+ """, re.VERBOSE)
+
+ while True:
+ line = logPipe.readline()
+ if not line:
+ print "EOF hit"
+ return
+
+ match = gc_info_re.match(line)
+ if not match:
+ #print "no match on %s" % line.strip()
+ continue
+ else:
+ handleGcInfo(match.group(1), match.group(2), ( match.group(3), \
+ match.group(4), match.group(5), match.group(6) ) )
+
+def start():
+ """Entry point"""
+
+ # launch a logcat and read from it
+ command = 'adb logcat -v time -b events'
+ logPipe = os.popen(command)
+
+ try:
+ filterInput(logPipe)
+ except KeyboardInterrupt, err:
+ print "Stopping on keyboard interrupt."
+
+ logPipe.close()
+
+
+start()
+
diff --git a/vm/Android.mk b/vm/Android.mk
index f3eed3f..2ef1ec9 100644
--- a/vm/Android.mk
+++ b/vm/Android.mk
@@ -59,9 +59,11 @@
# - LOGV
# - assert() (NDEBUG is handled in the build system)
#
- LOCAL_CFLAGS += -DWITH_INSTR_CHECKS -DWITH_EXTRA_OBJECT_VALIDATION
+ LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
+ LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
+ LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
#LOCAL_CFLAGS += -DCHECK_MUTEX
#LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
@@ -77,6 +79,8 @@
#LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
# "-O2" is redundant for device (release) but useful for sim (debug)
#LOCAL_CFLAGS += -O2 -Winline
+ #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
+ LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
# if you want to try with assertions on the device, add:
#LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
@@ -177,6 +181,7 @@
reflect/Annotation.c \
reflect/Proxy.c \
reflect/Reflect.c \
+ test/AtomicSpeed.c \
test/TestHash.c
WITH_HPROF := $(strip $(WITH_HPROF))
@@ -231,10 +236,23 @@
arch/arm/CallOldABI.S \
arch/arm/CallEABI.S \
arch/arm/HintsEABI.c
- # TODO: select sources for ARMv4 vs. ARMv5TE
- LOCAL_SRC_FILES += \
- mterp/out/InterpC-armv5te.c.arm \
- mterp/out/InterpAsm-armv5te.S
+ #
+ # The armv4 configation in mterp is actually armv4t, it's just
+ # wrongly named
+ #
+ # TODO: Rename mterp/config-armv4 and mterp/armv4 (to armv4t)
+ # then remove this ifeq.
+ #
+ ifeq ($(TARGET_ARCH_VERSION),armv4t)
+ LOCAL_SRC_FILES += \
+ mterp/out/InterpC-armv4.c.arm \
+ mterp/out/InterpAsm-armv4.S
+ else
+ # Select architecture specific sources (armv4,armv5te etc)
+ LOCAL_SRC_FILES += \
+ mterp/out/InterpC-$(TARGET_ARCH_VERSION).c.arm \
+ mterp/out/InterpAsm-$(TARGET_ARCH_VERSION).S
+ endif
LOCAL_SHARED_LIBRARIES += libdl
else
ifeq ($(TARGET_ARCH),x86)
diff --git a/vm/Dalvik.h b/vm/Dalvik.h
index 2c7bd7c..29abc2c 100644
--- a/vm/Dalvik.h
+++ b/vm/Dalvik.h
@@ -67,6 +67,7 @@
#include "LinearAlloc.h"
#include "analysis/DexVerify.h"
#include "analysis/DexOptimize.h"
+#include "analysis/RegisterMap.h"
#include "Init.h"
#include "libdex/OpCode.h"
#include "libdex/InstrUtils.h"
diff --git a/vm/Debugger.c b/vm/Debugger.c
index c667893..3affa97 100644
--- a/vm/Debugger.c
+++ b/vm/Debugger.c
@@ -2697,10 +2697,10 @@
dvmUnlockThreadList();
/*
- * We change our thread status (which should be THREAD_RUNNING) so the
- * VM can suspend for a GC if the invoke request causes us to run out
- * of memory. It's also a good idea to change it before locking the
- * invokeReq mutex, although that should never be held for long.
+ * We change our (JDWP thread) status, which should be THREAD_RUNNING,
+ * so the VM can suspend for a GC if the invoke request causes us to
+ * run out of memory. It's also a good idea to change it before locking
+ * the invokeReq mutex, although that should never be held for long.
*/
Thread* self = dvmThreadSelf();
int oldStatus = dvmChangeStatus(self, THREAD_VMWAIT);
@@ -2774,18 +2774,25 @@
/*
* Execute the method described by "*pReq".
+ *
+ * We're currently in VMWAIT, because we're stopped on a breakpoint. We
+ * want to switch to RUNNING while we execute.
*/
void dvmDbgExecuteMethod(DebugInvokeReq* pReq)
{
Thread* self = dvmThreadSelf();
const Method* meth;
Object* oldExcept;
+ int oldStatus;
/*
* We can be called while an exception is pending in the VM. We need
* to preserve that across the method invocation.
*/
oldExcept = dvmGetException(self);
+ dvmClearException(self);
+
+ oldStatus = dvmChangeStatus(self, THREAD_RUNNING);
/*
* Translate the method through the vtable, unless we're calling a
@@ -2832,6 +2839,7 @@
if (oldExcept != NULL)
dvmSetException(self, oldExcept);
+ dvmChangeStatus(self, oldStatus);
}
// for dvmAddressSetForLine
diff --git a/vm/DvmDex.c b/vm/DvmDex.c
index b5f8d02..6740632 100644
--- a/vm/DvmDex.c
+++ b/vm/DvmDex.c
@@ -171,8 +171,10 @@
int parseFlags = kDexParseDefault;
int result = -1;
+ /* -- file is incomplete, new checksum has not yet been calculated
if (gDvm.verifyDexChecksum)
parseFlags |= kDexParseVerifyChecksum;
+ */
pDexFile = dexFileParse(addr, len, parseFlags);
if (pDexFile == NULL) {
diff --git a/vm/Globals.h b/vm/Globals.h
index 79b9e91..1a81b93 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -99,6 +99,7 @@
DexOptimizerMode dexOptMode;
DexClassVerifyMode classVerifyMode;
+ bool preciseGc;
bool generateRegisterMaps;
int assertionCtrlCount;
@@ -604,6 +605,9 @@
#ifdef COUNT_PRECISE_METHODS
PointerSet* preciseMethods;
#endif
+
+ /* some RegisterMap statistics, useful during development */
+ void* registerMapStats;
};
extern struct DvmGlobals gDvm;
diff --git a/vm/Init.c b/vm/Init.c
index 176910c..4ba10b7 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -95,6 +95,7 @@
dvmFprintf(stderr, " -Xjniopts:{warnonly,forcecopy}\n");
dvmFprintf(stderr, " -Xdeadlockpredict:{off,warn,err,abort}\n");
dvmFprintf(stderr, " -Xstacktracefile:<filename>\n");
+ dvmFprintf(stderr, " -Xgc:[no]precise\n");
dvmFprintf(stderr, " -Xgenregmap\n");
dvmFprintf(stderr, " -Xcheckdexsum\n");
dvmFprintf(stderr, "\n");
@@ -132,6 +133,9 @@
#ifdef WITH_EXTRA_OBJECT_VALIDATION
" extra_object_validation"
#endif
+#ifdef WITH_EXTRA_GC_CHECKS
+ " extra_gc_checks"
+#endif
#ifdef WITH_DALVIK_ASSERT
" dalvik_assert"
#endif
@@ -788,6 +792,18 @@
} else if (strcmp(argv[i], "-Xgenregmap") == 0) {
gDvm.generateRegisterMaps = true;
+ LOGD("Register maps will be generated during verification\n");
+
+ } else if (strncmp(argv[i], "-Xgc:", 5) == 0) {
+ if (strcmp(argv[i] + 5, "precise") == 0)
+ gDvm.preciseGc = true;
+ else if (strcmp(argv[i] + 5, "noprecise") == 0)
+ gDvm.preciseGc = false;
+ else {
+ dvmFprintf(stderr, "Bad value for -Xgc");
+ return -1;
+ }
+ LOGD("Precise GC configured %s\n", gDvm.preciseGc ? "ON" : "OFF");
} else if (strcmp(argv[i], "-Xcheckdexsum") == 0) {
gDvm.verifyDexChecksum = true;
@@ -810,6 +826,8 @@
/*
* Set defaults for fields altered or modified by arguments.
+ *
+ * Globals are initialized to 0 (a/k/a NULL or false).
*/
static void setCommandLineDefaults()
{
@@ -936,6 +954,14 @@
goto fail;
}
+#if WITH_EXTRA_GC_CHECKS > 1
+ /* only "portable" interp has the extra goodies */
+ if (gDvm.executionMode != kExecutionModeInterpPortable) {
+ LOGI("Switching to 'portable' interpreter for GC checks\n");
+ gDvm.executionMode = kExecutionModeInterpPortable;
+ }
+#endif
+
/* configure signal handling */
if (!gDvm.reduceSignals)
blockSignals();
@@ -957,6 +983,8 @@
goto fail;
if (!dvmVerificationStartup())
goto fail;
+ if (!dvmRegisterMapStartup())
+ goto fail;
if (!dvmInstanceofStartup())
goto fail;
if (!dvmClassStartup())
@@ -1290,6 +1318,8 @@
goto fail;
if (!dvmVerificationStartup())
goto fail;
+ if (!dvmRegisterMapStartup())
+ goto fail;
if (!dvmInstanceofStartup())
goto fail;
if (!dvmClassStartup())
@@ -1370,6 +1400,7 @@
dvmThreadShutdown();
dvmClassShutdown();
dvmVerificationShutdown();
+ dvmRegisterMapShutdown();
dvmInstanceofShutdown();
dvmInlineNativeShutdown();
dvmGcShutdown();
diff --git a/vm/Init.h b/vm/Init.h
index 8549338..63051a2 100644
--- a/vm/Init.h
+++ b/vm/Init.h
@@ -41,9 +41,14 @@
DexClassVerifyMode verifyMode, int dexoptFlags);
/*
- * Unconditionally abort the entire VM. Try not to use this.
+ * Replacement for fprintf() when we want to send a message to the console.
+ * This defaults to fprintf(), but will use the JNI fprintf callback if
+ * one was provided.
*/
-int dvmFprintf(FILE* fp, const char* format, ...);
-void dvmAbort(void);
+int dvmFprintf(FILE* fp, const char* format, ...)
+#if defined(__GNUC__)
+ __attribute__ ((format(printf, 2, 3)))
+#endif
+ ;
#endif /*_DALVIK_INIT*/
diff --git a/vm/Inlines.c b/vm/Inlines.c
index 57405e3..e314448 100644
--- a/vm/Inlines.c
+++ b/vm/Inlines.c
@@ -21,6 +21,7 @@
#define _DALVIK_GEN_INLINES
#include "Dalvik.h"
#include "analysis/CodeVerify.h"
+#include "analysis/RegisterMap.h"
#include "mterp/c/header.c"
#undef LOG_TAG
diff --git a/vm/Jni.c b/vm/Jni.c
index f7a21ff..cb1821f 100644
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -2653,7 +2653,7 @@
{
JNI_ENTER();
jobjectRefType type;
-
+
if (obj == NULL)
type = JNIInvalidRefType;
else
@@ -2677,45 +2677,55 @@
static jobject NewDirectByteBuffer(JNIEnv * env, void* address, jlong capacity)
{
jmethodID newBufferMethod;
- jclass directBufferClass;
- jclass platformaddressClass;
- jobject platformaddress;
+ jclass directBufferClass = NULL;
+ jclass platformaddressClass = NULL;
+ jobject platformaddress = NULL;
jmethodID onMethod;
+ jobject result = NULL;
directBufferClass = (*env)->FindClass(env,
"java/nio/ReadWriteDirectByteBuffer");
if(!directBufferClass)
{
- return NULL;
+ goto bail;
}
newBufferMethod = (*env)->GetMethodID(env, directBufferClass, "<init>",
"(Lorg/apache/harmony/luni/platform/PlatformAddress;II)V");
if(!newBufferMethod)
{
- return NULL;
+ goto bail;
}
platformaddressClass = (*env)->FindClass(env,
"org/apache/harmony/luni/platform/PlatformAddressFactory");
if(!platformaddressClass)
{
- return NULL;
+ goto bail;
}
onMethod = (*env)->GetStaticMethodID(env, platformaddressClass, "on",
"(I)Lorg/apache/harmony/luni/platform/PlatformAddress;");
if(!onMethod)
{
- return NULL;
+ goto bail;
}
- platformaddress = (*env)->CallStaticObjectMethod(env, platformaddressClass,
+ platformaddress = (*env)->CallStaticObjectMethod(env, platformaddressClass,
onMethod, (jint)address);
- return (*env)->NewObject(env, directBufferClass, newBufferMethod,
+ result = (*env)->NewObject(env, directBufferClass, newBufferMethod,
platformaddress, (jint)capacity, (jint)0);
+
+bail:
+ if (directBufferClass != NULL)
+ (*env)->DeleteLocalRef(env, directBufferClass);
+ if (platformaddressClass != NULL)
+ (*env)->DeleteLocalRef(env, platformaddressClass);
+ if (platformaddress != NULL)
+ (*env)->DeleteLocalRef(env, platformaddress);
+ return result;
}
/*
@@ -2730,43 +2740,53 @@
static void* GetDirectBufferAddress(JNIEnv * env, jobject buf)
{
jmethodID tempMethod;
- jclass tempClass;
- jobject platformAddr;
- jclass platformAddrClass;
+ jclass tempClass = NULL;
+ jobject platformAddr = NULL;
+ jclass platformAddrClass = NULL;
jmethodID toLongMethod;
+ void* result = NULL;
tempClass = (*env)->FindClass(env,
"org/apache/harmony/nio/internal/DirectBuffer");
if(!tempClass)
{
- return 0;
+ goto bail;
}
if(JNI_FALSE == (*env)->IsInstanceOf(env, buf, tempClass))
{
- return 0;
+ goto bail;
}
tempMethod = (*env)->GetMethodID(env, tempClass, "getBaseAddress",
- "()Lorg/apache/harmony/luni/platform/PlatformAddress;");
+ "()Lorg/apache/harmony/luni/platform/PlatformAddress;");
if(!tempMethod){
- return 0;
- }
+ goto bail;
+ }
platformAddr = (*env)->CallObjectMethod(env, buf, tempMethod);
platformAddrClass = (*env)->FindClass (env,
"org/apache/harmony/luni/platform/PlatformAddress");
if(!platformAddrClass)
{
- return 0;
+ goto bail;
}
toLongMethod = (*env)->GetMethodID(env, platformAddrClass, "toLong", "()J");
if (!toLongMethod)
{
- return 0;
+ goto bail;
}
- return (void*)(u4)(*env)->CallLongMethod(env, platformAddr, toLongMethod);
+ result = (void*)(u4)(*env)->CallLongMethod(env, platformAddr, toLongMethod);
+
+bail:
+ if (tempClass != NULL)
+ (*env)->DeleteLocalRef(env, tempClass);
+ if (platformAddr != NULL)
+ (*env)->DeleteLocalRef(env, platformAddr);
+ if (platformAddrClass != NULL)
+ (*env)->DeleteLocalRef(env, platformAddrClass);
+ return result;
}
/*
@@ -2781,34 +2801,42 @@
static jlong GetDirectBufferCapacity(JNIEnv * env, jobject buf)
{
jfieldID fieldCapacity;
- jclass directBufferClass;
- jclass bufferClass;
+ jclass directBufferClass = NULL;
+ jclass bufferClass = NULL;
+ jlong result = -1;
directBufferClass = (*env)->FindClass(env,
"org/apache/harmony/nio/internal/DirectBuffer");
if (!directBufferClass)
{
- return -1;
+ goto bail;
}
if (JNI_FALSE == (*env)->IsInstanceOf(env, buf, directBufferClass))
{
- return -1;
+ goto bail;
}
bufferClass = (*env)->FindClass(env, "java/nio/Buffer");
if (!bufferClass)
{
- return -1;
+ goto bail;
}
fieldCapacity = (*env)->GetFieldID(env, bufferClass, "capacity", "I");
if (!fieldCapacity)
{
- return -1;
+ goto bail;
}
- return (*env)->GetIntField(env, buf, fieldCapacity);
+ result = (*env)->GetIntField(env, buf, fieldCapacity);
+
+bail:
+ if (directBufferClass != NULL)
+ (*env)->DeleteLocalRef(env, directBufferClass);
+ if (bufferClass != NULL)
+ (*env)->DeleteLocalRef(env, bufferClass);
+ return result;
}
diff --git a/vm/Misc.h b/vm/Misc.h
index 5f3af7b..bd6fece 100644
--- a/vm/Misc.h
+++ b/vm/Misc.h
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* Miscellaneous utility functions.
*/
@@ -143,7 +144,11 @@
* Print a debug message.
*/
void dvmPrintDebugMessage(const DebugOutputTarget* target, const char* format,
- ...);
+ ...)
+#if defined(__GNUC__)
+ __attribute__ ((format(printf, 2, 3)))
+#endif
+ ;
/*
@@ -277,6 +282,15 @@
*/
bool dvmSetCloseOnExec(int fd);
+/*
+ * Unconditionally abort the entire VM. Try not to use this.
+ */
+void dvmAbort(void)
+#if defined(__GNUC__)
+ __attribute__ ((noreturn))
+#endif
+ ;
+
#if (!HAVE_STRLCPY)
/* Implementation of strlcpy() for platforms that don't already have it. */
size_t strlcpy(char *dst, const char *src, size_t size);
diff --git a/vm/Native.c b/vm/Native.c
index 7a153d6..4fb9795 100644
--- a/vm/Native.c
+++ b/vm/Native.c
@@ -411,19 +411,25 @@
* doesn't have to search through LD_LIBRARY_PATH. (It may do so to
* resolve this library's dependencies though.)
*
- * Failures here are expected when java.library.path has several entries.
+ * Failures here are expected when java.library.path has several entries
+ * and we have to hunt for the lib.
*
* The current android-arm dynamic linker implementation tends to
* return "Cannot find library" from dlerror() regardless of the actual
- * problem. A more useful diagnostic may be sent to stdout/stderr,
- * but often that's not visible. Some things to try:
+ * problem. A more useful diagnostic may be sent to stdout/stderr if
+ * linker diagnostics are enabled, but that's not usually visible in
+ * Android apps. Some things to try:
* - make sure the library exists on the device
* - verify that the right path is being opened (the debug log message
* above can help with that)
- * - check to see if the library is valid
+ * - check to see if the library is valid (e.g. not zero bytes long)
* - check config/prelink-linux-arm.map to ensure that the library
* is listed and is not being overrun by the previous entry (if
- * loading suddenly stops working, this is a good one to check)
+ * loading suddenly stops working on a prelinked library, this is
+ * a good one to check)
+ * - write a trivial app that calls sleep() then dlopen(), attach
+ * to it with "strace -p <pid>" while it sleeps, and watch for
+ * attempts to open nonexistent dependent shared libs
*/
handle = dlopen(pathName, RTLD_LAZY);
if (handle == NULL) {
diff --git a/vm/Properties.c b/vm/Properties.c
index a9fe5e1..7758660 100644
--- a/vm/Properties.c
+++ b/vm/Properties.c
@@ -186,9 +186,11 @@
setProperty(propObj, put, "java.specification.version", "0.9");
#define OS_ARCH generic /* TODO: Use an "arch" header. */
- #define OS_ARCH_QUOTE(x) #x
+ #define OS_ARCH_QUOTE1(x) #x
+ #define OS_ARCH_QUOTE(x) OS_ARCH_QUOTE1(x)
setProperty(propObj, put, "os.arch", OS_ARCH_QUOTE(OS_ARCH));
#undef OS_ARCH
+ #undef OS_ARCH_QUOTE1
#undef OS_ARCH_QUOTE
setProperty(propObj, put, "os.name", info.sysname);
diff --git a/vm/Thread.c b/vm/Thread.c
index 680755c..5b53664 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* Thread support.
*/
@@ -481,6 +482,20 @@
assert(cc == 0);
}
+/*
+ * Convert SuspendCause to a string.
+ */
+static const char* getSuspendCauseStr(SuspendCause why)
+{
+ switch (why) {
+ case SUSPEND_NOT: return "NOT?";
+ case SUSPEND_FOR_GC: return "gc";
+ case SUSPEND_FOR_DEBUG: return "debug";
+ case SUSPEND_FOR_DEBUG_EVENT: return "debug-event";
+ case SUSPEND_FOR_STACK_DUMP: return "stack-dump";
+ default: return "UNKNOWN";
+ }
+}
/*
* Grab the "thread suspend" lock. This is required to prevent the
@@ -492,7 +507,6 @@
*/
static void lockThreadSuspend(const char* who, SuspendCause why)
{
- const int kMaxRetries = 10;
const int kSpinSleepTime = 3*1000*1000; /* 3s */
u8 startWhen = 0; // init req'd to placate gcc
int sleepIter = 0;
@@ -503,23 +517,30 @@
if (cc != 0) {
if (!dvmCheckSuspendPending(NULL)) {
/*
- * Could be unusual JNI-attach thing, could be we hit
- * the window as the suspend or resume was started. Could
- * also be the debugger telling us to resume at roughly
+ * Could be we hit the window as the suspend or resume
+ * was started (i.e. the lock has been grabbed but the
+ * other thread hasn't yet set our "please suspend" flag).
+ *
+ * Could be an unusual JNI thread-attach thing.
+ *
+ * Could be the debugger telling us to resume at roughly
* the same time we're posting an event.
*/
- LOGI("threadid=%d ODD: thread-suspend lock held (%s:%d)"
- " but suspend not pending\n",
- dvmThreadSelf()->threadId, who, why);
+ LOGI("threadid=%d ODD: want thread-suspend lock (%s:%s),"
+ " it's held, no suspend pending\n",
+ dvmThreadSelf()->threadId, who, getSuspendCauseStr(why));
+ } else {
+ /* we suspended; reset timeout */
+ sleepIter = 0;
}
/* give the lock-holder a chance to do some work */
if (sleepIter == 0)
startWhen = dvmGetRelativeTimeUsec();
if (!dvmIterativeSleep(sleepIter++, kSpinSleepTime, startWhen)) {
- LOGE("threadid=%d: couldn't get thread-suspend lock (%s:%d),"
+ LOGE("threadid=%d: couldn't get thread-suspend lock (%s:%s),"
" bailing\n",
- dvmThreadSelf()->threadId, who, why);
+ dvmThreadSelf()->threadId, who, getSuspendCauseStr(why));
dvmDumpAllThreads(false);
dvmAbort();
}
@@ -948,6 +969,12 @@
* This is mainly of use to ensure that we don't leak resources if, for
* example, a thread attaches itself to us with AttachCurrentThread and
* then exits without notifying the VM.
+ *
+ * We could do the detach here instead of aborting, but this will lead to
+ * portability problems. Other implementations do not do this check and
+ * will simply be unaware that the thread has exited, leading to resource
+ * leaks (and, if this is a non-daemon thread, an infinite hang when the
+ * VM tries to shut down).
*/
static void threadExitCheck(void* arg)
{
@@ -957,7 +984,6 @@
assert(thread != NULL);
if (thread->status != THREAD_ZOMBIE) {
- /* TODO: instead of failing, we could call dvmDetachCurrentThread() */
LOGE("Native thread exited without telling us\n");
dvmAbort();
}
@@ -2182,8 +2208,15 @@
&gDvm.threadSuspendCountLock);
assert(cc == 0);
if (self->suspendCount != 0) {
- LOGD("threadid=%d: still suspended after undo (s=%d d=%d)\n",
- self->threadId, self->suspendCount, self->dbgSuspendCount);
+ /*
+ * The condition was signaled but we're still suspended. This
+ * can happen if the debugger lets go while a SIGQUIT thread
+ * dump event is pending (assuming SignalCatcher was resumed for
+ * just long enough to try to grab the thread-suspend lock).
+ */
+ LOGD("threadid=%d: still suspended after undo (sc=%d dc=%d s=%c)\n",
+ self->threadId, self->suspendCount, self->dbgSuspendCount,
+ self->isSuspended ? 'Y' : 'N');
}
}
assert(self->suspendCount == 0 && self->dbgSuspendCount == 0);
@@ -2942,9 +2975,9 @@
threadName, isDaemon ? " daemon" : "",
priority, thread->threadId, kStatusNames[thread->status]);
dvmPrintDebugMessage(target,
- " | group=\"%s\" sCount=%d dsCount=%d s=%d obj=%p\n",
+ " | group=\"%s\" sCount=%d dsCount=%d s=%c obj=%p\n",
groupName, thread->suspendCount, thread->dbgSuspendCount,
- thread->isSuspended, thread->threadObj);
+ thread->isSuspended ? 'Y' : 'N', thread->threadObj);
dvmPrintDebugMessage(target,
" | sysTid=%d nice=%d sched=%d/%d handle=%d\n",
thread->systemTid, getpriority(PRIO_PROCESS, thread->systemTid),
@@ -3171,9 +3204,15 @@
* GC helper functions
*/
+/*
+ * Add the contents of the registers from the interpreted call stack.
+ */
static void gcScanInterpStackReferences(Thread *thread)
{
const u4 *framePtr;
+#if WITH_EXTRA_GC_CHECKS > 1
+ bool first = true;
+#endif
framePtr = (const u4 *)thread->curFrame;
while (framePtr != NULL) {
@@ -3182,27 +3221,185 @@
saveArea = SAVEAREA_FROM_FP(framePtr);
method = saveArea->method;
- if (method != NULL) {
+ if (method != NULL && !dvmIsNativeMethod(method)) {
#ifdef COUNT_PRECISE_METHODS
/* the GC is running, so no lock required */
- if (!dvmIsNativeMethod(method)) {
- if (dvmPointerSetAddEntry(gDvm.preciseMethods, method))
- LOGI("Added %s.%s %p\n",
- method->clazz->descriptor, method->name, method);
- }
+ if (dvmPointerSetAddEntry(gDvm.preciseMethods, method))
+ LOGI("PGC: added %s.%s %p\n",
+ method->clazz->descriptor, method->name, method);
#endif
- int i;
- for (i = method->registersSize - 1; i >= 0; i--) {
- u4 rval = *framePtr++;
-//TODO: wrap markifobject in a macro that does pointer checks
- if (rval != 0 && (rval & 0x3) == 0) {
- dvmMarkIfObject((Object *)rval);
+#if WITH_EXTRA_GC_CHECKS > 1
+ /*
+ * May also want to enable the memset() in the "invokeMethod"
+ * goto target in the portable interpreter. That sets the stack
+ * to a pattern that makes referring to uninitialized data
+ * very obvious.
+ */
+
+ if (first) {
+ /*
+ * First frame, isn't native, check the "alternate" saved PC
+ * as a sanity check.
+ *
+ * It seems like we could check the second frame if the first
+ * is native, since the PCs should be the same. It turns out
+ * this doesn't always work. The problem is that we could
+ * have calls in the sequence:
+ * interp method #2
+ * native method
+ * interp method #1
+ *
+ * and then GC while in the native method after returning
+ * from interp method #2. The currentPc on the stack is
+ * for interp method #1, but thread->currentPc2 is still
+ * set for the last thing interp method #2 did.
+ *
+ * This can also happen in normal execution:
+ * - sget-object on not-yet-loaded class
+ * - class init updates currentPc2
+ * - static field init is handled by parsing annotations;
+ * static String init requires creation of a String object,
+ * which can cause a GC
+ *
+ * Essentially, any pattern that involves executing
+ * interpreted code and then causes an allocation without
+ * executing instructions in the original method will hit
+ * this. These are rare enough that the test still has
+ * some value.
+ */
+ if (saveArea->xtra.currentPc != thread->currentPc2) {
+ LOGW("PGC: savedPC(%p) != current PC(%p), %s.%s ins=%p\n",
+ saveArea->xtra.currentPc, thread->currentPc2,
+ method->clazz->descriptor, method->name, method->insns);
+ if (saveArea->xtra.currentPc != NULL)
+ LOGE(" pc inst = 0x%04x\n", *saveArea->xtra.currentPc);
+ if (thread->currentPc2 != NULL)
+ LOGE(" pc2 inst = 0x%04x\n", *thread->currentPc2);
+ dvmDumpThread(thread, false);
}
+ } else {
+ /*
+ * It's unusual, but not impossible, for a non-first frame
+ * to be at something other than a method invocation. For
+ * example, if we do a new-instance on a nonexistent class,
+ * we'll have a lot of class loader activity on the stack
+ * above the frame with the "new" operation. Could also
+ * happen while we initialize a Throwable when an instruction
+ * fails.
+ *
+ * So there's not much we can do here to verify the PC,
+ * except to verify that it's a GC point.
+ */
+ }
+ assert(saveArea->xtra.currentPc != NULL);
+#endif
+
+ const RegisterMap* pMap;
+ const u1* regVector;
+ int i;
+
+ Method* nonConstMethod = (Method*) method; // quiet gcc
+ pMap = dvmGetExpandedRegisterMap(nonConstMethod);
+ if (pMap != NULL) {
+ /* found map, get registers for this address */
+ int addr = saveArea->xtra.currentPc - method->insns;
+ regVector = dvmRegisterMapGetLine(pMap, addr);
+ if (regVector == NULL) {
+ LOGW("PGC: map but no entry for %s.%s addr=0x%04x\n",
+ method->clazz->descriptor, method->name, addr);
+ } else {
+ LOGV("PGC: found map for %s.%s 0x%04x (t=%d)\n",
+ method->clazz->descriptor, method->name, addr,
+ thread->threadId);
+ }
+ } else {
+ /*
+ * No map found. If precise GC is disabled this is
+ * expected -- we don't create pointers to the map data even
+ * if it's present -- but if it's enabled it means we're
+ * unexpectedly falling back on a conservative scan, so it's
+ * worth yelling a little.
+ *
+ * TODO: we should be able to remove this for production --
+ * no need to keep banging on the global.
+ */
+ if (gDvm.preciseGc) {
+ LOGV("PGC: no map for %s.%s\n",
+ method->clazz->descriptor, method->name);
+ }
+ regVector = NULL;
+ }
+
+ if (regVector == NULL) {
+ /* conservative scan */
+ for (i = method->registersSize - 1; i >= 0; i--) {
+ u4 rval = *framePtr++;
+ if (rval != 0 && (rval & 0x3) == 0) {
+ dvmMarkIfObject((Object *)rval);
+ }
+ }
+ } else {
+ /*
+ * Precise scan. v0 is at the lowest address on the
+ * interpreted stack, and is the first bit in the register
+ * vector, so we can walk through the register map and
+ * memory in the same direction.
+ *
+ * A '1' bit indicates a live reference.
+ */
+ u2 bits = 1 << 1;
+ for (i = method->registersSize - 1; i >= 0; i--) {
+ u4 rval = *framePtr++;
+
+ bits >>= 1;
+ if (bits == 1) {
+ /* set bit 9 so we can tell when we're empty */
+ bits = *regVector++ | 0x0100;
+ LOGVV("loaded bits: 0x%02x\n", bits & 0xff);
+ }
+
+ if (rval != 0 && (bits & 0x01) != 0) {
+ /*
+ * Non-null, register marked as live reference. This
+ * should always be a valid object.
+ */
+#if WITH_EXTRA_GC_CHECKS > 0
+ if ((rval & 0x3) != 0 ||
+ !dvmIsValidObject((Object*) rval))
+ {
+ /* this is very bad */
+ LOGE("PGC: invalid ref in reg %d: 0x%08x\n",
+ method->registersSize-1 - i, rval);
+ } else
+#endif
+ {
+ dvmMarkObjectNonNull((Object *)rval);
+ }
+ } else {
+ /*
+ * Null or non-reference, do nothing at all.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+ if (dvmIsValidObject((Object*) rval)) {
+ /* this is normal, but we feel chatty */
+ LOGD("PGC: ignoring valid ref in reg %d: 0x%08x\n",
+ method->registersSize-1 - i, rval);
+ }
+#endif
+ }
+ }
+ dvmReleaseRegisterMapLine(pMap, regVector);
}
}
- /* else this is a break frame; nothing to mark.
+ /* else this is a break frame and there is nothing to mark, or
+ * this is a native method and the registers are just the "ins",
+ * copied from various registers in the caller's set.
*/
+#if WITH_EXTRA_GC_CHECKS > 1
+ first = false;
+#endif
+
/* Don't fall into an infinite loop if things get corrupted.
*/
assert((uintptr_t)saveArea->prevFrame > (uintptr_t)framePtr ||
diff --git a/vm/Thread.h b/vm/Thread.h
index 86a7845..6eefd40 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -203,6 +203,11 @@
#ifdef WITH_JNI_STACK_CHECK
u4 stackCrc;
#endif
+
+#if WITH_EXTRA_GC_CHECKS > 1
+ /* PC, saved on every instruction; redundant with StackSaveArea */
+ const u2* currentPc2;
+#endif
} Thread;
/* start point for an internal thread; mimics pthread args */
@@ -277,12 +282,11 @@
bool dvmCheckSuspendPending(Thread* self);
/*
- * Fast test for use in the interpreter. If our suspend count is nonzero,
- * do a more rigorous evaluation.
+ * Fast test for use in the interpreter. Returns "true" if our suspend
+ * count is nonzero.
*/
-INLINE void dvmCheckSuspendQuick(Thread* self) {
- if (self->suspendCount != 0)
- dvmCheckSuspendPending(self);
+INLINE bool dvmCheckSuspendQuick(Thread* self) {
+ return (self->suspendCount != 0);
}
/*
diff --git a/vm/alloc/Alloc.h b/vm/alloc/Alloc.h
index 0489db7..8bf4520 100644
--- a/vm/alloc/Alloc.h
+++ b/vm/alloc/Alloc.h
@@ -133,7 +133,7 @@
}
#ifdef WITH_EXTRA_OBJECT_VALIDATION
if (!dvmIsValidObject(obj)) {
- //abort();
+ //dvmAbort();
dvmThrowException("Ljava/lang/InternalError;",
"VM detected invalid object ptr");
return false;
@@ -142,7 +142,7 @@
#ifndef NDEBUG
/* check for heap corruption */
if (obj->clazz == NULL || ((u4) obj->clazz) <= 65536) {
- abort();
+ dvmAbort();
dvmThrowException("Ljava/lang/InternalError;",
"VM detected invalid object class ptr");
return false;
diff --git a/vm/alloc/Heap.c b/vm/alloc/Heap.c
index 09954ea..31e7fee 100644
--- a/vm/alloc/Heap.c
+++ b/vm/alloc/Heap.c
@@ -174,6 +174,7 @@
if (self != NULL) {
oldStatus = dvmChangeStatus(self, THREAD_VMWAIT);
} else {
+ LOGI("ODD: waiting on heap lock, no self\n");
oldStatus = -1; // shut up gcc
}
@@ -867,7 +868,10 @@
/* Set up the marking context.
*/
- dvmHeapBeginMarkStep();
+ if (!dvmHeapBeginMarkStep()) {
+ LOGE_HEAP("dvmHeapBeginMarkStep failed; aborting\n");
+ dvmAbort();
+ }
/* Mark the set of objects that are strongly reachable from the roots.
*/
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index a0601d7..84349a9 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -22,6 +22,7 @@
#include <limits.h> // for ULONG_MAX
#include <sys/mman.h> // for madvise(), mmap()
#include <cutils/ashmem.h>
+#include <errno.h>
#define GC_DEBUG_PARANOID 2
#define GC_DEBUG_BASIC 1
@@ -92,7 +93,7 @@
{
const Object **limit;
size_t size;
- int fd;
+ int fd, err;
/* Create a stack big enough for the worst possible case,
* where the heap is perfectly full of the smallest object.
@@ -104,14 +105,17 @@
size = ALIGN_UP_TO_PAGE_SIZE(size);
fd = ashmem_create_region("dalvik-heap-markstack", size);
if (fd < 0) {
- LOGE_GC("Could not create %d-byte ashmem mark stack\n", size);
+ LOGE_GC("Could not create %d-byte ashmem mark stack: %s\n",
+ size, strerror(errno));
return false;
}
limit = (const Object **)mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE, fd, 0);
+ err = errno;
close(fd);
if (limit == MAP_FAILED) {
- LOGE_GC("Could not mmap %d-byte ashmem mark stack\n", size);
+ LOGE_GC("Could not mmap %d-byte ashmem mark stack: %s\n",
+ size, strerror(err));
return false;
}
@@ -520,6 +524,17 @@
}
#endif
+#if WITH_OBJECT_HEADERS
+ if (ptr2chunk(obj)->scanGeneration == gGeneration) {
+ LOGE("object 0x%08x was already scanned this generation\n",
+ (uintptr_t)obj);
+ dvmAbort();
+ }
+ ptr2chunk(obj)->oldScanGeneration = ptr2chunk(obj)->scanGeneration;
+ ptr2chunk(obj)->scanGeneration = gGeneration;
+ ptr2chunk(obj)->scanCount++;
+#endif
+
/* Get and mark the class object for this particular instance.
*/
clazz = obj->clazz;
@@ -540,16 +555,9 @@
*/
return;
}
+
#if WITH_OBJECT_HEADERS
gMarkParent = obj;
- if (ptr2chunk(obj)->scanGeneration == gGeneration) {
- LOGE("object 0x%08x was already scanned this generation\n",
- (uintptr_t)obj);
- dvmAbort();
- }
- ptr2chunk(obj)->oldScanGeneration = ptr2chunk(obj)->scanGeneration;
- ptr2chunk(obj)->scanGeneration = gGeneration;
- ptr2chunk(obj)->scanCount++;
#endif
assert(dvmIsValidObject((Object *)clazz));
diff --git a/vm/analysis/CodeVerify.c b/vm/analysis/CodeVerify.c
index 65aa833..97d98d7 100644
--- a/vm/analysis/CodeVerify.c
+++ b/vm/analysis/CodeVerify.c
@@ -72,9 +72,9 @@
static inline bool doVerboseLogging(const Method* meth) {
return false; /* COMMENT OUT to enable verbose debugging */
- const char* cd = "Lop_lshr;";
- const char* mn = "test";
- const char* sg = "(II)J";
+ const char* cd = "Landroid/net/http/Request;";
+ const char* mn = "readResponse";
+ const char* sg = "(Landroid/net/http/AndroidHttpClientConnection;)V";
return (strcmp(meth->clazz->descriptor, cd) == 0 &&
dvmCompareNameDescriptorAndMethod(mn, sg, meth) == 0);
}
@@ -116,9 +116,10 @@
static void checkMergeTab(void);
static bool isInitMethod(const Method* meth);
static RegType getInvocationThis(const RegType* insnRegs,\
- const int insnRegCount, const DecodedInstruction* pDecInsn, bool* pOkay);
+ const int insnRegCount, const DecodedInstruction* pDecInsn,
+ VerifyError* pFailure);
static void verifyRegisterType(const RegType* insnRegs, const int insnRegCount,\
- u4 vsrc, RegType checkType, bool* pOkay);
+ u4 vsrc, RegType checkType, VerifyError* pFailure);
static bool doCodeVerification(const Method* meth, InsnFlags* insnFlags,\
RegisterTable* regTable, UninitInstanceMap* uninitMap);
static bool verifyInstruction(const Method* meth, InsnFlags* insnFlags,\
@@ -327,7 +328,7 @@
*/
static RegType primitiveTypeToRegType(PrimitiveType primType)
{
- struct {
+ static const struct {
RegType regType; /* type equivalent */
PrimitiveType primType; /* verification */
} convTab[] = {
@@ -545,9 +546,11 @@
/*
* Look up a class reference given as a simple string descriptor.
+ *
+ * If we can't find it, return a generic substitute when possible.
*/
static ClassObject* lookupClassByDescriptor(const Method* meth,
- const char* pDescriptor, bool* pOkay)
+ const char* pDescriptor, VerifyError* pFailure)
{
/*
* The javac compiler occasionally puts references to nonexistent
@@ -585,7 +588,7 @@
if (pDescriptor[1] != 'L' && pDescriptor[1] != '[') {
LOG_VFY("VFY: invalid char in signature in '%s'\n",
pDescriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
/*
@@ -607,17 +610,17 @@
} else {
/* We are looking at a primitive type. */
LOG_VFY("VFY: invalid char in signature in '%s'\n", pDescriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
if (clazz == NULL) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
}
if (dvmIsPrimitiveClass(clazz)) {
LOG_VFY("VFY: invalid use of primitive type '%s'\n", pDescriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
clazz = NULL;
}
@@ -634,7 +637,7 @@
* NOTE: this is also expected to verify the signature.
*/
static ClassObject* lookupSignatureClass(const Method* meth, const char** pSig,
- bool* pOkay)
+ VerifyError* pFailure)
{
const char* sig = *pSig;
const char* endp = sig;
@@ -645,7 +648,7 @@
;
if (*endp != ';') {
LOG_VFY("VFY: bad signature component '%s' (missing ';')\n", sig);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return NULL;
}
@@ -657,7 +660,7 @@
*pSig = endp - 1; /* - 1 so that *pSig points at, not past, the ';' */
- return lookupClassByDescriptor(meth, typeStr, pOkay);
+ return lookupClassByDescriptor(meth, typeStr, pFailure);
}
/*
@@ -669,7 +672,7 @@
* NOTE: this is also expected to verify the signature.
*/
static ClassObject* lookupSignatureArrayClass(const Method* meth,
- const char** pSig, bool* pOkay)
+ const char** pSig, VerifyError* pFailure)
{
const char* sig = *pSig;
const char* endp = sig;
@@ -685,7 +688,7 @@
;
if (*endp != ';') {
LOG_VFY("VFY: bad signature component '%s' (missing ';')\n", sig);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return NULL;
}
}
@@ -697,7 +700,7 @@
*pSig = endp;
- return lookupClassByDescriptor(meth, typeStr, pOkay);
+ return lookupClassByDescriptor(meth, typeStr, pFailure);
}
/*
@@ -713,7 +716,7 @@
{
DexParameterIterator iterator;
int actualArgs, expectedArgs, argStart;
- bool okay = true;
+ VerifyError failure = VERIFY_ERROR_NONE;
dexParameterIteratorInit(&iterator, &meth->prototype);
argStart = meth->registersSize - meth->insSize;
@@ -768,8 +771,8 @@
*/
{
ClassObject* clazz =
- lookupClassByDescriptor(meth, descriptor, &okay);
- if (!okay)
+ lookupClassByDescriptor(meth, descriptor, &failure);
+ if (!VERIFY_OK(failure))
goto bad_sig;
regTypes[argStart + actualArgs] = regTypeFromClass(clazz);
}
@@ -926,10 +929,10 @@
case 'L':
case '[':
{
- bool okay = true;
+ VerifyError failure = VERIFY_ERROR_NONE;
ClassObject* clazz =
- lookupClassByDescriptor(meth, descriptor, &okay);
- assert(okay);
+ lookupClassByDescriptor(meth, descriptor, &failure);
+ assert(VERIFY_OK(failure));
type = regTypeFromClass(clazz);
}
break;
@@ -1012,13 +1015,13 @@
* Widening conversions on integers and references are allowed, but
* narrowing conversions are not.
*
- * Returns the resolved method on success, NULL (and sets "*pOkay" to "false")
- * on failure.
+ * Returns the resolved method on success, NULL on failure (with *pFailure
+ * set appropriately).
*/
static Method* verifyInvocationArgs(const Method* meth, const RegType* insnRegs,
const int insnRegCount, const DecodedInstruction* pDecInsn,
UninitInstanceMap* uninitMap, MethodType methodType, bool isRange,
- bool isSuper, bool* pOkay)
+ bool isSuper, VerifyError* pFailure)
{
Method* resMethod;
char* sigOriginal = NULL;
@@ -1030,7 +1033,8 @@
if (methodType == METHOD_INTERFACE) {
resMethod = dvmOptResolveInterfaceMethod(meth->clazz, pDecInsn->vB);
} else {
- resMethod = dvmOptResolveMethod(meth->clazz, pDecInsn->vB, methodType);
+ resMethod = dvmOptResolveMethod(meth->clazz, pDecInsn->vB, methodType,
+ pFailure);
}
if (resMethod == NULL) {
/* failed; print a meaningful failure message */
@@ -1065,6 +1069,7 @@
dvmMethodTypeStr(methodType), pDecInsn->vB,
classDescriptor, methodName, methodDesc);
free(methodDesc);
+ *pFailure = VERIFY_ERROR_NO_METHOD;
goto fail;
}
@@ -1095,6 +1100,7 @@
(super == NULL) ? "-" : super->descriptor,
resMethod->name, desc);
free(desc);
+ *pFailure = VERIFY_ERROR_NO_METHOD;
goto fail;
}
}
@@ -1135,8 +1141,8 @@
RegType actualArgType;
actualArgType = getInvocationThis(insnRegs, insnRegCount, pDecInsn,
- pOkay);
- if (!*pOkay)
+ pFailure);
+ if (!VERIFY_OK(*pFailure))
goto fail;
if (regTypeIsUninitReference(actualArgType) && resMethod->name[0] != '<')
@@ -1176,12 +1182,12 @@
switch (*sig) {
case 'L':
{
- ClassObject* clazz = lookupSignatureClass(meth, &sig, pOkay);
- if (!*pOkay)
+ ClassObject* clazz = lookupSignatureClass(meth, &sig, pFailure);
+ if (!VERIFY_OK(*pFailure))
goto bad_sig;
verifyRegisterType(insnRegs, insnRegCount, getReg,
- regTypeFromClass(clazz), pOkay);
- if (!*pOkay) {
+ regTypeFromClass(clazz), pFailure);
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: bad arg %d (into %s)\n",
actualArgs, clazz->descriptor);
goto bad_sig;
@@ -1192,12 +1198,12 @@
case '[':
{
ClassObject* clazz =
- lookupSignatureArrayClass(meth, &sig, pOkay);
- if (!*pOkay)
+ lookupSignatureArrayClass(meth, &sig, pFailure);
+ if (!VERIFY_OK(*pFailure))
goto bad_sig;
verifyRegisterType(insnRegs, insnRegCount, getReg,
- regTypeFromClass(clazz), pOkay);
- if (!*pOkay) {
+ regTypeFromClass(clazz), pFailure);
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: bad arg %d (into %s)\n",
actualArgs, clazz->descriptor);
goto bad_sig;
@@ -1207,42 +1213,42 @@
break;
case 'Z':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeBoolean, pOkay);
+ kRegTypeBoolean, pFailure);
actualArgs++;
break;
case 'C':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeChar, pOkay);
+ kRegTypeChar, pFailure);
actualArgs++;
break;
case 'B':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeByte, pOkay);
+ kRegTypeByte, pFailure);
actualArgs++;
break;
case 'I':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeInteger, pOkay);
+ kRegTypeInteger, pFailure);
actualArgs++;
break;
case 'S':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeShort, pOkay);
+ kRegTypeShort, pFailure);
actualArgs++;
break;
case 'F':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeFloat, pOkay);
+ kRegTypeFloat, pFailure);
actualArgs++;
break;
case 'D':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeDoubleLo, pOkay);
+ kRegTypeDoubleLo, pFailure);
actualArgs += 2;
break;
case 'J':
verifyRegisterType(insnRegs, insnRegCount, getReg,
- kRegTypeLongLo, pOkay);
+ kRegTypeLongLo, pFailure);
actualArgs += 2;
break;
default:
@@ -1272,13 +1278,14 @@
if (resMethod != NULL) {
char* desc = dexProtoCopyMethodDescriptor(&resMethod->prototype);
LOG_VFY("VFY: rejecting call to %s.%s %s\n",
- resMethod->clazz->descriptor, resMethod->name, desc);
+ resMethod->clazz->descriptor, resMethod->name, desc);
free(desc);
}
fail:
free(sigOriginal);
- *pOkay = false;
+ if (*pFailure == VERIFY_ERROR_NONE)
+ *pFailure = VERIFY_ERROR_GENERIC;
return NULL;
}
@@ -1324,15 +1331,15 @@
/*
* Get the type of register N, verifying that the register is valid.
*
- * Sets "*pOkay" to false if the register number is out of range.
+ * Sets "*pFailure" appropriately if the register number is out of range.
*/
static inline RegType getRegisterType(const RegType* insnRegs,
- const int insnRegCount, u4 vsrc, bool* pOkay)
+ const int insnRegCount, u4 vsrc, VerifyError* pFailure)
{
RegType type;
if (vsrc >= (u4) insnRegCount) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return kRegTypeUnknown;
} else {
return insnRegs[vsrc];
@@ -1341,21 +1348,21 @@
/*
* Get the value from a register, and cast it to a ClassObject. Sets
- * "pOkay" to false if something fails.
+ * "*pFailure" if something fails.
*
* This fails if the register holds an uninitialized class.
*
* If the register holds kRegTypeZero, this returns a NULL pointer.
*/
static ClassObject* getClassFromRegister(const RegType* insnRegs,
- const int insnRegCount, u4 vsrc, bool* pOkay)
+ const int insnRegCount, u4 vsrc, VerifyError* pFailure)
{
ClassObject* clazz = NULL;
RegType type;
/* get the element type of the array held in vsrc */
- type = getRegisterType(insnRegs, insnRegCount, vsrc, pOkay);
- if (!*pOkay)
+ type = getRegisterType(insnRegs, insnRegCount, vsrc, pFailure);
+ if (!VERIFY_OK(*pFailure))
goto bail;
/* if "always zero", we allow it to fail at runtime */
@@ -1365,12 +1372,12 @@
if (!regTypeIsReference(type)) {
LOG_VFY("VFY: tried to get class from non-ref register v%d (type=%d)\n",
vsrc, type);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
if (regTypeIsUninitReference(type)) {
LOG_VFY("VFY: register %u holds uninitialized reference\n", vsrc);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
@@ -1391,27 +1398,28 @@
* and then return vC.
*/
static RegType getInvocationThis(const RegType* insnRegs,
- const int insnRegCount, const DecodedInstruction* pDecInsn, bool* pOkay)
+ const int insnRegCount, const DecodedInstruction* pDecInsn,
+ VerifyError* pFailure)
{
RegType thisType = kRegTypeUnknown;
if (pDecInsn->vA < 1) {
LOG_VFY("VFY: invoke lacks 'this'\n");
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
/* get the element type of the array held in vsrc */
- thisType = getRegisterType(insnRegs, insnRegCount, pDecInsn->vC, pOkay);
- if (!*pOkay) {
- LOG_VFY("VFY: failed to get this from register %u\n", pDecInsn->vC);
+ thisType = getRegisterType(insnRegs, insnRegCount, pDecInsn->vC, pFailure);
+ if (!VERIFY_OK(*pFailure)) {
+ LOG_VFY("VFY: failed to get 'this' from register %u\n", pDecInsn->vC);
goto bail;
}
if (!regTypeIsReference(thisType)) {
LOG_VFY("VFY: tried to get class from non-ref register v%d (type=%d)\n",
pDecInsn->vC, thisType);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
@@ -1424,10 +1432,10 @@
* "newType" is the "Lo" part of a 64-bit value, register N+1 will be
* set to "newType+1".
*
- * Sets "*pOkay" to false if the register number is out of range.
+ * Sets "*pFailure" if the register number is out of range.
*/
static void setRegisterType(RegType* insnRegs, const int insnRegCount,
- u4 vdst, RegType newType, bool* pOkay)
+ u4 vdst, RegType newType, VerifyError* pFailure)
{
//LOGD("set-reg v%u = %d\n", vdst, newType);
switch (newType) {
@@ -1443,7 +1451,7 @@
case kRegTypeFloat:
case kRegTypeZero:
if (vdst >= (u4) insnRegCount) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
} else {
insnRegs[vdst] = newType;
}
@@ -1451,7 +1459,7 @@
case kRegTypeLongLo:
case kRegTypeDoubleLo:
if (vdst+1 >= (u4) insnRegCount) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
} else {
insnRegs[vdst] = newType;
insnRegs[vdst+1] = newType+1;
@@ -1460,14 +1468,14 @@
case kRegTypeLongHi:
case kRegTypeDoubleHi:
/* should never set these explicitly */
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
case kRegTypeUninit:
default:
if (regTypeIsReference(newType)) {
if (vdst >= (u4) insnRegCount) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
insnRegs[vdst] = newType;
@@ -1490,7 +1498,7 @@
case kRegTypeConflict: // should only be set during a merge
LOG_VFY("Unexpected set type %d\n", newType);
assert(false);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -1509,10 +1517,10 @@
* interface, verify that the register implements checkType.
*/
static void verifyRegisterType(const RegType* insnRegs, const int insnRegCount,
- u4 vsrc, RegType checkType, bool* pOkay)
+ u4 vsrc, RegType checkType, VerifyError* pFailure)
{
if (vsrc >= (u4) insnRegCount) {
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return;
}
@@ -1531,7 +1539,7 @@
if (!canConvertTo1nr(srcType, checkType)) {
LOG_VFY("VFY: register1 v%u type %d, wanted %d\n",
vsrc, srcType, checkType);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
break;
case kRegTypeLongLo:
@@ -1539,15 +1547,15 @@
if (vsrc+1 >= (u4) insnRegCount) {
LOG_VFY("VFY: register2 v%u out of range (%d)\n",
vsrc, insnRegCount);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
} else if (insnRegs[vsrc+1] != srcType+1) {
LOG_VFY("VFY: register2 v%u-%u values %d,%d\n",
vsrc, vsrc+1, insnRegs[vsrc], insnRegs[vsrc+1]);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
} else if (!canConvertTo2(srcType, checkType)) {
LOG_VFY("VFY: register2 v%u type %d, wanted %d\n",
vsrc, srcType, checkType);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
break;
@@ -1559,7 +1567,7 @@
case kRegTypeConflict:
/* should never be checking for these explicitly */
assert(false);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return;
case kRegTypeUninit:
default:
@@ -1567,23 +1575,23 @@
if (!regTypeIsReference(checkType)) {
LOG_VFY("VFY: unexpected check type %d\n", checkType);
assert(false);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
if (regTypeIsUninitReference(checkType)) {
LOG_VFY("VFY: uninitialized ref not expected as reg check\n");
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
/* make sure srcType is initialized reference or always-NULL */
if (!regTypeIsReference(srcType)) {
LOG_VFY("VFY: register1 v%u type %d, wanted ref\n", vsrc, srcType);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
if (regTypeIsUninitReference(srcType)) {
LOG_VFY("VFY: register1 v%u holds uninitialized ref\n", vsrc);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
/* if the register isn't Zero, make sure it's an instance of check */
@@ -1605,14 +1613,14 @@
{
LOG_VFY("VFY: %s does not implement %s\n",
srcClass->descriptor, checkClass->descriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
*/
} else {
if (!dvmInstanceof(srcClass, checkClass)) {
LOG_VFY("VFY: %s is not instance of %s\n",
srcClass->descriptor, checkClass->descriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
}
}
@@ -1625,10 +1633,10 @@
* "insnRegCount" to encompass the result register.
*/
static void setResultRegisterType(RegType* insnRegs, const int insnRegCount,
- RegType newType, bool* pOkay)
+ RegType newType, VerifyError* pFailure)
{
setRegisterType(insnRegs, insnRegCount + kExtraRegs,
- RESULT_REGISTER(insnRegCount), newType, pOkay);
+ RESULT_REGISTER(insnRegCount), newType, pFailure);
}
@@ -1639,7 +1647,7 @@
* must be marked as initialized.
*/
static void markRefsAsInitialized(RegType* insnRegs, int insnRegCount,
- UninitInstanceMap* uninitMap, RegType uninitType, bool* pOkay)
+ UninitInstanceMap* uninitMap, RegType uninitType, VerifyError* pFailure)
{
ClassObject* clazz;
RegType initType;
@@ -1649,7 +1657,7 @@
if (clazz == NULL) {
LOGE("VFY: unable to find type=0x%x (idx=%d)\n",
uninitType, regTypeToUninitIndex(uninitType));
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
return;
}
initType = regTypeFromClass(clazz);
@@ -1748,9 +1756,10 @@
*
* For category 2 values, "type" must be the "low" half of the value.
*
- * Sets "*pOkay" to false if not.
+ * Sets "*pFailure" if something looks wrong.
*/
-static void checkTypeCategory(RegType type, TypeCategory cat, bool* pOkay)
+static void checkTypeCategory(RegType type, TypeCategory cat,
+ VerifyError* pFailure)
{
switch (cat) {
case kTypeCategory1nr:
@@ -1767,7 +1776,7 @@
case kRegTypeInteger:
break;
default:
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
break;
@@ -1778,19 +1787,19 @@
case kRegTypeDoubleLo:
break;
default:
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
break;
case kTypeCategoryRef:
if (type != kRegTypeZero && !regTypeIsReference(type))
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
default:
assert(false);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -1802,10 +1811,10 @@
* Does not verify that "typel" is in fact the low part of a 64-bit
* register pair.
*/
-static void checkWidePair(RegType typel, RegType typeh, bool* pOkay)
+static void checkWidePair(RegType typel, RegType typeh, VerifyError* pFailure)
{
if ((typeh != typel+1))
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
/*
@@ -1816,15 +1825,15 @@
* "vsrc" values are checked against this.
*/
static void copyRegister1(RegType* insnRegs, int insnRegCount, u4 vdst,
- u4 vsrc, TypeCategory cat, bool* pOkay)
+ u4 vsrc, TypeCategory cat, VerifyError* pFailure)
{
- RegType type = getRegisterType(insnRegs, insnRegCount, vsrc, pOkay);
- if (*pOkay)
- checkTypeCategory(type, cat, pOkay);
- if (*pOkay)
- setRegisterType(insnRegs, insnRegCount, vdst, type, pOkay);
+ RegType type = getRegisterType(insnRegs, insnRegCount, vsrc, pFailure);
+ if (VERIFY_OK(*pFailure))
+ checkTypeCategory(type, cat, pFailure);
+ if (VERIFY_OK(*pFailure))
+ setRegisterType(insnRegs, insnRegCount, vdst, type, pFailure);
- if (!*pOkay) {
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: copy1 v%u<-v%u type=%d cat=%d\n", vdst, vsrc, type, cat);
}
}
@@ -1834,18 +1843,18 @@
* "vsrc" to "vdst". This copies both halves of the register.
*/
static void copyRegister2(RegType* insnRegs, int insnRegCount, u4 vdst,
- u4 vsrc, bool* pOkay)
+ u4 vsrc, VerifyError* pFailure)
{
- RegType typel = getRegisterType(insnRegs, insnRegCount, vsrc, pOkay);
- RegType typeh = getRegisterType(insnRegs, insnRegCount, vsrc+1, pOkay);
- if (*pOkay) {
- checkTypeCategory(typel, kTypeCategory2, pOkay);
- checkWidePair(typel, typeh, pOkay);
+ RegType typel = getRegisterType(insnRegs, insnRegCount, vsrc, pFailure);
+ RegType typeh = getRegisterType(insnRegs, insnRegCount, vsrc+1, pFailure);
+ if (VERIFY_OK(*pFailure)) {
+ checkTypeCategory(typel, kTypeCategory2, pFailure);
+ checkWidePair(typel, typeh, pFailure);
}
- if (*pOkay)
- setRegisterType(insnRegs, insnRegCount, vdst, typel, pOkay);
+ if (VERIFY_OK(*pFailure))
+ setRegisterType(insnRegs, insnRegCount, vdst, typel, pFailure);
- if (!*pOkay) {
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: copy2 v%u<-v%u type=%d/%d\n", vdst, vsrc, typel, typeh);
}
}
@@ -1858,21 +1867,21 @@
* because that would affect the test on "vdst" as well.
*/
static void copyResultRegister1(RegType* insnRegs, const int insnRegCount,
- u4 vdst, TypeCategory cat, bool* pOkay)
+ u4 vdst, TypeCategory cat, VerifyError* pFailure)
{
RegType type;
u4 vsrc;
vsrc = RESULT_REGISTER(insnRegCount);
- type = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc, pOkay);
- if (*pOkay)
- checkTypeCategory(type, cat, pOkay);
- if (*pOkay) {
- setRegisterType(insnRegs, insnRegCount, vdst, type, pOkay);
+ type = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc, pFailure);
+ if (VERIFY_OK(*pFailure))
+ checkTypeCategory(type, cat, pFailure);
+ if (VERIFY_OK(*pFailure)) {
+ setRegisterType(insnRegs, insnRegCount, vdst, type, pFailure);
insnRegs[vsrc] = kRegTypeUnknown;
}
- if (!*pOkay) {
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: copyRes1 v%u<-v%u cat=%d type=%d\n",
vdst, vsrc, cat, type);
}
@@ -1886,25 +1895,27 @@
* because that would affect the test on "vdst" as well.
*/
static void copyResultRegister2(RegType* insnRegs, const int insnRegCount,
- u4 vdst, bool* pOkay)
+ u4 vdst, VerifyError* pFailure)
{
RegType typel, typeh;
u4 vsrc;
vsrc = RESULT_REGISTER(insnRegCount);
- typel = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc, pOkay);
- typeh = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc+1, pOkay);
- if (*pOkay) {
- checkTypeCategory(typel, kTypeCategory2, pOkay);
- checkWidePair(typel, typeh, pOkay);
+ typel = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc,
+ pFailure);
+ typeh = getRegisterType(insnRegs, insnRegCount + kExtraRegs, vsrc+1,
+ pFailure);
+ if (VERIFY_OK(*pFailure)) {
+ checkTypeCategory(typel, kTypeCategory2, pFailure);
+ checkWidePair(typel, typeh, pFailure);
}
- if (*pOkay) {
- setRegisterType(insnRegs, insnRegCount, vdst, typel, pOkay);
+ if (VERIFY_OK(*pFailure)) {
+ setRegisterType(insnRegs, insnRegCount, vdst, typel, pFailure);
insnRegs[vsrc] = kRegTypeUnknown;
insnRegs[vsrc+1] = kRegTypeUnknown;
}
- if (!*pOkay) {
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: copyRes2 v%u<-v%u type=%d/%d\n",
vdst, vsrc, typel, typeh);
}
@@ -1916,10 +1927,10 @@
*/
static void checkUnop(RegType* insnRegs, const int insnRegCount,
DecodedInstruction* pDecInsn, RegType dstType, RegType srcType,
- bool* pOkay)
+ VerifyError* pFailure)
{
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType, pOkay);
- setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pOkay);
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType, pFailure);
+ setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pFailure);
}
/*
@@ -1958,10 +1969,10 @@
*/
static void checkLitop(RegType* insnRegs, const int insnRegCount,
DecodedInstruction* pDecInsn, RegType dstType, RegType srcType,
- bool checkBooleanOp, bool* pOkay)
+ bool checkBooleanOp, VerifyError* pFailure)
{
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType, pOkay);
- if (*pOkay && checkBooleanOp) {
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType, pFailure);
+ if (VERIFY_OK(*pFailure) && checkBooleanOp) {
assert(dstType == kRegTypeInteger);
/* check vB with the call, then check the constant manually */
if (upcastBooleanOp(insnRegs, insnRegCount, pDecInsn->vB, pDecInsn->vB)
@@ -1970,7 +1981,7 @@
dstType = kRegTypeBoolean;
}
}
- setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pOkay);
+ setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pFailure);
}
/*
@@ -1980,16 +1991,18 @@
*/
static void checkBinop(RegType* insnRegs, const int insnRegCount,
DecodedInstruction* pDecInsn, RegType dstType, RegType srcType1,
- RegType srcType2, bool checkBooleanOp, bool* pOkay)
+ RegType srcType2, bool checkBooleanOp, VerifyError* pFailure)
{
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType1, pOkay);
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vC, srcType2, pOkay);
- if (*pOkay && checkBooleanOp) {
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType1,
+ pFailure);
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vC, srcType2,
+ pFailure);
+ if (VERIFY_OK(*pFailure) && checkBooleanOp) {
assert(dstType == kRegTypeInteger);
if (upcastBooleanOp(insnRegs, insnRegCount, pDecInsn->vB, pDecInsn->vC))
dstType = kRegTypeBoolean;
}
- setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pOkay);
+ setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pFailure);
}
/*
@@ -1998,16 +2011,18 @@
*/
static void checkBinop2addr(RegType* insnRegs, const int insnRegCount,
DecodedInstruction* pDecInsn, RegType dstType, RegType srcType1,
- RegType srcType2, bool checkBooleanOp, bool* pOkay)
+ RegType srcType2, bool checkBooleanOp, VerifyError* pFailure)
{
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vA, srcType1, pOkay);
- verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType2, pOkay);
- if (*pOkay && checkBooleanOp) {
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vA, srcType1,
+ pFailure);
+ verifyRegisterType(insnRegs, insnRegCount, pDecInsn->vB, srcType2,
+ pFailure);
+ if (VERIFY_OK(*pFailure) && checkBooleanOp) {
assert(dstType == kRegTypeInteger);
if (upcastBooleanOp(insnRegs, insnRegCount, pDecInsn->vA, pDecInsn->vB))
dstType = kRegTypeBoolean;
}
- setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pOkay);
+ setRegisterType(insnRegs, insnRegCount, pDecInsn->vA, dstType, pFailure);
}
@@ -2329,28 +2344,28 @@
* allow it to be uninitialized if this is an "<init>" method and the field
* is declared within the "objType" class.
*
- * Returns an InstField on success, returns NULL and sets "*pOkay" to false
+ * Returns an InstField on success, returns NULL and sets "*pFailure"
* on failure.
*/
static InstField* getInstField(const Method* meth,
const UninitInstanceMap* uninitMap, RegType objType, int fieldIdx,
- bool* pOkay)
+ VerifyError* pFailure)
{
InstField* instField = NULL;
ClassObject* objClass;
bool mustBeLocal = false;
if (!regTypeIsReference(objType)) {
- LOG_VFY("VFY: attempt to access field of non-reference type %d\n",
+ LOG_VFY("VFY: attempt to access field in non-reference type %d\n",
objType);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
- instField = dvmOptResolveInstField(meth->clazz, fieldIdx);
+ instField = dvmOptResolveInstField(meth->clazz, fieldIdx, pFailure);
if (instField == NULL) {
LOG_VFY("VFY: unable to resolve instance field %u\n", fieldIdx);
- *pOkay = false;
+ assert(!VERIFY_OK(*pFailure));
goto bail;
}
@@ -2367,7 +2382,7 @@
if (regTypeIsUninitReference(objType)) {
if (!isInitMethod(meth) || meth->clazz != objClass) {
LOG_VFY("VFY: attempt to access field via uninitialized ref\n");
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
mustBeLocal = true;
@@ -2377,7 +2392,7 @@
LOG_VFY("VFY: invalid field access (field %s.%s, through %s ref)\n",
instField->field.clazz->descriptor, instField->field.name,
objClass->descriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_NO_FIELD;
goto bail;
}
@@ -2388,7 +2403,7 @@
{
LOG_VFY("VFY: invalid constructor field access (field %s in %s)\n",
instField->field.name, objClass->descriptor);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
goto bail;
}
}
@@ -2400,15 +2415,15 @@
/*
* Look up a static field.
*
- * Returns a StaticField on success, returns NULL and sets "*pOkay" to false
+ * Returns a StaticField on success, returns NULL and sets "*pFailure"
* on failure.
*/
static StaticField* getStaticField(const Method* meth, int fieldIdx,
- bool* pOkay)
+ VerifyError* pFailure)
{
StaticField* staticField;
- staticField = dvmOptResolveStaticField(meth->clazz, fieldIdx);
+ staticField = dvmOptResolveStaticField(meth->clazz, fieldIdx, pFailure);
if (staticField == NULL) {
DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile;
const DexFieldId* pFieldId;
@@ -2418,8 +2433,7 @@
LOG_VFY("VFY: unable to resolve static field %u (%s) in %s\n", fieldIdx,
dexStringById(pDexFile, pFieldId->nameIdx),
dexStringByTypeIdx(pDexFile, pFieldId->classIdx));
-
- *pOkay = false;
+ assert(!VERIFY_OK(*pFailure));
goto bail;
}
@@ -2431,10 +2445,10 @@
* If "field" is marked "final", make sure this is the either <clinit>
* or <init> as appropriate.
*
- * Sets "*pOkay" to false on failure.
+ * Sets "*pFailure" on failure.
*/
static void checkFinalFieldAccess(const Method* meth, const Field* field,
- bool* pOkay)
+ VerifyError* pFailure)
{
if (!dvmIsFinalField(field))
return;
@@ -2443,21 +2457,15 @@
if (meth->clazz != field->clazz) {
LOG_VFY_METH(meth, "VFY: can't modify final field %s.%s\n",
field->clazz->descriptor, field->name);
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_ACCESS;
return;
}
/*
- * The EMMA code coverage tool generates a static method that
- * modifies a private static final field. The method is only
- * called by <clinit>, so the code is reasonable if not quite
- * kosher. (Attempting to *compile* code that does something
- * like that will earn you a quick thumbs-down from javac.)
- *
- * The verifier in another popular VM doesn't complain about this,
- * so we're going to allow classes to modify their own static
- * final fields outside of class initializers. Further testing
- * showed that modifications to instance fields are also allowed.
+ * The VM spec descriptions of putfield and putstatic say that
+ * IllegalAccessError is only thrown when the instructions appear
+ * outside the declaring class. Our earlier attempts to restrict
+ * final field modification to constructors are, therefore, wrong.
*/
#if 0
/* make sure we're in the right kind of constructor */
@@ -2465,13 +2473,13 @@
if (!isClassInitMethod(meth)) {
LOG_VFY_METH(meth,
"VFY: can't modify final static field outside <clinit>\n");
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
} else {
if (!isInitMethod(meth)) {
LOG_VFY_METH(meth,
"VFY: can't modify final field outside <init>\n");
- *pOkay = false;
+ *pFailure = VERIFY_ERROR_GENERIC;
}
}
#endif
@@ -2480,19 +2488,19 @@
/*
* Make sure that the register type is suitable for use as an array index.
*
- * Sets "*pOkay" to false if not.
+ * Sets "*pFailure" if not.
*/
static void checkArrayIndexType(const Method* meth, RegType regType,
- bool* pOkay)
+ VerifyError* pFailure)
{
- if (*pOkay) {
+ if (VERIFY_OK(*pFailure)) {
/*
* The 1nr types are interchangeable at this level. We could
* do something special if we can definitively identify it as a
* float, but there's no real value in doing so.
*/
- checkTypeCategory(regType, kTypeCategory1nr, pOkay);
- if (!*pOkay) {
+ checkTypeCategory(regType, kTypeCategory1nr, pFailure);
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY_METH(meth, "Invalid reg type for array index (%d)\n",
regType);
}
@@ -2560,11 +2568,14 @@
* Returns NULL if no matching exception handler can be found, or if the
* exception is not a subclass of Throwable.
*/
-static ClassObject* getCaughtExceptionType(const Method* meth, int insnIdx)
+static ClassObject* getCaughtExceptionType(const Method* meth, int insnIdx,
+ VerifyError* pFailure)
{
+ VerifyError localFailure;
const DexCode* pCode;
DexFile* pDexFile;
ClassObject* commonSuper = NULL;
+ bool foundPossibleHandler = false;
u4 handlersSize;
u4 offset;
u4 i;
@@ -2593,16 +2604,22 @@
if (handler->address == (u4) insnIdx) {
ClassObject* clazz;
+ foundPossibleHandler = true;
if (handler->typeIdx == kDexNoIndex)
clazz = gDvm.classJavaLangThrowable;
else
- clazz = dvmOptResolveClass(meth->clazz, handler->typeIdx);
+ clazz = dvmOptResolveClass(meth->clazz, handler->typeIdx,
+ &localFailure);
if (clazz == NULL) {
LOG_VFY("VFY: unable to resolve exception class %u (%s)\n",
handler->typeIdx,
dexStringByTypeIdx(pDexFile, handler->typeIdx));
+ /* TODO: do we want to keep going? If we don't fail
+ * this we run the risk of having a non-Throwable
+ * introduced at runtime. However, that won't pass
+ * an instanceof test, so is essentially harmless. */
} else {
if (commonSuper == NULL)
commonSuper = clazz;
@@ -2616,8 +2633,12 @@
}
if (commonSuper == NULL) {
+ /* no catch blocks, or no catches with classes we can find */
LOG_VFY_METH(meth,
"VFY: unable to find exception handler at addr 0x%x\n", insnIdx);
+ *pFailure = VERIFY_ERROR_GENERIC;
+ } else {
+ // TODO: verify the class is an instance of Throwable?
}
return commonSuper;
@@ -2732,7 +2753,7 @@
static void verifyFilledNewArrayRegs(const Method* meth,
const RegType* insnRegs, const int insnRegCount,
const DecodedInstruction* pDecInsn, ClassObject* resClass, bool isRange,
- bool* pOkay)
+ VerifyError* pFailure)
{
u4 argCount = pDecInsn->vA;
RegType expectedType;
@@ -2761,8 +2782,9 @@
else
getReg = pDecInsn->arg[ui];
- verifyRegisterType(insnRegs, insnRegCount, getReg, expectedType, pOkay);
- if (!*pOkay) {
+ verifyRegisterType(insnRegs, insnRegCount, getReg, expectedType,
+ pFailure);
+ if (!VERIFY_OK(*pFailure)) {
LOG_VFY("VFY: filled-new-array arg %u(%u) not valid\n", ui, getReg);
return;
}
@@ -3194,7 +3216,7 @@
RegType tmpType;
DecodedInstruction decInsn;
bool justSetResult = false;
- bool okay = true;
+ VerifyError failure = VERIFY_ERROR_NONE;
#ifndef NDEBUG
memset(&decInsn, 0x81, sizeof(decInsn));
@@ -3229,7 +3251,7 @@
*/
if (decInsn.vA != 0) {
LOG_VFY("VFY: encountered data table in instruction stream\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
}
break;
@@ -3237,18 +3259,18 @@
case OP_MOVE_FROM16:
case OP_MOVE_16:
copyRegister1(workRegs, insnRegCount, decInsn.vA, decInsn.vB,
- kTypeCategory1nr, &okay);
+ kTypeCategory1nr, &failure);
break;
case OP_MOVE_WIDE:
case OP_MOVE_WIDE_FROM16:
case OP_MOVE_WIDE_16:
- copyRegister2(workRegs, insnRegCount, decInsn.vA, decInsn.vB, &okay);
+ copyRegister2(workRegs, insnRegCount, decInsn.vA, decInsn.vB, &failure);
break;
case OP_MOVE_OBJECT:
case OP_MOVE_OBJECT_FROM16:
case OP_MOVE_OBJECT_16:
copyRegister1(workRegs, insnRegCount, decInsn.vA, decInsn.vB,
- kTypeCategoryRef, &okay);
+ kTypeCategoryRef, &failure);
break;
/*
@@ -3264,14 +3286,14 @@
*/
case OP_MOVE_RESULT:
copyResultRegister1(workRegs, insnRegCount, decInsn.vA,
- kTypeCategory1nr, &okay);
+ kTypeCategory1nr, &failure);
break;
case OP_MOVE_RESULT_WIDE:
- copyResultRegister2(workRegs, insnRegCount, decInsn.vA, &okay);
+ copyResultRegister2(workRegs, insnRegCount, decInsn.vA, &failure);
break;
case OP_MOVE_RESULT_OBJECT:
copyResultRegister1(workRegs, insnRegCount, decInsn.vA,
- kTypeCategoryRef, &okay);
+ kTypeCategoryRef, &failure);
break;
case OP_MOVE_EXCEPTION:
@@ -3284,71 +3306,75 @@
* "resClass" will hold the closest common superclass of all
* exceptions that can be handled here.
*/
- resClass = getCaughtExceptionType(meth, insnIdx);
+ resClass = getCaughtExceptionType(meth, insnIdx, &failure);
if (resClass == NULL) {
- okay = false;
+ assert(!VERIFY_OK(failure));
} else {
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(resClass), &okay);
+ regTypeFromClass(resClass), &failure);
}
break;
case OP_RETURN_VOID:
- okay = checkConstructorReturn(meth, workRegs, insnRegCount);
- if (okay && getMethodReturnType(meth) != kRegTypeUnknown) {
+ if (!checkConstructorReturn(meth, workRegs, insnRegCount)) {
+ failure = VERIFY_ERROR_GENERIC;
+ } else if (getMethodReturnType(meth) != kRegTypeUnknown) {
LOG_VFY("VFY: return-void not expected\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
}
break;
case OP_RETURN:
- okay = checkConstructorReturn(meth, workRegs, insnRegCount);
- if (okay) {
+ if (!checkConstructorReturn(meth, workRegs, insnRegCount)) {
+ failure = VERIFY_ERROR_GENERIC;
+ } else {
/* check the method signature */
RegType returnType = getMethodReturnType(meth);
- checkTypeCategory(returnType, kTypeCategory1nr, &okay);
- if (!okay)
+ checkTypeCategory(returnType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure))
LOG_VFY("VFY: return-32 not expected\n");
/* check the register contents */
returnType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
- checkTypeCategory(returnType, kTypeCategory1nr, &okay);
- if (!okay)
+ &failure);
+ checkTypeCategory(returnType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure))
LOG_VFY("VFY: return-32 on invalid register v%d\n", decInsn.vA);
}
break;
case OP_RETURN_WIDE:
- okay = checkConstructorReturn(meth, workRegs, insnRegCount);
- if (okay) {
+ if (!checkConstructorReturn(meth, workRegs, insnRegCount)) {
+ failure = VERIFY_ERROR_GENERIC;
+ } else {
RegType returnType, returnTypeHi;
/* check the method signature */
returnType = getMethodReturnType(meth);
- checkTypeCategory(returnType, kTypeCategory2, &okay);
- if (!okay)
+ checkTypeCategory(returnType, kTypeCategory2, &failure);
+ if (!VERIFY_OK(failure))
LOG_VFY("VFY: return-wide not expected\n");
/* check the register contents */
returnType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
+ &failure);
returnTypeHi = getRegisterType(workRegs, insnRegCount,
- decInsn.vA +1, &okay);
- if (okay) {
- checkTypeCategory(returnType, kTypeCategory2, &okay);
- checkWidePair(returnType, returnTypeHi, &okay);
+ decInsn.vA +1, &failure);
+ if (VERIFY_OK(failure)) {
+ checkTypeCategory(returnType, kTypeCategory2, &failure);
+ checkWidePair(returnType, returnTypeHi, &failure);
}
- if (!okay) {
+ if (!VERIFY_OK(failure)) {
LOG_VFY("VFY: return-wide on invalid register pair v%d\n",
decInsn.vA);
}
}
break;
case OP_RETURN_OBJECT:
- okay = checkConstructorReturn(meth, workRegs, insnRegCount);
- if (okay) {
+ if (!checkConstructorReturn(meth, workRegs, insnRegCount)) {
+ failure = VERIFY_ERROR_GENERIC;
+ } else {
RegType returnType = getMethodReturnType(meth);
- checkTypeCategory(returnType, kTypeCategoryRef, &okay);
- if (!okay) {
+ checkTypeCategory(returnType, kTypeCategoryRef, &failure);
+ if (!VERIFY_OK(failure)) {
LOG_VFY("VFY: return-object not expected\n");
break;
}
@@ -3371,8 +3397,8 @@
declClass = regTypeInitializedReferenceToClass(returnType);
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vA, &okay);
- if (!okay)
+ decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
if (!dvmIsInterfaceClass(declClass) &&
@@ -3380,7 +3406,7 @@
{
LOG_VFY("VFY: returning %s, declared %s\n",
resClass->descriptor, declClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -3392,12 +3418,12 @@
case OP_CONST:
/* could be boolean, int, float, or a null reference */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dvmDetermineCat1Const((s4)decInsn.vB), &okay);
+ dvmDetermineCat1Const((s4)decInsn.vB), &failure);
break;
case OP_CONST_HIGH16:
/* could be boolean, int, float, or a null reference */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dvmDetermineCat1Const((s4) decInsn.vB << 16), &okay);
+ dvmDetermineCat1Const((s4) decInsn.vB << 16), &failure);
break;
case OP_CONST_WIDE_16:
case OP_CONST_WIDE_32:
@@ -3405,36 +3431,38 @@
case OP_CONST_WIDE_HIGH16:
/* could be long or double; default to long and allow conversion */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- kRegTypeLongLo, &okay);
+ kRegTypeLongLo, &failure);
break;
case OP_CONST_STRING:
case OP_CONST_STRING_JUMBO:
assert(gDvm.classJavaLangString != NULL);
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(gDvm.classJavaLangString), &okay);
+ regTypeFromClass(gDvm.classJavaLangString), &failure);
break;
case OP_CONST_CLASS:
assert(gDvm.classJavaLangClass != NULL);
/* make sure we can resolve the class; access check is important */
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vB);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vB, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vB);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve const-class %d (%s) in %s\n",
decInsn.vB, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else {
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(gDvm.classJavaLangClass), &okay);
+ regTypeFromClass(gDvm.classJavaLangClass), &failure);
}
break;
case OP_MONITOR_ENTER:
case OP_MONITOR_EXIT:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (okay && !regTypeIsReference(tmpType)) {
- LOG_VFY("VFY: monitor op on non-object\n");
- okay = false;
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (VERIFY_OK(failure)) {
+ if (!regTypeIsReference(tmpType)) {
+ LOG_VFY("VFY: monitor op on non-object\n");
+ failure = VERIFY_ERROR_GENERIC;
+ }
}
break;
@@ -3447,67 +3475,67 @@
* If it fails, an exception is thrown, which we deal with later
* by ignoring the update to decInsn.vA when branching to a handler.
*/
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vB);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vB, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vB);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve check-cast %d (%s) in %s\n",
decInsn.vB, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else {
RegType origType;
origType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
if (!regTypeIsReference(origType)) {
LOG_VFY("VFY: check-cast on non-reference in v%u\n",decInsn.vA);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(resClass), &okay);
+ regTypeFromClass(resClass), &failure);
}
break;
case OP_INSTANCE_OF:
/* make sure we're checking a reference type */
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vB, &okay);
- if (!okay)
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (!regTypeIsReference(tmpType)) {
LOG_VFY("VFY: vB not a reference (%d)\n", tmpType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
/* make sure we can resolve the class; access check is important */
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vC);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vC, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vC);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve instanceof %d (%s) in %s\n",
decInsn.vC, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else {
/* result is boolean */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- kRegTypeBoolean, &okay);
+ kRegTypeBoolean, &failure);
}
break;
case OP_ARRAY_LENGTH:
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL && !dvmIsArrayClass(resClass)) {
LOG_VFY("VFY: array-length on non-array\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
setRegisterType(workRegs, insnRegCount, decInsn.vA, kRegTypeInteger,
- &okay);
+ &failure);
break;
case OP_NEW_INSTANCE:
@@ -3517,13 +3545,13 @@
* instructions with a magic "always throw InstantiationError"
* instruction. (Not enough bytes to sub in a method call.)
*/
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vB);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vB, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vB);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve new-instance %d (%s) in %s\n",
decInsn.vB, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else {
RegType uninitType;
@@ -3541,50 +3569,50 @@
/* add the new uninitialized reference to the register ste */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- uninitType, &okay);
+ uninitType, &failure);
}
break;
case OP_NEW_ARRAY:
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vC);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vC, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vC);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve new-array %d (%s) in %s\n",
decInsn.vC, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else if (!dvmIsArrayClass(resClass)) {
LOG_VFY("VFY: new-array on non-array class\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
} else {
/* make sure "size" register is valid type */
verifyRegisterType(workRegs, insnRegCount, decInsn.vB,
- kRegTypeInteger, &okay);
+ kRegTypeInteger, &failure);
/* set register type to array class */
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(resClass), &okay);
+ regTypeFromClass(resClass), &failure);
}
break;
case OP_FILLED_NEW_ARRAY:
case OP_FILLED_NEW_ARRAY_RANGE:
- resClass = dvmOptResolveClass(meth->clazz, decInsn.vB);
+ resClass = dvmOptResolveClass(meth->clazz, decInsn.vB, &failure);
if (resClass == NULL) {
const char* badClassDesc = dexStringByTypeIdx(pDexFile, decInsn.vB);
dvmLogUnableToResolveClass(badClassDesc, meth);
LOG_VFY("VFY: unable to resolve filled-array %d (%s) in %s\n",
decInsn.vB, badClassDesc, meth->clazz->descriptor);
- okay = false;
+ assert(failure != VERIFY_ERROR_GENERIC);
} else if (!dvmIsArrayClass(resClass)) {
LOG_VFY("VFY: filled-new-array on non-array class\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
} else {
bool isRange = (decInsn.opCode == OP_FILLED_NEW_ARRAY_RANGE);
/* check the arguments to the instruction */
verifyFilledNewArrayRegs(meth, workRegs, insnRegCount, &decInsn,
- resClass, isRange, &okay);
+ resClass, isRange, &failure);
/* filled-array result goes into "result" register */
setResultRegisterType(workRegs, insnRegCount,
- regTypeFromClass(resClass), &okay);
+ regTypeFromClass(resClass), &failure);
justSetResult = true;
}
break;
@@ -3592,38 +3620,38 @@
case OP_CMPL_FLOAT:
case OP_CMPG_FLOAT:
verifyRegisterType(workRegs, insnRegCount, decInsn.vB, kRegTypeFloat,
- &okay);
+ &failure);
verifyRegisterType(workRegs, insnRegCount, decInsn.vC, kRegTypeFloat,
- &okay);
+ &failure);
setRegisterType(workRegs, insnRegCount, decInsn.vA, kRegTypeBoolean,
- &okay);
+ &failure);
break;
case OP_CMPL_DOUBLE:
case OP_CMPG_DOUBLE:
verifyRegisterType(workRegs, insnRegCount, decInsn.vB, kRegTypeDoubleLo,
- &okay);
+ &failure);
verifyRegisterType(workRegs, insnRegCount, decInsn.vC, kRegTypeDoubleLo,
- &okay);
+ &failure);
setRegisterType(workRegs, insnRegCount, decInsn.vA, kRegTypeBoolean,
- &okay);
+ &failure);
break;
case OP_CMP_LONG:
verifyRegisterType(workRegs, insnRegCount, decInsn.vB, kRegTypeLongLo,
- &okay);
+ &failure);
verifyRegisterType(workRegs, insnRegCount, decInsn.vC, kRegTypeLongLo,
- &okay);
+ &failure);
setRegisterType(workRegs, insnRegCount, decInsn.vA, kRegTypeBoolean,
- &okay);
+ &failure);
break;
case OP_THROW:
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vA, &okay);
- if (okay && resClass != NULL) {
+ decInsn.vA, &failure);
+ if (VERIFY_OK(failure) && resClass != NULL) {
if (!dvmInstanceof(resClass, gDvm.classJavaLangThrowable)) {
LOG_VFY("VFY: thrown class %s not instanceof Throwable\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
}
}
break;
@@ -3638,7 +3666,7 @@
case OP_SPARSE_SWITCH:
/* verify that vAA is an integer, or can be converted to one */
verifyRegisterType(workRegs, insnRegCount, decInsn.vA,
- kRegTypeInteger, &okay);
+ kRegTypeInteger, &failure);
break;
case OP_FILL_ARRAY_DATA:
@@ -3649,8 +3677,8 @@
/* Similar to the verification done for APUT */
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vA, &okay);
- if (!okay)
+ decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
/* resClass can be null if the reg type is Zero */
@@ -3663,7 +3691,7 @@
{
LOG_VFY("VFY: invalid fill-array-data on %s\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -3678,7 +3706,7 @@
arrayData = insns + (insns[1] | (((s4)insns[2]) << 16));
if (arrayData[0] != kArrayDataSignature) {
LOG_VFY("VFY: invalid magic for array-data\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -3712,7 +3740,7 @@
if (arrayData[1] != elemWidth) {
LOG_VFY("VFY: array-data size mismatch (%d vs %d)\n",
arrayData[1], elemWidth);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
}
}
break;
@@ -3723,9 +3751,11 @@
RegType type1, type2;
bool tmpResult;
- type1 = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- type2 = getRegisterType(workRegs, insnRegCount, decInsn.vB, &okay);
- if (!okay)
+ type1 = getRegisterType(workRegs, insnRegCount, decInsn.vA,
+ &failure);
+ type2 = getRegisterType(workRegs, insnRegCount, decInsn.vB,
+ &failure);
+ if (!VERIFY_OK(failure))
break;
/* both references? */
@@ -3733,9 +3763,9 @@
break;
/* both category-1nr? */
- checkTypeCategory(type1, kTypeCategory1nr, &okay);
- checkTypeCategory(type2, kTypeCategory1nr, &okay);
- if (!okay) {
+ checkTypeCategory(type1, kTypeCategory1nr, &failure);
+ checkTypeCategory(type2, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure)) {
LOG_VFY("VFY: args to if-eq/if-ne must both be refs or cat1\n");
break;
}
@@ -3745,43 +3775,43 @@
case OP_IF_GE:
case OP_IF_GT:
case OP_IF_LE:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (!okay)
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkTypeCategory(tmpType, kTypeCategory1nr, &okay);
- if (!okay) {
+ checkTypeCategory(tmpType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure)) {
LOG_VFY("VFY: args to 'if' must be cat-1nr\n");
break;
}
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vB,&okay);
- if (!okay)
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkTypeCategory(tmpType, kTypeCategory1nr, &okay);
- if (!okay) {
+ checkTypeCategory(tmpType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure)) {
LOG_VFY("VFY: args to 'if' must be cat-1nr\n");
break;
}
break;
case OP_IF_EQZ:
case OP_IF_NEZ:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (!okay)
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
if (regTypeIsReference(tmpType))
break;
- checkTypeCategory(tmpType, kTypeCategory1nr, &okay);
- if (!okay)
+ checkTypeCategory(tmpType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure))
LOG_VFY("VFY: expected cat-1 arg to if\n");
break;
case OP_IF_LTZ:
case OP_IF_GEZ:
case OP_IF_GTZ:
case OP_IF_LEZ:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (!okay)
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkTypeCategory(tmpType, kTypeCategory1nr, &okay);
- if (!okay)
+ checkTypeCategory(tmpType, kTypeCategory1nr, &failure);
+ if (!VERIFY_OK(failure))
LOG_VFY("VFY: expected cat-1 arg to if\n");
break;
@@ -3805,14 +3835,14 @@
RegType srcType, indexType;
indexType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, indexType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, indexType, &failure);
+ if (!VERIFY_OK(failure))
break;
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
/* verify the class */
@@ -3821,7 +3851,7 @@
{
LOG_VFY("VFY: invalid aget-1nr target %s\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -3833,13 +3863,13 @@
LOG_VFY("VFY: invalid aget-1nr, array type=%d with"
" inst type=%d (on %s)\n",
srcType, tmpType, resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- tmpType, &okay);
+ tmpType, &failure);
}
break;
@@ -3848,14 +3878,14 @@
RegType dstType, indexType;
indexType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, indexType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, indexType, &failure);
+ if (!VERIFY_OK(failure))
break;
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
/* verify the class */
@@ -3864,7 +3894,7 @@
{
LOG_VFY("VFY: invalid aget-wide target %s\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -3880,7 +3910,7 @@
LOG_VFY("VFY: invalid aget-wide on %s\n",
resClass->descriptor);
dstType = kRegTypeUnknown;
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
} else {
@@ -3893,7 +3923,7 @@
dstType = kRegTypeLongLo;
}
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dstType, &okay);
+ dstType, &failure);
}
break;
@@ -3902,15 +3932,15 @@
RegType dstType, indexType;
indexType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, indexType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, indexType, &failure);
+ if (!VERIFY_OK(failure))
break;
/* get the class of the array we're pulling an object from */
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
ClassObject* elementClass;
@@ -3918,7 +3948,7 @@
assert(resClass != NULL);
if (!dvmIsArrayClass(resClass)) {
LOG_VFY("VFY: aget-object on non-array class\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
assert(resClass->elementClass != NULL);
@@ -3938,7 +3968,7 @@
} else {
LOG_VFY("VFY: aget-object on non-ref array class (%s)\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -3954,7 +3984,7 @@
dstType = kRegTypeZero;
}
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dstType, &okay);
+ dstType, &failure);
}
break;
case OP_APUT:
@@ -3977,24 +4007,24 @@
RegType srcType, dstType, indexType;
indexType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, indexType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, indexType, &failure);
+ if (!VERIFY_OK(failure))
break;
/* make sure the source register has the correct type */
srcType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
+ &failure);
if (!canConvertTo1nr(srcType, tmpType)) {
LOG_VFY("VFY: invalid reg type %d on aput instr (need %d)\n",
srcType, tmpType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
/* resClass can be null if the reg type is Zero */
@@ -4005,7 +4035,7 @@
resClass->elementClass->primitiveType == PRIM_NOT)
{
LOG_VFY("VFY: invalid aput-1nr on %s\n", resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4017,31 +4047,31 @@
if (!checkFieldArrayStore1nr(tmpType, dstType)) {
LOG_VFY("VFY: invalid aput-1nr on %s (inst=%d dst=%d)\n",
resClass->descriptor, tmpType, dstType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
break;
case OP_APUT_WIDE:
tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, tmpType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, tmpType, &failure);
+ if (!VERIFY_OK(failure))
break;
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (okay) {
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (VERIFY_OK(failure)) {
RegType typeHi =
- getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &okay);
- checkTypeCategory(tmpType, kTypeCategory2, &okay);
- checkWidePair(tmpType, typeHi, &okay);
+ getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &failure);
+ checkTypeCategory(tmpType, kTypeCategory2, &failure);
+ checkWidePair(tmpType, typeHi, &failure);
}
- if (!okay)
+ if (!VERIFY_OK(failure))
break;
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
- if (!okay)
+ decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
/* verify the class and try to refine "dstType" */
@@ -4050,7 +4080,7 @@
{
LOG_VFY("VFY: invalid aput-wide on %s\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4062,22 +4092,22 @@
default:
LOG_VFY("VFY: invalid aput-wide on %s\n",
resClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
break;
case OP_APUT_OBJECT:
tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vC,
- &okay);
- checkArrayIndexType(meth, tmpType, &okay);
- if (!okay)
+ &failure);
+ checkArrayIndexType(meth, tmpType, &failure);
+ if (!VERIFY_OK(failure))
break;
/* get the ref we're storing; Zero is okay, Uninit is not */
resClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vA, &okay);
- if (!okay)
+ decInsn.vA, &failure);
+ if (!VERIFY_OK(failure))
break;
if (resClass != NULL) {
ClassObject* arrayClass;
@@ -4089,14 +4119,14 @@
* null pointer exception).
*/
arrayClass = getClassFromRegister(workRegs, insnRegCount,
- decInsn.vB, &okay);
+ decInsn.vB, &failure);
if (arrayClass != NULL) {
/* see if the array holds a compatible type */
if (!dvmIsArrayClass(arrayClass)) {
LOG_VFY("VFY: invalid aput-object on %s\n",
arrayClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4121,7 +4151,7 @@
if (elementClass->primitiveType != PRIM_NOT) {
LOG_VFY("VFY: invalid aput-object of %s into %s\n",
resClass->descriptor, arrayClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4150,12 +4180,12 @@
RegType objType, fieldType;
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
/* make sure the field's type is compatible with expectation */
@@ -4166,11 +4196,12 @@
LOG_VFY("VFY: invalid iget-1nr of %s.%s (inst=%d field=%d)\n",
instField->field.clazz->descriptor,
instField->field.name, tmpType, fieldType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- setRegisterType(workRegs, insnRegCount, decInsn.vA, tmpType, &okay);
+ setRegisterType(workRegs, insnRegCount, decInsn.vA, tmpType,
+ &failure);
}
break;
case OP_IGET_WIDE:
@@ -4181,12 +4212,12 @@
RegType objType;
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
/* check the type, which should be prim */
switch (instField->field.signature[0]) {
@@ -4201,12 +4232,12 @@
instField->field.clazz->descriptor,
instField->field.name);
dstType = kRegTypeUnknown;
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- if (okay) {
+ if (VERIFY_OK(failure)) {
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dstType, &okay);
+ dstType, &failure);
}
}
break;
@@ -4217,25 +4248,25 @@
RegType objType;
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
fieldClass = getFieldClass(meth, &instField->field);
if (fieldClass == NULL) {
/* class not found or primitive type */
LOG_VFY("VFY: unable to recover field class from '%s'\n",
instField->field.signature);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- if (okay) {
+ if (VERIFY_OK(failure)) {
assert(!dvmIsPrimitiveClass(fieldClass));
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(fieldClass), &okay);
+ regTypeFromClass(fieldClass), &failure);
}
}
break;
@@ -4262,24 +4293,24 @@
/* make sure the source register has the correct type */
srcType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
+ &failure);
if (!canConvertTo1nr(srcType, tmpType)) {
LOG_VFY("VFY: invalid reg type %d on iput instr (need %d)\n",
srcType, tmpType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &instField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &instField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
/* get type of field we're storing into */
@@ -4290,34 +4321,34 @@
LOG_VFY("VFY: invalid iput-1nr of %s.%s (inst=%d field=%d)\n",
instField->field.clazz->descriptor,
instField->field.name, tmpType, fieldType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
break;
case OP_IPUT_WIDE:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (okay) {
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (VERIFY_OK(failure)) {
RegType typeHi =
- getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &okay);
- checkTypeCategory(tmpType, kTypeCategory2, &okay);
- checkWidePair(tmpType, typeHi, &okay);
+ getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &failure);
+ checkTypeCategory(tmpType, kTypeCategory2, &failure);
+ checkWidePair(tmpType, typeHi, &failure);
}
- if (okay) {
+ if (VERIFY_OK(failure)) {
ClassObject* fieldClass;
InstField* instField;
RegType objType;
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &instField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &instField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
/* check the type, which should be prim */
@@ -4330,7 +4361,7 @@
LOG_VFY("VFY: invalid iput-wide of %s.%s\n",
instField->field.clazz->descriptor,
instField->field.name);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4343,34 +4374,34 @@
RegType objType, valueType;
objType = getRegisterType(workRegs, insnRegCount, decInsn.vB,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
instField = getInstField(meth, uninitMap, objType, decInsn.vC,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &instField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &instField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
fieldClass = getFieldClass(meth, &instField->field);
if (fieldClass == NULL) {
LOG_VFY("VFY: unable to recover field class from '%s'\n",
instField->field.signature);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
valueType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
if (!regTypeIsReference(valueType)) {
LOG_VFY("VFY: storing non-ref v%d into ref field '%s' (%s)\n",
decInsn.vA, instField->field.name,
fieldClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
if (valueType != kRegTypeZero) {
@@ -4378,7 +4409,7 @@
if (valueClass == NULL) {
LOG_VFY("VFY: storing uninit ref v%d into ref field\n",
decInsn.vA);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
/* allow if field is any interface or field is base class */
@@ -4389,7 +4420,7 @@
valueClass->descriptor, fieldClass->descriptor,
instField->field.clazz->descriptor,
instField->field.name);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4416,8 +4447,8 @@
StaticField* staticField;
RegType fieldType;
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
/*
@@ -4433,11 +4464,12 @@
LOG_VFY("VFY: invalid sget-1nr of %s.%s (inst=%d actual=%d)\n",
staticField->field.clazz->descriptor,
staticField->field.name, tmpType, fieldType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- setRegisterType(workRegs, insnRegCount, decInsn.vA, tmpType, &okay);
+ setRegisterType(workRegs, insnRegCount, decInsn.vA, tmpType,
+ &failure);
}
break;
case OP_SGET_WIDE:
@@ -4445,8 +4477,8 @@
StaticField* staticField;
RegType dstType;
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
/* check the type, which should be prim */
switch (staticField->field.signature[0]) {
@@ -4461,12 +4493,12 @@
staticField->field.clazz->descriptor,
staticField->field.name);
dstType = kRegTypeUnknown;
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- if (okay) {
+ if (VERIFY_OK(failure)) {
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- dstType, &okay);
+ dstType, &failure);
}
}
break;
@@ -4475,23 +4507,23 @@
StaticField* staticField;
ClassObject* fieldClass;
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
fieldClass = getFieldClass(meth, &staticField->field);
if (fieldClass == NULL) {
LOG_VFY("VFY: unable to recover field class from '%s'\n",
staticField->field.signature);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
if (dvmIsPrimitiveClass(fieldClass)) {
LOG_VFY("VFY: attempt to get prim field with sget-object\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
setRegisterType(workRegs, insnRegCount, decInsn.vA,
- regTypeFromClass(fieldClass), &okay);
+ regTypeFromClass(fieldClass), &failure);
}
break;
case OP_SPUT:
@@ -4516,19 +4548,19 @@
/* make sure the source register has the correct type */
srcType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
+ &failure);
if (!canConvertTo1nr(srcType, tmpType)) {
LOG_VFY("VFY: invalid reg type %d on iput instr (need %d)\n",
srcType, tmpType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &staticField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &staticField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
/*
@@ -4543,27 +4575,27 @@
LOG_VFY("VFY: invalid sput-1nr of %s.%s (inst=%d actual=%d)\n",
staticField->field.clazz->descriptor,
staticField->field.name, tmpType, fieldType);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
break;
case OP_SPUT_WIDE:
- tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &okay);
- if (okay) {
+ tmpType = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure);
+ if (VERIFY_OK(failure)) {
RegType typeHi =
- getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &okay);
- checkTypeCategory(tmpType, kTypeCategory2, &okay);
- checkWidePair(tmpType, typeHi, &okay);
+ getRegisterType(workRegs, insnRegCount, decInsn.vA+1, &failure);
+ checkTypeCategory(tmpType, kTypeCategory2, &failure);
+ checkWidePair(tmpType, typeHi, &failure);
}
- if (okay) {
+ if (VERIFY_OK(failure)) {
StaticField* staticField;
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &staticField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &staticField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
/* check the type, which should be prim */
@@ -4576,7 +4608,7 @@
LOG_VFY("VFY: invalid sput-wide of %s.%s\n",
staticField->field.clazz->descriptor,
staticField->field.name);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4588,30 +4620,30 @@
StaticField* staticField;
RegType valueType;
- staticField = getStaticField(meth, decInsn.vB, &okay);
- if (!okay)
+ staticField = getStaticField(meth, decInsn.vB, &failure);
+ if (!VERIFY_OK(failure))
break;
- checkFinalFieldAccess(meth, &staticField->field, &okay);
- if (!okay)
+ checkFinalFieldAccess(meth, &staticField->field, &failure);
+ if (!VERIFY_OK(failure))
break;
fieldClass = getFieldClass(meth, &staticField->field);
if (fieldClass == NULL) {
LOG_VFY("VFY: unable to recover field class from '%s'\n",
staticField->field.signature);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
valueType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
- &okay);
- if (!okay)
+ &failure);
+ if (!VERIFY_OK(failure))
break;
if (!regTypeIsReference(valueType)) {
LOG_VFY("VFY: storing non-ref v%d into ref field '%s' (%s)\n",
decInsn.vA, staticField->field.name,
fieldClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
if (valueType != kRegTypeZero) {
@@ -4619,7 +4651,7 @@
if (valueClass == NULL) {
LOG_VFY("VFY: storing uninit ref v%d into ref field\n",
decInsn.vA);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
/* allow if field is any interface or field is base class */
@@ -4630,7 +4662,7 @@
valueClass->descriptor, fieldClass->descriptor,
staticField->field.clazz->descriptor,
staticField->field.name);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4654,11 +4686,11 @@
calledMethod = verifyInvocationArgs(meth, workRegs, insnRegCount,
&decInsn, uninitMap, METHOD_VIRTUAL, isRange,
- isSuper, &okay);
- if (!okay)
+ isSuper, &failure);
+ if (!VERIFY_OK(failure))
break;
returnType = getMethodReturnType(calledMethod);
- setResultRegisterType(workRegs, insnRegCount, returnType, &okay);
+ setResultRegisterType(workRegs, insnRegCount, returnType, &failure);
justSetResult = true;
}
break;
@@ -4672,8 +4704,8 @@
isRange = (decInsn.opCode == OP_INVOKE_DIRECT_RANGE);
calledMethod = verifyInvocationArgs(meth, workRegs, insnRegCount,
&decInsn, uninitMap, METHOD_DIRECT, isRange,
- false, &okay);
- if (!okay)
+ false, &failure);
+ if (!VERIFY_OK(failure))
break;
/*
@@ -4688,14 +4720,14 @@
if (isInitMethod(calledMethod)) {
RegType thisType;
thisType = getInvocationThis(workRegs, insnRegCount,
- &decInsn, &okay);
- if (!okay)
+ &decInsn, &failure);
+ if (!VERIFY_OK(failure))
break;
/* no null refs allowed (?) */
if (thisType == kRegTypeZero) {
LOG_VFY("VFY: unable to initialize null ref\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4709,20 +4741,20 @@
if (thisClass != meth->clazz) {
LOG_VFY("VFY: invoke-direct <init> on super only "
"allowed for 'this' in <init>");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
} else if (calledMethod->clazz != thisClass) {
LOG_VFY("VFY: invoke-direct <init> must be on current "
"class or super\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
/* arg must be an uninitialized reference */
if (!regTypeIsUninitReference(thisType)) {
LOG_VFY("VFY: can only initialize the uninitialized\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4734,13 +4766,13 @@
*/
int uidx = regTypeToUninitIndex(thisType);
markRefsAsInitialized(workRegs, insnRegCount, uninitMap,
- thisType, &okay);
- if (!okay)
+ thisType, &failure);
+ if (!VERIFY_OK(failure))
break;
}
returnType = getMethodReturnType(calledMethod);
setResultRegisterType(workRegs, insnRegCount,
- returnType, &okay);
+ returnType, &failure);
justSetResult = true;
}
break;
@@ -4754,12 +4786,12 @@
isRange = (decInsn.opCode == OP_INVOKE_STATIC_RANGE);
calledMethod = verifyInvocationArgs(meth, workRegs, insnRegCount,
&decInsn, uninitMap, METHOD_STATIC, isRange,
- false, &okay);
- if (!okay)
+ false, &failure);
+ if (!VERIFY_OK(failure))
break;
returnType = getMethodReturnType(calledMethod);
- setResultRegisterType(workRegs, insnRegCount, returnType, &okay);
+ setResultRegisterType(workRegs, insnRegCount, returnType, &failure);
justSetResult = true;
}
break;
@@ -4773,8 +4805,8 @@
isRange = (decInsn.opCode == OP_INVOKE_INTERFACE_RANGE);
absMethod = verifyInvocationArgs(meth, workRegs, insnRegCount,
&decInsn, uninitMap, METHOD_INTERFACE, isRange,
- false, &okay);
- if (!okay)
+ false, &failure);
+ if (!VERIFY_OK(failure))
break;
#if 0 /* can't do this here, fails on dalvik test 052-verifier-fun */
@@ -4784,8 +4816,8 @@
* interface classes, this might have reduced to Object.
*/
thisType = getInvocationThis(workRegs, insnRegCount,
- &decInsn, &okay);
- if (!okay)
+ &decInsn, &failure);
+ if (!VERIFY_OK(failure))
break;
if (thisType == kRegTypeZero) {
@@ -4796,7 +4828,7 @@
thisClass = regTypeInitializedReferenceToClass(thisType);
if (thisClass == NULL) {
LOG_VFY("VFY: interface call on uninitialized\n");
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
@@ -4812,7 +4844,7 @@
{
LOG_VFY("VFY: unable to match absMethod '%s' with %s interfaces\n",
absMethod->name, thisClass->descriptor);
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
}
}
@@ -4824,7 +4856,7 @@
* in the abstract method, so we're good.
*/
returnType = getMethodReturnType(absMethod);
- setResultRegisterType(workRegs, insnRegCount, returnType, &okay);
+ setResultRegisterType(workRegs, insnRegCount, returnType, &failure);
justSetResult = true;
}
break;
@@ -4832,80 +4864,80 @@
case OP_NEG_INT:
case OP_NOT_INT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, &okay);
+ kRegTypeInteger, kRegTypeInteger, &failure);
break;
case OP_NEG_LONG:
case OP_NOT_LONG:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeLongLo, &okay);
+ kRegTypeLongLo, kRegTypeLongLo, &failure);
break;
case OP_NEG_FLOAT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeFloat, &okay);
+ kRegTypeFloat, kRegTypeFloat, &failure);
break;
case OP_NEG_DOUBLE:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeDoubleLo, &okay);
+ kRegTypeDoubleLo, kRegTypeDoubleLo, &failure);
break;
case OP_INT_TO_LONG:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeInteger, &okay);
+ kRegTypeLongLo, kRegTypeInteger, &failure);
break;
case OP_INT_TO_FLOAT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeInteger, &okay);
+ kRegTypeFloat, kRegTypeInteger, &failure);
break;
case OP_INT_TO_DOUBLE:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeInteger, &okay);
+ kRegTypeDoubleLo, kRegTypeInteger, &failure);
break;
case OP_LONG_TO_INT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeLongLo, &okay);
+ kRegTypeInteger, kRegTypeLongLo, &failure);
break;
case OP_LONG_TO_FLOAT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeLongLo, &okay);
+ kRegTypeFloat, kRegTypeLongLo, &failure);
break;
case OP_LONG_TO_DOUBLE:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeLongLo, &okay);
+ kRegTypeDoubleLo, kRegTypeLongLo, &failure);
break;
case OP_FLOAT_TO_INT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeFloat, &okay);
+ kRegTypeInteger, kRegTypeFloat, &failure);
break;
case OP_FLOAT_TO_LONG:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeFloat, &okay);
+ kRegTypeLongLo, kRegTypeFloat, &failure);
break;
case OP_FLOAT_TO_DOUBLE:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeFloat, &okay);
+ kRegTypeDoubleLo, kRegTypeFloat, &failure);
break;
case OP_DOUBLE_TO_INT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeDoubleLo, &okay);
+ kRegTypeInteger, kRegTypeDoubleLo, &failure);
break;
case OP_DOUBLE_TO_LONG:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeDoubleLo, &okay);
+ kRegTypeLongLo, kRegTypeDoubleLo, &failure);
break;
case OP_DOUBLE_TO_FLOAT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeDoubleLo, &okay);
+ kRegTypeFloat, kRegTypeDoubleLo, &failure);
break;
case OP_INT_TO_BYTE:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeByte, kRegTypeInteger, &okay);
+ kRegTypeByte, kRegTypeInteger, &failure);
break;
case OP_INT_TO_CHAR:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeChar, kRegTypeInteger, &okay);
+ kRegTypeChar, kRegTypeInteger, &failure);
break;
case OP_INT_TO_SHORT:
checkUnop(workRegs, insnRegCount, &decInsn,
- kRegTypeShort, kRegTypeInteger, &okay);
+ kRegTypeShort, kRegTypeInteger, &failure);
break;
case OP_ADD_INT:
@@ -4917,13 +4949,13 @@
case OP_SHR_INT:
case OP_USHR_INT:
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &okay);
+ kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &failure);
break;
case OP_AND_INT:
case OP_OR_INT:
case OP_XOR_INT:
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, true, &okay);
+ kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, true, &failure);
break;
case OP_ADD_LONG:
case OP_SUB_LONG:
@@ -4934,14 +4966,14 @@
case OP_OR_LONG:
case OP_XOR_LONG:
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeLongLo, kRegTypeLongLo, false, &okay);
+ kRegTypeLongLo, kRegTypeLongLo, kRegTypeLongLo, false, &failure);
break;
case OP_SHL_LONG:
case OP_SHR_LONG:
case OP_USHR_LONG:
/* shift distance is Int, making these different from other binops */
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeLongLo, kRegTypeInteger, false, &okay);
+ kRegTypeLongLo, kRegTypeLongLo, kRegTypeInteger, false, &failure);
break;
case OP_ADD_FLOAT:
case OP_SUB_FLOAT:
@@ -4949,7 +4981,7 @@
case OP_DIV_FLOAT:
case OP_REM_FLOAT:
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeFloat, kRegTypeFloat, false, &okay);
+ kRegTypeFloat, kRegTypeFloat, kRegTypeFloat, false, &failure);
break;
case OP_ADD_DOUBLE:
case OP_SUB_DOUBLE:
@@ -4957,7 +4989,8 @@
case OP_DIV_DOUBLE:
case OP_REM_DOUBLE:
checkBinop(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeDoubleLo, kRegTypeDoubleLo, false, &okay);
+ kRegTypeDoubleLo, kRegTypeDoubleLo, kRegTypeDoubleLo, false,
+ &failure);
break;
case OP_ADD_INT_2ADDR:
case OP_SUB_INT_2ADDR:
@@ -4967,17 +5000,17 @@
case OP_SHR_INT_2ADDR:
case OP_USHR_INT_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &okay);
+ kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &failure);
break;
case OP_AND_INT_2ADDR:
case OP_OR_INT_2ADDR:
case OP_XOR_INT_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, true, &okay);
+ kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, true, &failure);
break;
case OP_DIV_INT_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &okay);
+ kRegTypeInteger, kRegTypeInteger, kRegTypeInteger, false, &failure);
break;
case OP_ADD_LONG_2ADDR:
case OP_SUB_LONG_2ADDR:
@@ -4988,13 +5021,13 @@
case OP_OR_LONG_2ADDR:
case OP_XOR_LONG_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeLongLo, kRegTypeLongLo, false, &okay);
+ kRegTypeLongLo, kRegTypeLongLo, kRegTypeLongLo, false, &failure);
break;
case OP_SHL_LONG_2ADDR:
case OP_SHR_LONG_2ADDR:
case OP_USHR_LONG_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeLongLo, kRegTypeLongLo, kRegTypeInteger, false, &okay);
+ kRegTypeLongLo, kRegTypeLongLo, kRegTypeInteger, false, &failure);
break;
case OP_ADD_FLOAT_2ADDR:
case OP_SUB_FLOAT_2ADDR:
@@ -5002,7 +5035,7 @@
case OP_DIV_FLOAT_2ADDR:
case OP_REM_FLOAT_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeFloat, kRegTypeFloat, kRegTypeFloat, false, &okay);
+ kRegTypeFloat, kRegTypeFloat, kRegTypeFloat, false, &failure);
break;
case OP_ADD_DOUBLE_2ADDR:
case OP_SUB_DOUBLE_2ADDR:
@@ -5010,7 +5043,8 @@
case OP_DIV_DOUBLE_2ADDR:
case OP_REM_DOUBLE_2ADDR:
checkBinop2addr(workRegs, insnRegCount, &decInsn,
- kRegTypeDoubleLo, kRegTypeDoubleLo, kRegTypeDoubleLo, false, &okay);
+ kRegTypeDoubleLo, kRegTypeDoubleLo, kRegTypeDoubleLo, false,
+ &failure);
break;
case OP_ADD_INT_LIT16:
case OP_RSUB_INT:
@@ -5018,13 +5052,13 @@
case OP_DIV_INT_LIT16:
case OP_REM_INT_LIT16:
checkLitop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, false, &okay);
+ kRegTypeInteger, kRegTypeInteger, false, &failure);
break;
case OP_AND_INT_LIT16:
case OP_OR_INT_LIT16:
case OP_XOR_INT_LIT16:
checkLitop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, true, &okay);
+ kRegTypeInteger, kRegTypeInteger, true, &failure);
break;
case OP_ADD_INT_LIT8:
case OP_RSUB_INT_LIT8:
@@ -5035,13 +5069,13 @@
case OP_SHR_INT_LIT8:
case OP_USHR_INT_LIT8:
checkLitop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, false, &okay);
+ kRegTypeInteger, kRegTypeInteger, false, &failure);
break;
case OP_AND_INT_LIT8:
case OP_OR_INT_LIT8:
case OP_XOR_INT_LIT8:
checkLitop(workRegs, insnRegCount, &decInsn,
- kRegTypeInteger, kRegTypeInteger, true, &okay);
+ kRegTypeInteger, kRegTypeInteger, true, &failure);
break;
@@ -5089,7 +5123,7 @@
case OP_INVOKE_VIRTUAL_QUICK_RANGE:
case OP_INVOKE_SUPER_QUICK:
case OP_INVOKE_SUPER_QUICK_RANGE:
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
/* these should never appear */
@@ -5119,7 +5153,7 @@
case OP_UNUSED_FD:
case OP_UNUSED_FE:
case OP_UNUSED_FF:
- okay = false;
+ failure = VERIFY_ERROR_GENERIC;
break;
/*
@@ -5128,7 +5162,7 @@
*/
}
- if (!okay) {
+ if (!VERIFY_OK(failure)) {
LOG_VFY_METH(meth, "VFY: rejecting opcode 0x%02x at 0x%04x\n",
decInsn.opCode, insnIdx);
goto bail;
@@ -5173,13 +5207,11 @@
updateRegisters(meth, insnFlags, regTable, insnIdx+insnWidth,
workRegs);
} else {
- /* if not yet visited, or regs were updated, set "changed" */
- if (!dvmInsnIsVisited(insnFlags, insnIdx+insnWidth) ||
- compareRegisters(workRegs, entryRegs,
- insnRegCount + kExtraRegs) != 0)
- {
- dvmInsnSetChanged(insnFlags, insnIdx+insnWidth, true);
- }
+ /*
+ * We didn't record register data for the next entry, so we have
+ * to assume that something has changed and re-evaluate it.
+ */
+ dvmInsnSetChanged(insnFlags, insnIdx+insnWidth, true);
}
}
@@ -5209,6 +5241,7 @@
if (!checkMoveException(meth, insnIdx+branchTarget, "branch"))
goto bail;
+ /* update branch target, set "changed" if appropriate */
updateRegisters(meth, insnFlags, regTable, insnIdx+branchTarget,
workRegs);
}
diff --git a/vm/analysis/CodeVerify.h b/vm/analysis/CodeVerify.h
index 0cd4638..55fe41c 100644
--- a/vm/analysis/CodeVerify.h
+++ b/vm/analysis/CodeVerify.h
@@ -198,10 +198,10 @@
return (insnFlags[addr] & kInsnFlagGcPoint) != 0;
}
INLINE void dvmInsnSetGcPoint(InsnFlags* insnFlags, int addr,
- bool isBranch)
+ bool isGcPoint)
{
- assert(isBranch);
- //if (isBranch)
+ assert(isGcPoint);
+ //if (isGcPoint)
insnFlags[addr] |= kInsnFlagGcPoint;
//else
// insnFlags[addr] &= ~kInsnFlagGcPoint;
diff --git a/vm/analysis/DexOptimize.c b/vm/analysis/DexOptimize.c
index d086b99..d420043 100644
--- a/vm/analysis/DexOptimize.c
+++ b/vm/analysis/DexOptimize.c
@@ -25,6 +25,7 @@
#include "Dalvik.h"
#include "libdex/InstrUtils.h"
#include "libdex/OptInvocation.h"
+#include "analysis/RegisterMap.h"
#include <zlib.h>
@@ -50,7 +51,7 @@
/* fwd */
static int writeDependencies(int fd, u4 modWhen, u4 crc);
static bool writeAuxData(int fd, const DexClassLookup* pClassLookup,\
- const IndexMapSet* pIndexMapSet);
+ const IndexMapSet* pIndexMapSet, const RegisterMapBuilder* pRegMapBuilder);
static void logFailedWrite(size_t expected, ssize_t actual, const char* msg,
int err);
@@ -365,6 +366,9 @@
char* androidRoot;
int flags;
+ /* change process groups, so we don't clash with ProcessManager */
+ setpgid(0, 0);
+
/* full path to optimizer */
androidRoot = getenv("ANDROID_ROOT");
if (androidRoot == NULL) {
@@ -506,6 +510,7 @@
{
DexClassLookup* pClassLookup = NULL;
IndexMapSet* pIndexMapSet = NULL;
+ RegisterMapBuilder* pRegMapBuilder = NULL;
bool doVerify, doOpt;
u4 headerFlags = 0;
@@ -566,6 +571,13 @@
* Rewrite the file. Byte reordering, structure realigning,
* class verification, and bytecode optimization are all performed
* here.
+ *
+ * In theory the file could change size and bits could shift around.
+ * In practice this would be annoying to deal with, so the file
+ * layout is designed so that it can always be rewritten in place.
+ *
+ * This sets "headerFlags" and creates the class lookup table as
+ * part of doing the processing.
*/
success = rewriteDex(((u1*) mapAddr) + dexOffset, dexLength,
doVerify, doOpt, &headerFlags, &pClassLookup);
@@ -576,6 +588,7 @@
if (dvmDexFileOpenPartial(dexAddr, dexLength, &pDvmDex) != 0) {
LOGE("Unable to create DexFile\n");
+ success = false;
} else {
/*
* If configured to do so, scan the instructions, looking
@@ -586,6 +599,18 @@
*/
pIndexMapSet = dvmRewriteConstants(pDvmDex);
+ /*
+ * If configured to do so, generate a full set of register
+ * maps for all verified classes.
+ */
+ if (gDvm.generateRegisterMaps) {
+ pRegMapBuilder = dvmGenerateRegisterMaps(pDvmDex);
+ if (pRegMapBuilder == NULL) {
+ LOGE("Failed generating register maps\n");
+ success = false;
+ }
+ }
+
updateChecksum(dexAddr, dexLength,
(DexHeader*) pDvmDex->pHeader);
@@ -640,8 +665,7 @@
goto bail;
}
-
- /* compute deps length, and adjust aux start for 64-bit alignment */
+ /* compute deps length, then adjust aux start for 64-bit alignment */
auxOffset = lseek(fd, 0, SEEK_END);
depsLength = auxOffset - depsOffset;
@@ -656,7 +680,7 @@
/*
* Append any auxillary pre-computed data structures.
*/
- if (!writeAuxData(fd, pClassLookup, pIndexMapSet)) {
+ if (!writeAuxData(fd, pClassLookup, pIndexMapSet, pRegMapBuilder)) {
LOGW("Failed writing aux data\n");
goto bail;
}
@@ -692,8 +716,11 @@
LOGV("Successfully wrote DEX header\n");
result = true;
+ //dvmRegisterMapDumpStats();
+
bail:
dvmFreeIndexMapSet(pIndexMapSet);
+ dvmFreeRegisterMapBuilder(pRegMapBuilder);
free(pClassLookup);
return result;
}
@@ -1085,19 +1112,28 @@
* so it can be used directly when the file is mapped for reading.
*/
static bool writeAuxData(int fd, const DexClassLookup* pClassLookup,
- const IndexMapSet* pIndexMapSet)
+ const IndexMapSet* pIndexMapSet, const RegisterMapBuilder* pRegMapBuilder)
{
/* pre-computed class lookup hash table */
- if (!writeChunk(fd, (u4) kDexChunkClassLookup, pClassLookup,
- pClassLookup->size))
+ if (!writeChunk(fd, (u4) kDexChunkClassLookup,
+ pClassLookup, pClassLookup->size))
{
return false;
}
/* remapped constants (optional) */
if (pIndexMapSet != NULL) {
- if (!writeChunk(fd, pIndexMapSet->chunkType, pIndexMapSet->chunkData,
- pIndexMapSet->chunkDataLen))
+ if (!writeChunk(fd, pIndexMapSet->chunkType,
+ pIndexMapSet->chunkData, pIndexMapSet->chunkDataLen))
+ {
+ return false;
+ }
+ }
+
+ /* register maps (optional) */
+ if (pRegMapBuilder != NULL) {
+ if (!writeChunk(fd, (u4) kDexChunkRegisterMaps,
+ pRegMapBuilder->data, pRegMapBuilder->size))
{
return false;
}
@@ -1622,8 +1658,11 @@
* file.
*
* Exceptions caused by failures are cleared before returning.
+ *
+ * On failure, returns NULL, and sets *pFailure if pFailure is not NULL.
*/
-ClassObject* dvmOptResolveClass(ClassObject* referrer, u4 classIdx)
+ClassObject* dvmOptResolveClass(ClassObject* referrer, u4 classIdx,
+ VerifyError* pFailure)
{
DvmDex* pDvmDex = referrer->pDvmDex;
ClassObject* resClass;
@@ -1646,6 +1685,8 @@
classIdx,
dexStringByTypeIdx(pDvmDex->pDexFile, classIdx));
dvmClearOptException(dvmThreadSelf());
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_CLASS;
return NULL;
}
@@ -1659,6 +1700,8 @@
if (IS_CLASS_FLAG_SET(resClass, CLASS_MULTIPLE_DEFS)) {
LOGI("DexOpt: not resolving ambiguous class '%s'\n",
resClass->descriptor);
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_CLASS;
return NULL;
}
@@ -1669,6 +1712,8 @@
if (!allowed) {
LOGW("DexOpt: resolve class illegal access: %s -> %s\n",
referrer->descriptor, resClass->descriptor);
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_ACCESS;
return NULL;
}
@@ -1677,8 +1722,11 @@
/*
* Alternate version of dvmResolveInstField().
+ *
+ * On failure, returns NULL, and sets *pFailure if pFailure is not NULL.
*/
-InstField* dvmOptResolveInstField(ClassObject* referrer, u4 ifieldIdx)
+InstField* dvmOptResolveInstField(ClassObject* referrer, u4 ifieldIdx,
+ VerifyError* pFailure)
{
DvmDex* pDvmDex = referrer->pDvmDex;
InstField* resField;
@@ -1693,10 +1741,12 @@
/*
* Find the field's class.
*/
- resClass = dvmOptResolveClass(referrer, pFieldId->classIdx);
+ resClass = dvmOptResolveClass(referrer, pFieldId->classIdx, pFailure);
if (resClass == NULL) {
//dvmClearOptException(dvmThreadSelf());
assert(!dvmCheckException(dvmThreadSelf()));
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_FIELD;
return NULL;
}
@@ -1707,6 +1757,8 @@
LOGD("DexOpt: couldn't find field %s.%s\n",
resClass->descriptor,
dexStringById(pDvmDex->pDexFile, pFieldId->nameIdx));
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_FIELD;
return NULL;
}
@@ -1724,6 +1776,8 @@
LOGI("DexOpt: access denied from %s to field %s.%s\n",
referrer->descriptor, resField->field.clazz->descriptor,
resField->field.name);
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_ACCESS;
return NULL;
}
@@ -1734,8 +1788,11 @@
* Alternate version of dvmResolveStaticField().
*
* Does not force initialization of the resolved field's class.
+ *
+ * On failure, returns NULL, and sets *pFailure if pFailure is not NULL.
*/
-StaticField* dvmOptResolveStaticField(ClassObject* referrer, u4 sfieldIdx)
+StaticField* dvmOptResolveStaticField(ClassObject* referrer, u4 sfieldIdx,
+ VerifyError* pFailure)
{
DvmDex* pDvmDex = referrer->pDvmDex;
StaticField* resField;
@@ -1750,10 +1807,12 @@
/*
* Find the field's class.
*/
- resClass = dvmOptResolveClass(referrer, pFieldId->classIdx);
+ resClass = dvmOptResolveClass(referrer, pFieldId->classIdx, pFailure);
if (resClass == NULL) {
//dvmClearOptException(dvmThreadSelf());
assert(!dvmCheckException(dvmThreadSelf()));
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_FIELD;
return NULL;
}
@@ -1762,6 +1821,8 @@
dexStringByTypeIdx(pDvmDex->pDexFile, pFieldId->typeIdx));
if (resField == NULL) {
LOGD("DexOpt: couldn't find static field\n");
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_FIELD;
return NULL;
}
@@ -1784,6 +1845,8 @@
LOGI("DexOpt: access denied from %s to field %s.%s\n",
referrer->descriptor, resField->field.clazz->descriptor,
resField->field.name);
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_ACCESS;
return NULL;
}
@@ -1809,7 +1872,7 @@
InstField* field;
int byteOffset;
- field = dvmOptResolveInstField(clazz, fieldIdx);
+ field = dvmOptResolveInstField(clazz, fieldIdx, NULL);
if (field == NULL) {
LOGI("DexOpt: unable to optimize field ref 0x%04x at 0x%02x in %s.%s\n",
fieldIdx, (int) (insns - method->insns), clazz->descriptor,
@@ -1833,9 +1896,11 @@
* Alternate version of dvmResolveMethod().
*
* Doesn't throw exceptions, and checks access on every lookup.
+ *
+ * On failure, returns NULL, and sets *pFailure if pFailure is not NULL.
*/
Method* dvmOptResolveMethod(ClassObject* referrer, u4 methodIdx,
- MethodType methodType)
+ MethodType methodType, VerifyError* pFailure)
{
DvmDex* pDvmDex = referrer->pDvmDex;
Method* resMethod;
@@ -1852,16 +1917,20 @@
pMethodId = dexGetMethodId(pDvmDex->pDexFile, methodIdx);
- resClass = dvmOptResolveClass(referrer, pMethodId->classIdx);
+ resClass = dvmOptResolveClass(referrer, pMethodId->classIdx, pFailure);
if (resClass == NULL) {
/* can't find the class that the method is a part of */
LOGV("DexOpt: can't find called method's class (?.%s)\n",
dexStringById(pDvmDex->pDexFile, pMethodId->nameIdx));
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_METHOD;
return NULL;
}
if (dvmIsInterfaceClass(resClass)) {
/* method is part of an interface; this is wrong method for that */
LOGW("DexOpt: method is in an interface\n");
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_GENERIC;
return NULL;
}
@@ -1887,6 +1956,8 @@
if (resMethod == NULL) {
LOGV("DexOpt: couldn't find method '%s'\n",
dexStringById(pDvmDex->pDexFile, pMethodId->nameIdx));
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_NO_METHOD;
return NULL;
}
@@ -1895,6 +1966,8 @@
LOGW("DexOpt: pure-abstract method '%s' in %s\n",
dexStringById(pDvmDex->pDexFile, pMethodId->nameIdx),
resClass->descriptor);
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_GENERIC;
return NULL;
}
@@ -1925,6 +1998,8 @@
referrer->descriptor);
free(desc);
}
+ if (pFailure != NULL)
+ *pFailure = VERIFY_ERROR_ACCESS;
return NULL;
}
@@ -1945,7 +2020,7 @@
Method* baseMethod;
u2 methodIdx = insns[1];
- baseMethod = dvmOptResolveMethod(clazz, methodIdx, METHOD_VIRTUAL);
+ baseMethod = dvmOptResolveMethod(clazz, methodIdx, METHOD_VIRTUAL, NULL);
if (baseMethod == NULL) {
LOGD("DexOpt: unable to optimize virt call 0x%04x at 0x%02x in %s.%s\n",
methodIdx,
@@ -1989,7 +2064,7 @@
Method* calledMethod;
u2 methodIdx = insns[1];
- calledMethod = dvmOptResolveMethod(clazz, methodIdx, METHOD_DIRECT);
+ calledMethod = dvmOptResolveMethod(clazz, methodIdx, METHOD_DIRECT, NULL);
if (calledMethod == NULL) {
LOGD("DexOpt: unable to opt direct call 0x%04x at 0x%02x in %s.%s\n",
methodIdx,
@@ -2021,6 +2096,8 @@
/*
* Resolve an interface method reference.
*
+ * No method access check here -- interface methods are always public.
+ *
* Returns NULL if the method was not found. Does not throw an exception.
*/
Method* dvmOptResolveInterfaceMethod(ClassObject* referrer, u4 methodIdx)
@@ -2039,7 +2116,7 @@
pMethodId = dexGetMethodId(pDvmDex->pDexFile, methodIdx);
- resClass = dvmOptResolveClass(referrer, pMethodId->classIdx);
+ resClass = dvmOptResolveClass(referrer, pMethodId->classIdx, NULL);
if (resClass == NULL) {
/* can't find the class that the method is a part of */
dvmClearOptException(dvmThreadSelf());
@@ -2115,7 +2192,7 @@
//return false;
- calledMethod = dvmOptResolveMethod(clazz, methodIdx, methodType);
+ calledMethod = dvmOptResolveMethod(clazz, methodIdx, methodType, NULL);
if (calledMethod == NULL) {
LOGV("+++ DexOpt inline: can't find %d\n", methodIdx);
return false;
diff --git a/vm/analysis/DexOptimize.h b/vm/analysis/DexOptimize.h
index 01aa828..27ab327 100644
--- a/vm/analysis/DexOptimize.h
+++ b/vm/analysis/DexOptimize.h
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* DEX optimization declarations.
*/
@@ -36,6 +37,22 @@
};
/*
+ * An enumeration of problems that can turn up during verification.
+ */
+typedef enum VerifyError {
+ VERIFY_ERROR_NONE = 0, /* no error; must be zero */
+ VERIFY_ERROR_GENERIC, /* failed, details not important */
+
+ VERIFY_ERROR_NO_CLASS, /* NoClassDefFoundError */
+ VERIFY_ERROR_NO_METHOD, /* NoSuchMethodError */
+ VERIFY_ERROR_NO_FIELD, /* NoSuchFieldError */
+ VERIFY_ERROR_CLASS_CHANGE, /* IncompatibleClassChangeError */
+ VERIFY_ERROR_ACCESS, /* IllegalAccessError */
+} VerifyError;
+
+#define VERIFY_OK(_failure) ((_failure) == VERIFY_ERROR_NONE)
+
+/*
* Given the full path to a DEX or Jar file, and (if appropriate) the name
* within the Jar, open the optimized version from the cache.
*
@@ -81,11 +98,14 @@
* Abbreviated resolution functions, for use by optimization and verification
* code.
*/
-ClassObject* dvmOptResolveClass(ClassObject* referrer, u4 classIdx);
+ClassObject* dvmOptResolveClass(ClassObject* referrer, u4 classIdx,
+ VerifyError* pFailure);
Method* dvmOptResolveMethod(ClassObject* referrer, u4 methodIdx,
- MethodType methodType);
+ MethodType methodType, VerifyError* pFailure);
Method* dvmOptResolveInterfaceMethod(ClassObject* referrer, u4 methodIdx);
-InstField* dvmOptResolveInstField(ClassObject* referrer, u4 ifieldIdx);
-StaticField* dvmOptResolveStaticField(ClassObject* referrer, u4 sfieldIdx);
+InstField* dvmOptResolveInstField(ClassObject* referrer, u4 ifieldIdx,
+ VerifyError* pFailure);
+StaticField* dvmOptResolveStaticField(ClassObject* referrer, u4 sfieldIdx,
+ VerifyError* pFailure);
#endif /*_DALVIK_DEXOPTIMIZE*/
diff --git a/vm/analysis/DexVerify.c b/vm/analysis/DexVerify.c
index 354d68f..25075f4 100644
--- a/vm/analysis/DexVerify.c
+++ b/vm/analysis/DexVerify.c
@@ -40,7 +40,7 @@
}
/*
- * Initialize some things we need for verification.
+ * Free up some things we needed for verification.
*/
void dvmVerificationShutdown(void)
{
@@ -533,15 +533,36 @@
dvmInsnSetBranchTarget(insnFlags, 0, true);
for (i = 0; i < insnCount; /**/) {
- static int gcMask = kInstrCanBranch | kInstrCanSwitch |
+ /*
+ * These types of instructions can be GC points. To support precise
+ * GC, all such instructions must export the PC in the interpreter,
+ * or the GC won't be able to identify the current PC for the thread.
+ */
+ static const int gcMask = kInstrCanBranch | kInstrCanSwitch |
kInstrCanThrow | kInstrCanReturn;
+
int width = dvmInsnGetWidth(insnFlags, i);
OpCode opcode = *insns & 0xff;
InstructionFlags opFlags = dexGetInstrFlags(gDvm.instrFlags, opcode);
int offset, absOffset;
- if ((opFlags & gcMask) != 0)
- dvmInsnSetGcPoint(insnFlags, i, true);
+ if ((opFlags & gcMask) != 0) {
+ /*
+ * This instruction is probably a GC point. Branch instructions
+ * only qualify if they go backward, so we need to check the
+ * offset.
+ */
+ int offset = -1;
+ bool unused;
+ if (dvmGetBranchTarget(meth, insnFlags, i, &offset, &unused)) {
+ if (offset < 0) {
+ dvmInsnSetGcPoint(insnFlags, i, true);
+ }
+ } else {
+ /* not a branch target */
+ dvmInsnSetGcPoint(insnFlags, i, true);
+ }
+ }
switch (opcode) {
case OP_NOP:
diff --git a/vm/analysis/RegisterMap.c b/vm/analysis/RegisterMap.c
index b02874a..20272f2 100644
--- a/vm/analysis/RegisterMap.c
+++ b/vm/analysis/RegisterMap.c
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-// ** UNDER CONSTRUCTION **
-
/*
* This code generate "register maps" for Dalvik bytecode. In a stack-based
* VM we might call these "stack maps". They are used to increase the
@@ -27,9 +25,1828 @@
#include "analysis/RegisterMap.h"
#include "libdex/DexCatch.h"
#include "libdex/InstrUtils.h"
+#include "libdex/Leb128.h"
#include <stddef.h>
+/* double-check the compression */
+#define REGISTER_MAP_VERIFY true
+
+/* verbose logging */
+#define REGISTER_MAP_VERBOSE false
+
+
+// fwd
+static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data);
+static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap);
+static int compareMaps(const RegisterMap* pMap1, const RegisterMap* pMap2);
+
+static void computeMapStats(RegisterMap* pMap, const Method* method);
+static RegisterMap* compressMapDifferential(const RegisterMap* pMap,\
+ const Method* meth);
+static RegisterMap* uncompressMapDifferential(const RegisterMap* pMap);
+
+
+//#define REGISTER_MAP_STATS
+#ifdef REGISTER_MAP_STATS
+/*
+ * Generate some statistics on the register maps we create and use.
+ */
+#define kMaxGcPointGap 50
+#define kUpdatePosnMinRegs 24
+#define kNumUpdatePosns 8
+#define kMaxDiffBits 20
+typedef struct MapStats {
+ /*
+ * Buckets measuring the distance between GC points. This tells us how
+ * many bits we need to encode the advancing program counter. We ignore
+ * some of the "long tail" entries.
+ */
+ int gcPointGap[kMaxGcPointGap];
+
+ /*
+ * Number of gaps. Equal to (number of gcPoints - number of methods),
+ * since the computation isn't including the initial gap.
+ */
+ int gcGapCount;
+
+ /*
+ * Number of gaps.
+ */
+ int totalGcPointCount;
+
+ /*
+ * For larger methods (>= 24 registers), measure in which octant register
+ * updates occur. This should help us understand whether register
+ * changes tend to cluster in the low regs even for large methods.
+ */
+ int updatePosn[kNumUpdatePosns];
+
+ /*
+ * For all methods, count up the number of changes to registers < 16
+ * and >= 16.
+ */
+ int updateLT16;
+ int updateGE16;
+
+ /*
+ * Histogram of the number of bits that differ between adjacent entries.
+ */
+ int numDiffBits[kMaxDiffBits];
+
+
+ /*
+ * Track the number of expanded maps, and the heap space required to
+ * hold them.
+ */
+ int numExpandedMaps;
+ int totalExpandedMapSize;
+} MapStats;
+#endif
+
+/*
+ * Prepare some things.
+ */
+bool dvmRegisterMapStartup(void)
+{
+#ifdef REGISTER_MAP_STATS
+ MapStats* pStats = calloc(1, sizeof(MapStats));
+ gDvm.registerMapStats = pStats;
+#endif
+ return true;
+}
+
+/*
+ * Clean up.
+ */
+void dvmRegisterMapShutdown(void)
+{
+#ifdef REGISTER_MAP_STATS
+ free(gDvm.registerMapStats);
+#endif
+}
+
+/*
+ * Write stats to log file.
+ */
+void dvmRegisterMapDumpStats(void)
+{
+#ifdef REGISTER_MAP_STATS
+ MapStats* pStats = (MapStats*) gDvm.registerMapStats;
+ int i, end;
+
+ for (end = kMaxGcPointGap-1; end >= 0; end--) {
+ if (pStats->gcPointGap[end] != 0)
+ break;
+ }
+
+ LOGI("Register Map gcPointGap stats (diff count=%d, total=%d):\n",
+ pStats->gcGapCount, pStats->totalGcPointCount);
+ assert(pStats->gcPointGap[0] == 0);
+ for (i = 1; i <= end; i++) {
+ LOGI(" %2d %d\n", i, pStats->gcPointGap[i]);
+ }
+
+
+ for (end = kMaxDiffBits-1; end >= 0; end--) {
+ if (pStats->numDiffBits[end] != 0)
+ break;
+ }
+
+ LOGI("Register Map bit difference stats:\n");
+ for (i = 0; i <= end; i++) {
+ LOGI(" %2d %d\n", i, pStats->numDiffBits[i]);
+ }
+
+
+ LOGI("Register Map update position stats (lt16=%d ge16=%d):\n",
+ pStats->updateLT16, pStats->updateGE16);
+ for (i = 0; i < kNumUpdatePosns; i++) {
+ LOGI(" %2d %d\n", i, pStats->updatePosn[i]);
+ }
+#endif
+}
+
+
+/*
+ * ===========================================================================
+ * Map generation
+ * ===========================================================================
+ */
+
+/*
+ * Generate the register map for a method that has just been verified
+ * (i.e. we're doing this as part of verification).
+ *
+ * For type-precise determination we have all the data we need, so we
+ * just need to encode it in some clever fashion.
+ *
+ * Returns a pointer to a newly-allocated RegisterMap, or NULL on failure.
+ */
+RegisterMap* dvmGenerateRegisterMapV(VerifierData* vdata)
+{
+ static const int kHeaderSize = offsetof(RegisterMap, data);
+ RegisterMap* pMap = NULL;
+ RegisterMap* pResult = NULL;
+ RegisterMapFormat format;
+ u1 regWidth;
+ u1* mapData;
+ int i, bytesForAddr, gcPointCount;
+ int bufSize;
+
+ if (vdata->method->registersSize >= 2048) {
+ LOGE("ERROR: register map can't handle %d registers\n",
+ vdata->method->registersSize);
+ goto bail;
+ }
+ regWidth = (vdata->method->registersSize + 7) / 8;
+
+ /*
+ * Decide if we need 8 or 16 bits to hold the address. Strictly speaking
+ * we only need 16 bits if we actually encode an address >= 256 -- if
+ * the method has a section at the end without GC points (e.g. array
+ * data) we don't need to count it. The situation is unusual, and
+ * detecting it requires scanning the entire method, so we don't bother.
+ */
+ if (vdata->insnsSize < 256) {
+ format = kRegMapFormatCompact8;
+ bytesForAddr = 1;
+ } else {
+ format = kRegMapFormatCompact16;
+ bytesForAddr = 2;
+ }
+
+ /*
+ * Count up the number of GC point instructions.
+ *
+ * NOTE: this does not automatically include the first instruction,
+ * since we don't count method entry as a GC point.
+ */
+ gcPointCount = 0;
+ for (i = 0; i < vdata->insnsSize; i++) {
+ if (dvmInsnIsGcPoint(vdata->insnFlags, i))
+ gcPointCount++;
+ }
+ if (gcPointCount >= 65536) {
+ /* we could handle this, but in practice we don't get near this */
+ LOGE("ERROR: register map can't handle %d gc points in one method\n",
+ gcPointCount);
+ goto bail;
+ }
+
+ /*
+ * Allocate a buffer to hold the map data.
+ */
+ bufSize = kHeaderSize + gcPointCount * (bytesForAddr + regWidth);
+
+ LOGV("+++ grm: %s.%s (adr=%d gpc=%d rwd=%d bsz=%d)\n",
+ vdata->method->clazz->descriptor, vdata->method->name,
+ bytesForAddr, gcPointCount, regWidth, bufSize);
+
+ pMap = (RegisterMap*) malloc(bufSize);
+ dvmRegisterMapSetFormat(pMap, format);
+ dvmRegisterMapSetOnHeap(pMap, true);
+ dvmRegisterMapSetRegWidth(pMap, regWidth);
+ dvmRegisterMapSetNumEntries(pMap, gcPointCount);
+
+ /*
+ * Populate it.
+ */
+ mapData = pMap->data;
+ for (i = 0; i < vdata->insnsSize; i++) {
+ if (dvmInsnIsGcPoint(vdata->insnFlags, i)) {
+ assert(vdata->addrRegs[i] != NULL);
+ if (format == kRegMapFormatCompact8) {
+ *mapData++ = i;
+ } else /*kRegMapFormatCompact16*/ {
+ *mapData++ = i & 0xff;
+ *mapData++ = i >> 8;
+ }
+ outputTypeVector(vdata->addrRegs[i], vdata->insnRegCount, mapData);
+ mapData += regWidth;
+ }
+ }
+
+ LOGV("mapData=%p pMap=%p bufSize=%d\n", mapData, pMap, bufSize);
+ assert(mapData - (const u1*) pMap == bufSize);
+
+#if 1
+ if (!verifyMap(vdata, pMap))
+ goto bail;
+#endif
+#ifdef REGISTER_MAP_STATS
+ computeMapStats(pMap, vdata->method);
+#endif
+
+ /*
+ * Try to compress the map.
+ */
+ RegisterMap* pCompMap;
+
+ pCompMap = compressMapDifferential(pMap, vdata->method);
+ if (pCompMap != NULL) {
+ if (REGISTER_MAP_VERIFY) {
+ /*
+ * Expand the compressed map we just created, and compare it
+ * to the original. Abort the VM if it doesn't match up.
+ */
+ RegisterMap* pUncompMap;
+ pUncompMap = uncompressMapDifferential(pCompMap);
+ if (pUncompMap == NULL) {
+ LOGE("Map failed to uncompress - %s.%s\n",
+ vdata->method->clazz->descriptor,
+ vdata->method->name);
+ free(pCompMap);
+ /* bad - compression is broken or we're out of memory */
+ dvmAbort();
+ } else {
+ if (compareMaps(pMap, pUncompMap) != 0) {
+ LOGE("Map comparison failed - %s.%s\n",
+ vdata->method->clazz->descriptor,
+ vdata->method->name);
+ free(pCompMap);
+ /* bad - compression is broken */
+ dvmAbort();
+ }
+
+ /* verify succeeded */
+ free(pUncompMap);
+ }
+ }
+
+ if (REGISTER_MAP_VERBOSE) {
+ LOGD("Good compress on %s.%s\n",
+ vdata->method->clazz->descriptor,
+ vdata->method->name);
+ }
+ free(pMap);
+ pMap = pCompMap;
+ } else {
+ if (REGISTER_MAP_VERBOSE) {
+ LOGD("Unable to compress %s.%s (ent=%d rw=%d)\n",
+ vdata->method->clazz->descriptor,
+ vdata->method->name,
+ dvmRegisterMapGetNumEntries(pMap),
+ dvmRegisterMapGetRegWidth(pMap));
+ }
+ }
+
+ pResult = pMap;
+
+bail:
+ return pResult;
+}
+
+/*
+ * Release the storage held by a RegisterMap.
+ */
+void dvmFreeRegisterMap(RegisterMap* pMap)
+{
+ if (pMap == NULL)
+ return;
+
+ assert(dvmRegisterMapGetOnHeap(pMap));
+ free(pMap);
+}
+
+/*
+ * Determine if the RegType value is a reference type.
+ *
+ * Ordinarily we include kRegTypeZero in the "is it a reference"
+ * check. There's no value in doing so here, because we know
+ * the register can't hold anything but zero.
+ */
+static inline bool isReferenceType(RegType type)
+{
+ return (type > kRegTypeMAX || type == kRegTypeUninit);
+}
+
+/*
+ * Given a line of registers, output a bit vector that indicates whether
+ * or not the register holds a reference type (which could be null).
+ *
+ * We use '1' to indicate it's a reference, '0' for anything else (numeric
+ * value, uninitialized data, merge conflict). Register 0 will be found
+ * in the low bit of the first byte.
+ */
+static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data)
+{
+ u1 val = 0;
+ int i;
+
+ for (i = 0; i < insnRegCount; i++) {
+ RegType type = *regs++;
+ val >>= 1;
+ if (isReferenceType(type))
+ val |= 0x80; /* set hi bit */
+
+ if ((i & 0x07) == 7)
+ *data++ = val;
+ }
+ if ((i & 0x07) != 0) {
+ /* flush bits from last byte */
+ val >>= 8 - (i & 0x07);
+ *data++ = val;
+ }
+}
+
+/*
+ * Print the map as a series of binary strings.
+ *
+ * Pass in method->registersSize if known, or -1 if not.
+ */
+static void dumpRegisterMap(const RegisterMap* pMap, int registersSize)
+{
+ const u1* rawMap = pMap->data;
+ const RegisterMapFormat format = dvmRegisterMapGetFormat(pMap);
+ const int numEntries = dvmRegisterMapGetNumEntries(pMap);
+ const int regWidth = dvmRegisterMapGetRegWidth(pMap);
+ int addrWidth;
+
+ switch (format) {
+ case kRegMapFormatCompact8:
+ addrWidth = 1;
+ break;
+ case kRegMapFormatCompact16:
+ addrWidth = 2;
+ break;
+ default:
+ /* can't happen */
+ LOGE("Can only dump Compact8 / Compact16 maps (not %d)\n", format);
+ return;
+ }
+
+ if (registersSize < 0)
+ registersSize = 8 * regWidth;
+ assert(registersSize <= regWidth * 8);
+
+ int ent;
+ for (ent = 0; ent < numEntries; ent++) {
+ int i, addr;
+
+ addr = *rawMap++;
+ if (addrWidth > 1)
+ addr |= (*rawMap++) << 8;
+
+ const u1* dataStart = rawMap;
+ u1 val = 0;
+
+ /* create binary string */
+ char outBuf[registersSize +1];
+ for (i = 0; i < registersSize; i++) {
+ val >>= 1;
+ if ((i & 0x07) == 0)
+ val = *rawMap++;
+
+ outBuf[i] = '0' + (val & 0x01);
+ }
+ outBuf[i] = '\0';
+
+ /* back up and create hex dump */
+ char hexBuf[regWidth * 3 +1];
+ char* cp = hexBuf;
+ rawMap = dataStart;
+ for (i = 0; i < regWidth; i++) {
+ sprintf(cp, " %02x", *rawMap++);
+ cp += 3;
+ }
+ hexBuf[i * 3] = '\0';
+
+ LOGD(" %04x %s %s\n", addr, outBuf, hexBuf);
+ }
+}
+
+/*
+ * Double-check the map.
+ *
+ * We run through all of the data in the map, and compare it to the original.
+ * Only works on uncompressed data.
+ */
+static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap)
+{
+ const u1* rawMap = pMap->data;
+ const RegisterMapFormat format = dvmRegisterMapGetFormat(pMap);
+ const int numEntries = dvmRegisterMapGetNumEntries(pMap);
+ int ent;
+ bool dumpMap = false;
+
+ if (false) {
+ const char* cd = "Landroid/net/http/Request;";
+ const char* mn = "readResponse";
+ const char* sg = "(Landroid/net/http/AndroidHttpClientConnection;)V";
+ if (strcmp(vdata->method->clazz->descriptor, cd) == 0 &&
+ strcmp(vdata->method->name, mn) == 0)
+ {
+ char* desc;
+ desc = dexProtoCopyMethodDescriptor(&vdata->method->prototype);
+ LOGI("Map for %s.%s %s\n", vdata->method->clazz->descriptor,
+ vdata->method->name, desc);
+ free(desc);
+
+ dumpMap = true;
+ }
+ }
+
+ if ((vdata->method->registersSize + 7) / 8 != pMap->regWidth) {
+ LOGE("GLITCH: registersSize=%d, regWidth=%d\n",
+ vdata->method->registersSize, pMap->regWidth);
+ return false;
+ }
+
+ for (ent = 0; ent < numEntries; ent++) {
+ int addr;
+
+ switch (format) {
+ case kRegMapFormatCompact8:
+ addr = *rawMap++;
+ break;
+ case kRegMapFormatCompact16:
+ addr = *rawMap++;
+ addr |= (*rawMap++) << 8;
+ break;
+ default:
+ /* shouldn't happen */
+ LOGE("GLITCH: bad format (%d)", format);
+ dvmAbort();
+ }
+
+ const u1* dataStart = rawMap;
+ const RegType* regs = vdata->addrRegs[addr];
+ if (regs == NULL) {
+ LOGE("GLITCH: addr %d has no data\n", addr);
+ return false;
+ }
+
+ u1 val = 0;
+ int i;
+
+ for (i = 0; i < vdata->method->registersSize; i++) {
+ bool bitIsRef, regIsRef;
+
+ val >>= 1;
+ if ((i & 0x07) == 0) {
+ /* load next byte of data */
+ val = *rawMap++;
+ }
+
+ bitIsRef = val & 0x01;
+
+ RegType type = regs[i];
+ regIsRef = isReferenceType(type);
+
+ if (bitIsRef != regIsRef) {
+ LOGE("GLITCH: addr %d reg %d: bit=%d reg=%d(%d)\n",
+ addr, i, bitIsRef, regIsRef, type);
+ return false;
+ }
+ }
+
+ /* rawMap now points to the address field of the next entry */
+ }
+
+ if (dumpMap)
+ dumpRegisterMap(pMap, vdata->method->registersSize);
+
+ return true;
+}
+
+
+/*
+ * ===========================================================================
+ * DEX generation & parsing
+ * ===========================================================================
+ */
+
+/*
+ * Advance "ptr" to ensure 32-bit alignment.
+ */
+static inline u1* align32(u1* ptr)
+{
+ return (u1*) (((int) ptr + 3) & ~0x03);
+}
+
+/*
+ * Compute the size, in bytes, of a register map.
+ */
+static size_t computeRegisterMapSize(const RegisterMap* pMap)
+{
+ static const int kHeaderSize = offsetof(RegisterMap, data);
+ u1 format = dvmRegisterMapGetFormat(pMap);
+ u2 numEntries = dvmRegisterMapGetNumEntries(pMap);
+
+ assert(pMap != NULL);
+
+ switch (format) {
+ case kRegMapFormatNone:
+ return 1;
+ case kRegMapFormatCompact8:
+ return kHeaderSize + (1 + pMap->regWidth) * numEntries;
+ case kRegMapFormatCompact16:
+ return kHeaderSize + (2 + pMap->regWidth) * numEntries;
+ case kRegMapFormatDifferential:
+ {
+ /* kHeaderSize + decoded ULEB128 length */
+ const u1* ptr = pMap->data;
+ int len = readUnsignedLeb128(&ptr);
+ return len + (ptr - (u1*) pMap);
+ }
+ default:
+ LOGE("Bad register map format %d\n", format);
+ dvmAbort();
+ return 0;
+ }
+}
+
+/*
+ * Output the map for a single method, if it has one.
+ *
+ * Abstract and native methods have no map. All others are expected to
+ * have one, since we know the class verified successfully.
+ *
+ * This strips the "allocated on heap" flag from the format byte, so that
+ * direct-mapped maps are correctly identified as such.
+ */
+static bool writeMapForMethod(const Method* meth, u1** pPtr)
+{
+ if (meth->registerMap == NULL) {
+ if (!dvmIsAbstractMethod(meth) && !dvmIsNativeMethod(meth)) {
+ LOGW("Warning: no map available for %s.%s\n",
+ meth->clazz->descriptor, meth->name);
+ /* weird, but keep going */
+ }
+ *(*pPtr)++ = kRegMapFormatNone;
+ return true;
+ }
+
+ /* serialize map into the buffer */
+ size_t mapSize = computeRegisterMapSize(meth->registerMap);
+ memcpy(*pPtr, meth->registerMap, mapSize);
+
+ /* strip the "on heap" flag out of the format byte, which is always first */
+ assert(**pPtr == meth->registerMap->format);
+ **pPtr &= ~(kRegMapFormatOnHeap);
+
+ *pPtr += mapSize;
+
+ return true;
+}
+
+/*
+ * Write maps for all methods in the specified class to the buffer, which
+ * can hold at most "length" bytes. "*pPtr" will be advanced past the end
+ * of the data we write.
+ */
+static bool writeMapsAllMethods(DvmDex* pDvmDex, const ClassObject* clazz,
+ u1** pPtr, size_t length)
+{
+ RegisterMapMethodPool* pMethodPool;
+ u1* ptr = *pPtr;
+ int i, methodCount;
+
+ /* artificial limit */
+ if (clazz->virtualMethodCount + clazz->directMethodCount >= 65536) {
+ LOGE("Too many methods in %s\n", clazz->descriptor);
+ return false;
+ }
+
+ pMethodPool = (RegisterMapMethodPool*) ptr;
+ ptr += offsetof(RegisterMapMethodPool, methodData);
+ methodCount = 0;
+
+ /*
+ * Run through all methods, direct then virtual. The class loader will
+ * traverse them in the same order. (We could split them into two
+ * distinct pieces, but there doesn't appear to be any value in doing
+ * so other than that it makes class loading slightly less fragile.)
+ *
+ * The class loader won't know about miranda methods at the point
+ * where it parses this, so we omit those.
+ *
+ * TODO: consider omitting all native/abstract definitions. Should be
+ * safe, though we lose the ability to sanity-check against the
+ * method counts in the DEX file.
+ */
+ for (i = 0; i < clazz->directMethodCount; i++) {
+ const Method* meth = &clazz->directMethods[i];
+ if (dvmIsMirandaMethod(meth))
+ continue;
+ if (!writeMapForMethod(&clazz->directMethods[i], &ptr)) {
+ return false;
+ }
+ methodCount++;
+ //ptr = align32(ptr);
+ }
+
+ for (i = 0; i < clazz->virtualMethodCount; i++) {
+ const Method* meth = &clazz->virtualMethods[i];
+ if (dvmIsMirandaMethod(meth))
+ continue;
+ if (!writeMapForMethod(&clazz->virtualMethods[i], &ptr)) {
+ return false;
+ }
+ methodCount++;
+ //ptr = align32(ptr);
+ }
+
+ pMethodPool->methodCount = methodCount;
+
+ *pPtr = ptr;
+ return true;
+}
+
+/*
+ * Write maps for all classes to the specified buffer, which can hold at
+ * most "length" bytes.
+ *
+ * Returns the actual length used, or 0 on failure.
+ */
+static size_t writeMapsAllClasses(DvmDex* pDvmDex, u1* basePtr, size_t length)
+{
+ DexFile* pDexFile = pDvmDex->pDexFile;
+ u4 count = pDexFile->pHeader->classDefsSize;
+ RegisterMapClassPool* pClassPool;
+ u4* offsetTable;
+ u1* ptr = basePtr;
+ u4 idx;
+
+ assert(gDvm.optimizing);
+
+ pClassPool = (RegisterMapClassPool*) ptr;
+ ptr += offsetof(RegisterMapClassPool, classDataOffset);
+ offsetTable = (u4*) ptr;
+ ptr += count * sizeof(u4);
+
+ pClassPool->numClasses = count;
+
+ /*
+ * We want an entry for every class, loaded or not.
+ */
+ for (idx = 0; idx < count; idx++) {
+ const DexClassDef* pClassDef;
+ const char* classDescriptor;
+ ClassObject* clazz;
+
+ pClassDef = dexGetClassDef(pDexFile, idx);
+ classDescriptor = dexStringByTypeIdx(pDexFile, pClassDef->classIdx);
+
+ /*
+ * All classes have been loaded into the bootstrap class loader.
+ * If we can find it, and it was successfully pre-verified, we
+ * run through its methods and add the register maps.
+ *
+ * If it wasn't pre-verified then we know it can't have any
+ * register maps. Classes that can't be loaded or failed
+ * verification get an empty slot in the index.
+ */
+ clazz = NULL;
+ if ((pClassDef->accessFlags & CLASS_ISPREVERIFIED) != 0)
+ clazz = dvmLookupClass(classDescriptor, NULL, false);
+
+ if (clazz != NULL) {
+ offsetTable[idx] = ptr - basePtr;
+ LOGVV("%d -> offset %d (%p-%p)\n",
+ idx, offsetTable[idx], ptr, basePtr);
+
+ if (!writeMapsAllMethods(pDvmDex, clazz, &ptr,
+ length - (ptr - basePtr)))
+ {
+ return 0;
+ }
+
+ ptr = align32(ptr);
+ LOGVV("Size %s (%d+%d methods): %d\n", clazz->descriptor,
+ clazz->directMethodCount, clazz->virtualMethodCount,
+ (ptr - basePtr) - offsetTable[idx]);
+ } else {
+ LOGV("%4d NOT mapadding '%s'\n", idx, classDescriptor);
+ assert(offsetTable[idx] == 0);
+ }
+ }
+
+ if (ptr - basePtr >= (int)length) {
+ /* a bit late */
+ LOGE("Buffer overrun\n");
+ dvmAbort();
+ }
+
+ return ptr - basePtr;
+}
+
+/*
+ * Generate a register map set for all verified classes in "pDvmDex".
+ */
+RegisterMapBuilder* dvmGenerateRegisterMaps(DvmDex* pDvmDex)
+{
+ RegisterMapBuilder* pBuilder;
+
+ pBuilder = (RegisterMapBuilder*) calloc(1, sizeof(RegisterMapBuilder));
+ if (pBuilder == NULL)
+ return NULL;
+
+ /*
+ * We have a couple of options here:
+ * (1) Compute the size of the output, and malloc a buffer.
+ * (2) Create a "large-enough" anonymous mmap region.
+ *
+ * The nice thing about option #2 is that we don't have to traverse
+ * all of the classes and methods twice. The risk is that we might
+ * not make the region large enough. Since the pages aren't mapped
+ * until used we can allocate a semi-absurd amount of memory without
+ * worrying about the effect on the rest of the system.
+ *
+ * The basic encoding on the largest jar file requires about 1MB of
+ * storage. We map out 4MB here. (TODO: guarantee that the last
+ * page of the mapping is marked invalid, so we reliably fail if
+ * we overrun.)
+ */
+ if (sysCreatePrivateMap(4 * 1024 * 1024, &pBuilder->memMap) != 0) {
+ free(pBuilder);
+ return NULL;
+ }
+
+ /*
+ * Create the maps.
+ */
+ size_t actual = writeMapsAllClasses(pDvmDex, (u1*)pBuilder->memMap.addr,
+ pBuilder->memMap.length);
+ if (actual == 0) {
+ dvmFreeRegisterMapBuilder(pBuilder);
+ return NULL;
+ }
+
+ LOGV("TOTAL size of register maps: %d\n", actual);
+
+ pBuilder->data = pBuilder->memMap.addr;
+ pBuilder->size = actual;
+ return pBuilder;
+}
+
+/*
+ * Free the builder.
+ */
+void dvmFreeRegisterMapBuilder(RegisterMapBuilder* pBuilder)
+{
+ if (pBuilder == NULL)
+ return;
+
+ sysReleaseShmem(&pBuilder->memMap);
+ free(pBuilder);
+}
+
+
+/*
+ * Find the data for the specified class.
+ *
+ * If there's no register map data, or none for this class, we return NULL.
+ */
+const void* dvmRegisterMapGetClassData(const DexFile* pDexFile, u4 classIdx,
+ u4* pNumMaps)
+{
+ const RegisterMapClassPool* pClassPool;
+ const RegisterMapMethodPool* pMethodPool;
+
+ pClassPool = (const RegisterMapClassPool*) pDexFile->pRegisterMapPool;
+ if (pClassPool == NULL)
+ return NULL;
+
+ if (classIdx >= pClassPool->numClasses) {
+ LOGE("bad class index (%d vs %d)\n", classIdx, pClassPool->numClasses);
+ dvmAbort();
+ }
+
+ u4 classOffset = pClassPool->classDataOffset[classIdx];
+ if (classOffset == 0) {
+ LOGV("+++ no map for classIdx=%d\n", classIdx);
+ return NULL;
+ }
+
+ pMethodPool =
+ (const RegisterMapMethodPool*) (((u1*) pClassPool) + classOffset);
+ if (pNumMaps != NULL)
+ *pNumMaps = pMethodPool->methodCount;
+ return pMethodPool->methodData;
+}
+
+/*
+ * This advances "*pPtr" and returns its original value.
+ */
+const RegisterMap* dvmRegisterMapGetNext(const void** pPtr)
+{
+ const RegisterMap* pMap = *pPtr;
+
+ *pPtr = /*align32*/(((u1*) pMap) + computeRegisterMapSize(pMap));
+ LOGVV("getNext: %p -> %p (f=0x%x w=%d e=%d)\n",
+ pMap, *pPtr, pMap->format, pMap->regWidth,
+ dvmRegisterMapGetNumEntries(pMap));
+ return pMap;
+}
+
+
+/*
+ * ===========================================================================
+ * Utility functions
+ * ===========================================================================
+ */
+
+/*
+ * Return the data for the specified address, or NULL if not found.
+ *
+ * The result must be released with dvmReleaseRegisterMapLine().
+ */
+const u1* dvmRegisterMapGetLine(const RegisterMap* pMap, int addr)
+{
+ int addrWidth, lineWidth;
+ u1 format = dvmRegisterMapGetFormat(pMap);
+ u2 numEntries = dvmRegisterMapGetNumEntries(pMap);
+
+ assert(numEntries > 0);
+
+ switch (format) {
+ case kRegMapFormatNone:
+ return NULL;
+ case kRegMapFormatCompact8:
+ addrWidth = 1;
+ break;
+ case kRegMapFormatCompact16:
+ addrWidth = 2;
+ break;
+ default:
+ LOGE("Unknown format %d\n", format);
+ dvmAbort();
+ return NULL;
+ }
+
+ lineWidth = addrWidth + pMap->regWidth;
+
+ /*
+ * Find the appropriate entry. Many maps are very small, some are very
+ * large.
+ */
+ static const int kSearchThreshold = 8;
+ const u1* data;
+ int lineAddr;
+
+ if (numEntries < kSearchThreshold) {
+ int i;
+ data = pMap->data;
+ for (i = numEntries; i > 0; i--) {
+ lineAddr = data[0];
+ if (addrWidth > 1)
+ lineAddr |= data[1] << 8;
+ if (lineAddr == addr)
+ return data + addrWidth;
+
+ data += lineWidth;
+ }
+ } else {
+ int hi, lo, mid;
+
+ lo = 0;
+ hi = numEntries -1;
+
+ while (hi >= lo) {
+ mid = (hi + lo) / 2;
+ data = pMap->data + lineWidth * mid;
+
+ lineAddr = data[0];
+ if (addrWidth > 1)
+ lineAddr |= data[1] << 8;
+
+ if (addr > lineAddr) {
+ lo = mid + 1;
+ } else if (addr < lineAddr) {
+ hi = mid - 1;
+ } else {
+ return data + addrWidth;
+ }
+ }
+ }
+
+ assert(data == pMap->data + lineWidth * numEntries);
+ return NULL;
+}
+
+/*
+ * Compare two register maps.
+ *
+ * Returns 0 if they're equal, nonzero if not.
+ */
+static int compareMaps(const RegisterMap* pMap1, const RegisterMap* pMap2)
+{
+ size_t size1, size2;
+
+ size1 = computeRegisterMapSize(pMap1);
+ size2 = computeRegisterMapSize(pMap2);
+ if (size1 != size2) {
+ LOGI("compareMaps: size mismatch (%zd vs %zd)\n", size1, size2);
+ return -1;
+ }
+
+ if (memcmp(pMap1, pMap2, size1) != 0) {
+ LOGI("compareMaps: content mismatch\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+
+/*
+ * Get the expanded form of the register map associated with the method.
+ *
+ * If the map is already in one of the uncompressed formats, we return
+ * immediately. Otherwise, we expand the map and replace method's register
+ * map pointer, freeing it if it was allocated on the heap.
+ *
+ * NOTE: this function is not synchronized; external locking is mandatory
+ * (unless we're in the zygote, where single-threaded access is guaranteed).
+ */
+const RegisterMap* dvmGetExpandedRegisterMap0(Method* method)
+{
+ const RegisterMap* curMap = method->registerMap;
+ RegisterMap* newMap;
+
+ if (curMap == NULL)
+ return NULL;
+
+ /* sanity check to ensure this isn't called w/o external locking */
+ /* (if we use this at a time other than during GC, fix/remove this test) */
+ if (true) {
+ if (!gDvm.zygote && pthread_mutex_trylock(&gDvm.gcHeapLock) == 0) {
+ LOGE("GLITCH: dvmGetExpandedRegisterMap not called at GC time\n");
+ dvmAbort();
+ }
+ }
+
+ RegisterMapFormat format = dvmRegisterMapGetFormat(curMap);
+ switch (format) {
+ case kRegMapFormatCompact8:
+ case kRegMapFormatCompact16:
+ if (REGISTER_MAP_VERBOSE) {
+ if (dvmRegisterMapGetOnHeap(curMap)) {
+ LOGD("RegMap: already expanded: %s.%s\n",
+ method->clazz->descriptor, method->name);
+ } else {
+ LOGD("RegMap: stored w/o compression: %s.%s\n",
+ method->clazz->descriptor, method->name);
+ }
+ }
+ return curMap;
+ case kRegMapFormatDifferential:
+ newMap = uncompressMapDifferential(curMap);
+ break;
+ default:
+ LOGE("Unknown format %d in dvmGetExpandedRegisterMap\n", format);
+ dvmAbort();
+ }
+
+ if (newMap == NULL) {
+ LOGE("Map failed to uncompress (fmt=%d) %s.%s\n",
+ format, method->clazz->descriptor, method->name);
+ return NULL;
+ }
+
+#ifdef REGISTER_MAP_STATS
+ /*
+ * Gather and display some stats.
+ */
+ {
+ MapStats* pStats = (MapStats*) gDvm.registerMapStats;
+ pStats->numExpandedMaps++;
+ pStats->totalExpandedMapSize += computeRegisterMapSize(newMap);
+ LOGD("RMAP: count=%d size=%d\n",
+ pStats->numExpandedMaps, pStats->totalExpandedMapSize);
+ }
+#endif
+
+ IF_LOGV() {
+ char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
+ LOGV("Expanding map -> %s.%s:%s\n",
+ method->clazz->descriptor, method->name, desc);
+ free(desc);
+ }
+
+ /*
+ * Update method, and free compressed map if it was sitting on the heap.
+ */
+ dvmSetRegisterMap(method, newMap);
+
+ if (dvmRegisterMapGetOnHeap(curMap))
+ dvmFreeRegisterMap((RegisterMap*) curMap);
+
+ return newMap;
+}
+
+
+/*
+ * ===========================================================================
+ * Map compression
+ * ===========================================================================
+ */
+
+/*
+Notes on map compression
+
+The idea is to create a compressed form that will be uncompressed before
+use, with the output possibly saved in a cache. This means we can use an
+approach that is unsuited for random access if we choose.
+
+In the event that a map simply does not work with our compression scheme,
+it's reasonable to store the map without compression. In the future we
+may want to have more than one compression scheme, and try each in turn,
+retaining the best. (We certainly want to keep the uncompressed form if it
+turns out to be smaller or even slightly larger than the compressed form.)
+
+Each entry consists of an address and a bit vector. Adjacent entries are
+strongly correlated, suggesting differential encoding.
+
+
+Ideally we would avoid outputting adjacent entries with identical
+bit vectors. However, the register values at a given address do not
+imply anything about the set of valid registers at subsequent addresses.
+We therefore cannot omit an entry.
+
+ If the thread stack has a PC at an address without a corresponding
+ entry in the register map, we must conservatively scan the registers in
+ that thread. This can happen when single-stepping in the debugger,
+ because the debugger is allowed to invoke arbitrary methods when
+ a thread is stopped at a breakpoint. If we can guarantee that a GC
+ thread scan will never happen while the debugger has that thread stopped,
+ then we can lift this restriction and simply omit entries that don't
+ change the bit vector from its previous state.
+
+Each entry advances the address value by at least 1 (measured in 16-bit
+"code units"). Looking at the bootclasspath entries, advancing by 2 units
+is most common. Advances by 1 unit are far less common than advances by
+2 units, but more common than 5, and things fall off rapidly. Gaps of
+up to 220 code units appear in some computationally intensive bits of code,
+but are exceedingly rare.
+
+If we sum up the number of transitions in a couple of ranges in framework.jar:
+ [1,4]: 188998 of 218922 gaps (86.3%)
+ [1,7]: 211647 of 218922 gaps (96.7%)
+Using a 3-bit delta, with one value reserved as an escape code, should
+yield good results for the address.
+
+These results would change dramatically if we reduced the set of GC
+points by e.g. removing instructions like integer divide that are only
+present because they can throw and cause an allocation.
+
+We also need to include an "initial gap", because the first few instructions
+in a method may not be GC points.
+
+
+By observation, many entries simply repeat the previous bit vector, or
+change only one or two bits. (This is with type-precise information;
+the rate of change of bits will be different if live-precise information
+is factored in).
+
+Looking again at adjacent entries in framework.jar:
+ 0 bits changed: 63.0%
+ 1 bit changed: 32.2%
+After that it falls off rapidly, e.g. the number of entries with 2 bits
+changed is usually less than 1/10th of the number of entries with 1 bit
+changed. A solution that allows us to encode 0- or 1- bit changes
+efficiently will do well.
+
+We still need to handle cases where a large number of bits change. We
+probably want a way to drop in a full copy of the bit vector when it's
+smaller than the representation of multiple bit changes.
+
+
+The bit-change information can be encoded as an index that tells the
+decoder to toggle the state. We want to encode the index in as few bits
+as possible, but we need to allow for fairly wide vectors (e.g. we have a
+method with 175 registers). We can deal with this in a couple of ways:
+(1) use an encoding that assumes few registers and has an escape code
+for larger numbers of registers; or (2) use different encodings based
+on how many total registers the method has. The choice depends to some
+extent on whether methods with large numbers of registers tend to modify
+the first 16 regs more often than the others.
+
+The last N registers hold method arguments. If the bytecode is expected
+to be examined in a debugger, "dx" ensures that the contents of these
+registers won't change. Depending upon the encoding format, we may be
+able to take advantage of this. We still have to encode the initial
+state, but we know we'll never have to output a bit change for the last
+N registers.
+
+Considering only methods with 16 or more registers, the "target octant"
+for register changes looks like this:
+ [ 43.1%, 16.4%, 6.5%, 6.2%, 7.4%, 8.8%, 9.7%, 1.8% ]
+As expected, there are fewer changes at the end of the list where the
+arguments are kept, and more changes at the start of the list because
+register values smaller than 16 can be used in compact Dalvik instructions
+and hence are favored for frequently-used values. In general, the first
+octant is considerably more active than later entries, the last octant
+is much less active, and the rest are all about the same.
+
+Looking at all bit changes in all methods, 94% are to registers 0-15. The
+encoding will benefit greatly by favoring the low-numbered registers.
+
+
+Some of the smaller methods have identical maps, and space could be
+saved by simply including a pointer to an earlier definition. This would
+be best accomplished by specifying a "pointer" format value, followed by
+a 3-byte (or ULEB128) offset. Implementing this would probably involve
+generating a hash value for each register map and maintaining a hash table.
+
+In some cases there are repeating patterns in the bit vector that aren't
+adjacent. These could benefit from a dictionary encoding. This doesn't
+really become useful until the methods reach a certain size though,
+and managing the dictionary may incur more overhead than we want.
+
+Large maps can be compressed significantly. The trouble is that, when
+we need to use them, we have to uncompress them onto the heap. We may
+get a better trade-off between storage size and heap usage by refusing to
+compress large maps, so that they can be memory mapped and used directly.
+(OTOH, only about 2% of the maps will ever actually be used.)
+
+
+----- differential format -----
+
+// common header
++00 1B format
++01 1B regWidth
++02 2B numEntries (little-endian)
++04 nB length in bytes of the data that follows, in ULEB128 format
+ (not strictly necessary; allows determination of size w/o full parse)
++05+ 1B initial address (0-127), high bit set if max addr >= 256
++06+ nB initial value for bit vector
+
+// for each entry
++00: CCCCBAAA
+
+ AAA: address difference. Values from 0 to 6 indicate an increment of 1
+ to 7. A value of 7 indicates that the address difference is large,
+ and the next byte is a ULEB128-encoded difference value.
+
+ B: determines the meaning of CCCC.
+
+ CCCC: if B is 0, this is the number of the bit to toggle (0-15).
+ If B is 1, this is a count of the number of changed bits (1-14). A value
+ of 0 means that no bits were changed, and a value of 15 indicates
+ that enough bits were changed that it required less space to output
+ the entire bit vector.
+
++01: (optional) ULEB128-encoded address difference
+
++01+: (optional) one or more ULEB128-encoded bit numbers, OR the entire
+ bit vector.
+
+The most common situation is an entry whose address has changed by 2-4
+code units, has no changes or just a single bit change, and the changed
+register is less than 16. We should therefore be able to encode a large
+number of entries with a single byte, which is half the size of the
+Compact8 encoding method.
+*/
+
+/*
+ * Compute some stats on an uncompressed register map.
+ */
+static void computeMapStats(RegisterMap* pMap, const Method* method)
+{
+#ifdef REGISTER_MAP_STATS
+ MapStats* pStats = (MapStats*) gDvm.registerMapStats;
+ const u1 format = dvmRegisterMapGetFormat(pMap);
+ const u2 numEntries = dvmRegisterMapGetNumEntries(pMap);
+ const u1* rawMap = pMap->data;
+ const u1* prevData = NULL;
+ int ent, addr, prevAddr = -1;
+
+ for (ent = 0; ent < numEntries; ent++) {
+ switch (format) {
+ case kRegMapFormatCompact8:
+ addr = *rawMap++;
+ break;
+ case kRegMapFormatCompact16:
+ addr = *rawMap++;
+ addr |= (*rawMap++) << 8;
+ break;
+ default:
+ /* shouldn't happen */
+ LOGE("GLITCH: bad format (%d)", format);
+ dvmAbort();
+ }
+
+ const u1* dataStart = rawMap;
+
+ pStats->totalGcPointCount++;
+
+ /*
+ * Gather "gap size" stats, i.e. the difference in addresses between
+ * successive GC points.
+ */
+ if (prevData != NULL) {
+ assert(prevAddr >= 0);
+ int addrDiff = addr - prevAddr;
+
+ if (addrDiff < 0) {
+ LOGE("GLITCH: address went backward (0x%04x->0x%04x, %s.%s)\n",
+ prevAddr, addr, method->clazz->descriptor, method->name);
+ } else if (addrDiff > kMaxGcPointGap) {
+ if (REGISTER_MAP_VERBOSE) {
+ LOGI("HEY: addrDiff is %d, max %d (0x%04x->0x%04x %s.%s)\n",
+ addrDiff, kMaxGcPointGap, prevAddr, addr,
+ method->clazz->descriptor, method->name);
+ }
+ /* skip this one */
+ } else {
+ pStats->gcPointGap[addrDiff]++;
+ }
+ pStats->gcGapCount++;
+
+
+ /*
+ * Compare bit vectors in adjacent entries. We want to count
+ * up the number of bits that differ (to see if we frequently
+ * change 0 or 1 bits) and get a sense for which part of the
+ * vector changes the most often (near the start, middle, end).
+ *
+ * We only do the vector position quantization if we have at
+ * least 16 registers in the method.
+ */
+ int numDiff = 0;
+ float div = (float) kNumUpdatePosns / method->registersSize;
+ int regByte;
+ for (regByte = 0; regByte < pMap->regWidth; regByte++) {
+ int prev, cur, bit;
+
+ prev = prevData[regByte];
+ cur = dataStart[regByte];
+
+ for (bit = 0; bit < 8; bit++) {
+ if (((prev >> bit) & 1) != ((cur >> bit) & 1)) {
+ numDiff++;
+
+ int bitNum = regByte * 8 + bit;
+
+ if (bitNum < 16)
+ pStats->updateLT16++;
+ else
+ pStats->updateGE16++;
+
+ if (method->registersSize < 16)
+ continue;
+
+ if (bitNum >= method->registersSize) {
+ /* stuff off the end should be zero in both */
+ LOGE("WEIRD: bit=%d (%d/%d), prev=%02x cur=%02x\n",
+ bit, regByte, method->registersSize,
+ prev, cur);
+ assert(false);
+ }
+ int idx = (int) (bitNum * div);
+ if (!(idx >= 0 && idx < kNumUpdatePosns)) {
+ LOGE("FAIL: bitNum=%d (of %d) div=%.3f idx=%d\n",
+ bitNum, method->registersSize, div, idx);
+ assert(false);
+ }
+ pStats->updatePosn[idx]++;
+ }
+ }
+ }
+
+ if (numDiff > kMaxDiffBits) {
+ if (REGISTER_MAP_VERBOSE) {
+ LOGI("WOW: numDiff is %d, max %d\n", numDiff, kMaxDiffBits);
+ }
+ } else {
+ pStats->numDiffBits[numDiff]++;
+ }
+ }
+
+ /* advance to start of next line */
+ rawMap += pMap->regWidth;
+
+ prevAddr = addr;
+ prevData = dataStart;
+ }
+#endif
+}
+
+
+/*
+ * Compute the difference between two bit vectors.
+ *
+ * If "lebOutBuf" is non-NULL, we output the bit indices in ULEB128 format
+ * as we go. Otherwise, we just generate the various counts.
+ *
+ * The bit vectors are compared byte-by-byte, so any unused bits at the
+ * end must be zero.
+ *
+ * Returns the number of bytes required to hold the ULEB128 output.
+ *
+ * If "pFirstBitChanged" or "pNumBitsChanged" are non-NULL, they will
+ * receive the index of the first changed bit and the number of changed
+ * bits, respectively.
+ */
+static int computeBitDiff(const u1* bits1, const u1* bits2, int byteWidth,
+ int* pFirstBitChanged, int* pNumBitsChanged, u1* lebOutBuf)
+{
+ int numBitsChanged = 0;
+ int firstBitChanged = -1;
+ int lebSize = 0;
+ int byteNum;
+
+ /*
+ * Run through the vectors, first comparing them at the byte level. This
+ * will yield a fairly quick result if nothing has changed between them.
+ */
+ for (byteNum = 0; byteNum < byteWidth; byteNum++) {
+ u1 byte1 = *bits1++;
+ u1 byte2 = *bits2++;
+ if (byte1 != byte2) {
+ /*
+ * Walk through the byte, identifying the changed bits.
+ */
+ int bitNum;
+ for (bitNum = 0; bitNum < 8; bitNum++) {
+ if (((byte1 >> bitNum) & 0x01) != ((byte2 >> bitNum) & 0x01)) {
+ int bitOffset = (byteNum << 3) + bitNum;
+
+ if (firstBitChanged < 0)
+ firstBitChanged = bitOffset;
+ numBitsChanged++;
+
+ if (lebOutBuf == NULL) {
+ lebSize += unsignedLeb128Size(bitOffset);
+ } else {
+ u1* curBuf = lebOutBuf;
+ lebOutBuf = writeUnsignedLeb128(lebOutBuf, bitOffset);
+ lebSize += lebOutBuf - curBuf;
+ }
+ }
+ }
+ }
+ }
+
+ if (numBitsChanged > 0)
+ assert(firstBitChanged >= 0);
+
+ if (pFirstBitChanged != NULL)
+ *pFirstBitChanged = firstBitChanged;
+ if (pNumBitsChanged != NULL)
+ *pNumBitsChanged = numBitsChanged;
+
+ return lebSize;
+}
+
+/*
+ * Compress the register map with differential encoding.
+ *
+ * "meth" is only needed for debug output.
+ *
+ * On success, returns a newly-allocated RegisterMap. If the map is not
+ * compatible for some reason, or fails to get smaller, this will return NULL.
+ */
+static RegisterMap* compressMapDifferential(const RegisterMap* pMap,
+ const Method* meth)
+{
+ RegisterMap* pNewMap = NULL;
+ int origSize = computeRegisterMapSize(pMap);
+ u1* tmpBuf = NULL;
+ u1* tmpPtr;
+ int addrWidth, regWidth, numEntries;
+ bool debug = false;
+
+ if (false &&
+ strcmp(meth->clazz->descriptor, "Landroid/text/StaticLayout;") == 0 &&
+ strcmp(meth->name, "generate") == 0)
+ {
+ debug = true;
+ }
+
+ u1 format = dvmRegisterMapGetFormat(pMap);
+ switch (format) {
+ case kRegMapFormatCompact8:
+ addrWidth = 1;
+ break;
+ case kRegMapFormatCompact16:
+ addrWidth = 2;
+ break;
+ default:
+ LOGE("ERROR: can't compress map with format=%d\n", format);
+ goto bail;
+ }
+
+ regWidth = dvmRegisterMapGetRegWidth(pMap);
+ numEntries = dvmRegisterMapGetNumEntries(pMap);
+
+ if (debug) {
+ LOGI("COMPRESS: %s.%s aw=%d rw=%d ne=%d\n",
+ meth->clazz->descriptor, meth->name,
+ addrWidth, regWidth, numEntries);
+ dumpRegisterMap(pMap, -1);
+ }
+
+ if (numEntries <= 1) {
+ LOGV("Can't compress map with 0 or 1 entries\n");
+ goto bail;
+ }
+
+ /*
+ * We don't know how large the compressed data will be. It's possible
+ * for it to expand and become larger than the original. The header
+ * itself is variable-sized, so we generate everything into a temporary
+ * buffer and then copy it to form-fitting storage once we know how big
+ * it will be (and that it's smaller than the original).
+ *
+ * If we use a size that is equal to the size of the input map plus
+ * a value longer than a single entry can possibly expand to, we need
+ * only check for overflow at the end of each entry. The worst case
+ * for a single line is (1 + <ULEB8 address> + <full copy of vector>).
+ * Addresses are 16 bits, so that's (1 + 3 + regWidth).
+ *
+ * The initial address offset and bit vector will take up less than
+ * or equal to the amount of space required when uncompressed -- large
+ * initial offsets are rejected.
+ */
+ tmpBuf = (u1*) malloc(origSize + (1 + 3 + regWidth));
+ if (tmpBuf == NULL)
+ goto bail;
+
+ tmpPtr = tmpBuf;
+
+ const u1* mapData = pMap->data;
+ const u1* prevBits;
+ u2 addr, prevAddr;
+
+ addr = *mapData++;
+ if (addrWidth > 1)
+ addr |= (*mapData++) << 8;
+
+ if (addr >= 128) {
+ LOGV("Can't compress map with starting address >= 128\n");
+ goto bail;
+ }
+
+ /*
+ * Start by writing the initial address and bit vector data. The high
+ * bit of the initial address is used to indicate the required address
+ * width (which the decoder can't otherwise determine without parsing
+ * the compressed data).
+ */
+ *tmpPtr++ = addr | (addrWidth > 1 ? 0x80 : 0x00);
+ memcpy(tmpPtr, mapData, regWidth);
+
+ prevBits = mapData;
+ prevAddr = addr;
+
+ tmpPtr += regWidth;
+ mapData += regWidth;
+
+ /*
+ * Loop over all following entries.
+ */
+ int entry;
+ for (entry = 1; entry < numEntries; entry++) {
+ int addrDiff;
+ u1 key;
+
+ /*
+ * Pull out the address and figure out how to encode it.
+ */
+ addr = *mapData++;
+ if (addrWidth > 1)
+ addr |= (*mapData++) << 8;
+
+ if (debug)
+ LOGI(" addr=0x%04x ent=%d (aw=%d)\n", addr, entry, addrWidth);
+
+ addrDiff = addr - prevAddr;
+ assert(addrDiff > 0);
+ if (addrDiff < 8) {
+ /* small difference, encode in 3 bits */
+ key = addrDiff -1; /* set 00000AAA */
+ if (debug)
+ LOGI(" : small %d, key=0x%02x\n", addrDiff, key);
+ } else {
+ /* large difference, output escape code */
+ key = 0x07; /* escape code for AAA */
+ if (debug)
+ LOGI(" : large %d, key=0x%02x\n", addrDiff, key);
+ }
+
+ int numBitsChanged, firstBitChanged, lebSize;
+
+ lebSize = computeBitDiff(prevBits, mapData, regWidth,
+ &firstBitChanged, &numBitsChanged, NULL);
+
+ if (debug) {
+ LOGI(" : diff fbc=%d nbc=%d ls=%d (rw=%d)\n",
+ firstBitChanged, numBitsChanged, lebSize, regWidth);
+ }
+
+ if (numBitsChanged == 0) {
+ /* set B to 1 and CCCC to zero to indicate no bits were changed */
+ key |= 0x08;
+ if (debug) LOGI(" : no bits changed\n");
+ } else if (numBitsChanged == 1 && firstBitChanged < 16) {
+ /* set B to 0 and CCCC to the index of the changed bit */
+ key |= firstBitChanged << 4;
+ if (debug) LOGI(" : 1 low bit changed\n");
+ } else if (numBitsChanged < 15 && lebSize < regWidth) {
+ /* set B to 1 and CCCC to the number of bits */
+ key |= 0x08 | (numBitsChanged << 4);
+ if (debug) LOGI(" : some bits changed\n");
+ } else {
+ /* set B to 1 and CCCC to 0x0f so we store the entire vector */
+ key |= 0x08 | 0xf0;
+ if (debug) LOGI(" : encode original\n");
+ }
+
+ /*
+ * Encode output. Start with the key, follow with the address
+ * diff (if it didn't fit in 3 bits), then the changed bit info.
+ */
+ *tmpPtr++ = key;
+ if ((key & 0x07) == 0x07)
+ tmpPtr = writeUnsignedLeb128(tmpPtr, addrDiff);
+
+ if ((key & 0x08) != 0) {
+ int bitCount = key >> 4;
+ if (bitCount == 0) {
+ /* nothing changed, no additional output required */
+ } else if (bitCount == 15) {
+ /* full vector is most compact representation */
+ memcpy(tmpPtr, mapData, regWidth);
+ tmpPtr += regWidth;
+ } else {
+ /* write bit indices in LEB128 format */
+ (void) computeBitDiff(prevBits, mapData, regWidth,
+ NULL, NULL, tmpPtr);
+ tmpPtr += lebSize;
+ }
+ } else {
+ /* single-bit changed, value encoded in key byte */
+ }
+
+ prevBits = mapData;
+ prevAddr = addr;
+ mapData += regWidth;
+
+ /*
+ * See if we've run past the original size.
+ */
+ if (tmpPtr - tmpBuf >= origSize) {
+ if (debug) {
+ LOGD("Compressed size >= original (%d vs %d): %s.%s\n",
+ tmpPtr - tmpBuf, origSize,
+ meth->clazz->descriptor, meth->name);
+ }
+ goto bail;
+ }
+ }
+
+ /*
+ * Create a RegisterMap with the contents.
+ *
+ * TODO: consider using a threshold other than merely ">=". We would
+ * get poorer compression but potentially use less native heap space.
+ */
+ static const int kHeaderSize = offsetof(RegisterMap, data);
+ int newDataSize = tmpPtr - tmpBuf;
+ int newMapSize;
+
+ newMapSize = kHeaderSize + unsignedLeb128Size(newDataSize) + newDataSize;
+ if (newMapSize >= origSize) {
+ if (debug) {
+ LOGD("Final comp size >= original (%d vs %d): %s.%s\n",
+ newMapSize, origSize, meth->clazz->descriptor, meth->name);
+ }
+ goto bail;
+ }
+
+ pNewMap = (RegisterMap*) malloc(newMapSize);
+ if (pNewMap == NULL)
+ goto bail;
+ dvmRegisterMapSetFormat(pNewMap, kRegMapFormatDifferential);
+ dvmRegisterMapSetOnHeap(pNewMap, true);
+ dvmRegisterMapSetRegWidth(pNewMap, regWidth);
+ dvmRegisterMapSetNumEntries(pNewMap, numEntries);
+
+ tmpPtr = pNewMap->data;
+ tmpPtr = writeUnsignedLeb128(tmpPtr, newDataSize);
+ memcpy(tmpPtr, tmpBuf, newDataSize);
+
+ if (REGISTER_MAP_VERBOSE) {
+ LOGD("Compression successful (%d -> %d) from aw=%d rw=%d ne=%d\n",
+ computeRegisterMapSize(pMap), computeRegisterMapSize(pNewMap),
+ addrWidth, regWidth, numEntries);
+ }
+
+bail:
+ free(tmpBuf);
+ return pNewMap;
+}
+
+/*
+ * Toggle the value of the "idx"th bit in "ptr".
+ */
+static inline void toggleBit(u1* ptr, int idx)
+{
+ ptr[idx >> 3] ^= 1 << (idx & 0x07);
+}
+
+/*
+ * Expand a compressed map to an uncompressed form.
+ *
+ * Returns a newly-allocated RegisterMap on success, or NULL on failure.
+ *
+ * TODO: consider using the linear allocator or a custom allocator with
+ * LRU replacement for these instead of the native heap.
+ */
+static RegisterMap* uncompressMapDifferential(const RegisterMap* pMap)
+{
+ RegisterMap* pNewMap = NULL;
+ static const int kHeaderSize = offsetof(RegisterMap, data);
+ u1 format = dvmRegisterMapGetFormat(pMap);
+ RegisterMapFormat newFormat;
+ int regWidth, numEntries, newAddrWidth, newMapSize;
+
+ if (format != kRegMapFormatDifferential) {
+ LOGE("Not differential (%d)\n", format);
+ goto bail;
+ }
+
+ regWidth = dvmRegisterMapGetRegWidth(pMap);
+ numEntries = dvmRegisterMapGetNumEntries(pMap);
+
+ /* get the data size; we can check this at the end */
+ const u1* srcPtr = pMap->data;
+ int expectedSrcLen = readUnsignedLeb128(&srcPtr);
+ const u1* srcStart = srcPtr;
+
+ /* get the initial address and the 16-bit address flag */
+ int addr = *srcPtr & 0x7f;
+ if ((*srcPtr & 0x80) == 0) {
+ newFormat = kRegMapFormatCompact8;
+ newAddrWidth = 1;
+ } else {
+ newFormat = kRegMapFormatCompact16;
+ newAddrWidth = 2;
+ }
+ srcPtr++;
+
+ /* now we know enough to allocate the new map */
+ if (REGISTER_MAP_VERBOSE) {
+ LOGI("Expanding to map aw=%d rw=%d ne=%d\n",
+ newAddrWidth, regWidth, numEntries);
+ }
+ newMapSize = kHeaderSize + (newAddrWidth + regWidth) * numEntries;
+ pNewMap = (RegisterMap*) malloc(newMapSize);
+ if (pNewMap == NULL)
+ goto bail;
+
+ dvmRegisterMapSetFormat(pNewMap, newFormat);
+ dvmRegisterMapSetOnHeap(pNewMap, true);
+ dvmRegisterMapSetRegWidth(pNewMap, regWidth);
+ dvmRegisterMapSetNumEntries(pNewMap, numEntries);
+
+ /*
+ * Write the start address and initial bits to the new map.
+ */
+ u1* dstPtr = pNewMap->data;
+
+ *dstPtr++ = addr & 0xff;
+ if (newAddrWidth > 1)
+ *dstPtr++ = (u1) (addr >> 8);
+
+ memcpy(dstPtr, srcPtr, regWidth);
+
+ int prevAddr = addr;
+ const u1* prevBits = dstPtr; /* point at uncompressed data */
+
+ dstPtr += regWidth;
+ srcPtr += regWidth;
+
+ /*
+ * Walk through, uncompressing one line at a time.
+ */
+ int entry;
+ for (entry = 1; entry < numEntries; entry++) {
+ int addrDiff;
+ u1 key;
+
+ key = *srcPtr++;
+
+ /* get the address */
+ if ((key & 0x07) == 7) {
+ /* address diff follows in ULEB128 */
+ addrDiff = readUnsignedLeb128(&srcPtr);
+ } else {
+ addrDiff = (key & 0x07) +1;
+ }
+
+ addr = prevAddr + addrDiff;
+ *dstPtr++ = addr & 0xff;
+ if (newAddrWidth > 1)
+ *dstPtr++ = (u1) (addr >> 8);
+
+ /* unpack the bits */
+ if ((key & 0x08) != 0) {
+ int bitCount = (key >> 4);
+ if (bitCount == 0) {
+ /* no bits changed, just copy previous */
+ memcpy(dstPtr, prevBits, regWidth);
+ } else if (bitCount == 15) {
+ /* full copy of bit vector is present; ignore prevBits */
+ memcpy(dstPtr, srcPtr, regWidth);
+ srcPtr += regWidth;
+ } else {
+ /* copy previous bits and modify listed indices */
+ memcpy(dstPtr, prevBits, regWidth);
+ while (bitCount--) {
+ int bitIndex = readUnsignedLeb128(&srcPtr);
+ toggleBit(dstPtr, bitIndex);
+ }
+ }
+ } else {
+ /* copy previous bits and modify the specified one */
+ memcpy(dstPtr, prevBits, regWidth);
+
+ /* one bit, from 0-15 inclusive, was changed */
+ toggleBit(dstPtr, key >> 4);
+ }
+
+ prevAddr = addr;
+ prevBits = dstPtr;
+ dstPtr += regWidth;
+ }
+
+ if (dstPtr - (u1*) pNewMap != newMapSize) {
+ LOGE("ERROR: output %d bytes, expected %d\n",
+ dstPtr - (u1*) pNewMap, newMapSize);
+ goto bail;
+ }
+
+ if (srcPtr - srcStart != expectedSrcLen) {
+ LOGE("ERROR: consumed %d bytes, expected %d\n",
+ srcPtr - srcStart, expectedSrcLen);
+ goto bail;
+ }
+
+ if (REGISTER_MAP_VERBOSE) {
+ LOGD("Expansion successful (%d -> %d)\n",
+ computeRegisterMapSize(pMap), computeRegisterMapSize(pNewMap));
+ }
+
+ return pNewMap;
+
+bail:
+ free(pNewMap);
+ return NULL;
+}
+
+
+/*
+ * ===========================================================================
+ * Just-in-time generation
+ * ===========================================================================
+ */
+
+#if 0 /* incomplete implementation; may be removed entirely in the future */
/*
Notes on just-in-time RegisterMap generation
@@ -82,239 +1899,6 @@
an effort should be made to minimize memory use.
*/
-// fwd
-static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data);
-static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap);
-
-/*
- * Generate the register map for a method that has just been verified
- * (i.e. we're doing this as part of verification).
- *
- * For type-precise determination we have all the data we need, so we
- * just need to encode it in some clever fashion.
- *
- * Returns a pointer to a newly-allocated RegisterMap, or NULL on failure.
- */
-RegisterMap* dvmGenerateRegisterMapV(VerifierData* vdata)
-{
- RegisterMap* pMap = NULL;
- RegisterMap* pResult = NULL;
- RegisterMapFormat format;
- u1 regWidth;
- u1* mapData;
- int i, bytesForAddr, gcPointCount;
- int bufSize;
-
- regWidth = (vdata->method->registersSize + 7) / 8;
- if (vdata->insnsSize < 256) {
- format = kFormatCompact8;
- bytesForAddr = 1;
- } else {
- format = kFormatCompact16;
- bytesForAddr = 2;
- }
-
- /*
- * Count up the number of GC point instructions.
- *
- * NOTE: this does not automatically include the first instruction,
- * since we don't count method entry as a GC point.
- */
- gcPointCount = 0;
- for (i = 0; i < vdata->insnsSize; i++) {
- if (dvmInsnIsGcPoint(vdata->insnFlags, i))
- gcPointCount++;
- }
- if (gcPointCount >= 65536) {
- /* we could handle this, but in practice we don't get near this */
- LOGE("ERROR: register map can't handle %d gc points in one method\n",
- gcPointCount);
- goto bail;
- }
-
- /*
- * Allocate a buffer to hold the map data.
- */
- bufSize = offsetof(RegisterMap, data);
- bufSize += gcPointCount * (bytesForAddr + regWidth);
-
- LOGD("+++ grm: %s.%s (adr=%d gpc=%d rwd=%d bsz=%d)\n",
- vdata->method->clazz->descriptor, vdata->method->name,
- bytesForAddr, gcPointCount, regWidth, bufSize);
-
- pMap = (RegisterMap*) malloc(bufSize);
- pMap->format = format;
- pMap->regWidth = regWidth;
- pMap->numEntries = gcPointCount;
-
- /*
- * Populate it.
- */
- mapData = pMap->data;
- for (i = 0; i < vdata->insnsSize; i++) {
- if (dvmInsnIsGcPoint(vdata->insnFlags, i)) {
- assert(vdata->addrRegs[i] != NULL);
- if (format == kFormatCompact8) {
- *mapData++ = i;
- } else /*kFormatCompact16*/ {
- *mapData++ = i & 0xff;
- *mapData++ = i >> 8;
- }
- outputTypeVector(vdata->addrRegs[i], vdata->insnRegCount, mapData);
- mapData += regWidth;
- }
- }
-
- LOGI("mapData=%p pMap=%p bufSize=%d\n", mapData, pMap, bufSize);
- assert(mapData - (const u1*) pMap == bufSize);
-
-#if 1
- if (!verifyMap(vdata, pMap))
- goto bail;
-#endif
-
- pResult = pMap;
-
-bail:
- return pResult;
-}
-
-/*
- * Release the storage held by a RegisterMap.
- */
-void dvmFreeRegisterMap(RegisterMap* pMap)
-{
- if (pMap == NULL)
- return;
-
- free(pMap);
-}
-
-/*
- * Determine if the RegType value is a reference type.
- *
- * Ordinarily we include kRegTypeZero in the "is it a reference"
- * check. There's no value in doing so here, because we know
- * the register can't hold anything but zero.
- */
-static inline bool isReferenceType(RegType type)
-{
- return (type > kRegTypeMAX || type == kRegTypeUninit);
-}
-
-/*
- * Given a line of registers, output a bit vector that indicates whether
- * or not the register holds a reference type (which could be null).
- *
- * We use '1' to indicate it's a reference, '0' for anything else (numeric
- * value, uninitialized data, merge conflict). Register 0 will be found
- * in the low bit of the first byte.
- */
-static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data)
-{
- u1 val = 0;
- int i;
-
- for (i = 0; i < insnRegCount; i++) {
- RegType type = *regs++;
- val >>= 1;
- if (isReferenceType(type))
- val |= 0x80; /* set hi bit */
-
- if ((i & 0x07) == 7)
- *data++ = val;
- }
- if ((i & 0x07) != 0) {
- /* flush bits from last byte */
- val >>= 8 - (i & 0x07);
- *data++ = val;
- }
-}
-
-/*
- * Double-check the map.
- *
- * We run through all of the data in the map, and compare it to the original.
- */
-static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap)
-{
- const u1* data = pMap->data;
- int ent;
-
- for (ent = 0; ent < pMap->numEntries; ent++) {
- int addr;
-
- switch (pMap->format) {
- case kFormatCompact8:
- addr = *data++;
- break;
- case kFormatCompact16:
- addr = *data++;
- addr |= (*data++) << 8;
- break;
- default:
- /* shouldn't happen */
- LOGE("GLITCH: bad format (%d)", pMap->format);
- dvmAbort();
- }
-
- const RegType* regs = vdata->addrRegs[addr];
- if (regs == NULL) {
- LOGE("GLITCH: addr %d has no data\n", addr);
- return false;
- }
-
- u1 val;
- int i;
-
- for (i = 0; i < vdata->method->registersSize; i++) {
- bool bitIsRef, regIsRef;
-
- val >>= 1;
- if ((i & 0x07) == 0) {
- /* load next byte of data */
- val = *data++;
- }
-
- bitIsRef = val & 0x01;
-
- RegType type = regs[i];
- regIsRef = isReferenceType(type);
-
- if (bitIsRef != regIsRef) {
- LOGE("GLITCH: addr %d reg %d: bit=%d reg=%d(%d)\n",
- addr, i, bitIsRef, regIsRef, type);
- return false;
- }
- }
-
- /* print the map as a binary string */
- if (false) {
- char outBuf[vdata->method->registersSize +1];
- for (i = 0; i < vdata->method->registersSize; i++) {
- if (isReferenceType(regs[i])) {
- outBuf[i] = '1';
- } else {
- outBuf[i] = '0';
- }
- }
- outBuf[i] = '\0';
- LOGD(" %04d %s\n", addr, outBuf);
- }
- }
-
- return true;
-}
-
-
-/*
- * ===========================================================================
- * Just-in-time generation
- * ===========================================================================
- */
-
-#if 0 /* incomplete implementation; may be removed entirely in the future */
-
/*
* This is like RegType in the verifier, but simplified. It holds a value
* from the reg type enum, or kRegTypeReference.
diff --git a/vm/analysis/RegisterMap.h b/vm/analysis/RegisterMap.h
index 2a890e7..dc17b1d 100644
--- a/vm/analysis/RegisterMap.h
+++ b/vm/analysis/RegisterMap.h
@@ -14,38 +14,221 @@
* limitations under the License.
*/
-// ** UNDER CONSTRUCTION **
-
/*
* Declaration of register map data structure and related functions.
+ *
+ * These structures should be treated as opaque through most of the VM.
*/
#ifndef _DALVIK_REGISTERMAP
#define _DALVIK_REGISTERMAP
+#include "analysis/VerifySubs.h"
+#include "analysis/CodeVerify.h"
+
/*
* Format enumeration for RegisterMap data area.
*/
typedef enum RegisterMapFormat {
- kFormatUnknown = 0,
- kFormatCompact8, /* compact layout, 8-bit addresses */
- kFormatCompact16, /* compact layout, 16-bit addresses */
- // TODO: compressed stream
+ kRegMapFormatUnknown = 0,
+ kRegMapFormatNone, /* indicates no map data follows */
+ kRegMapFormatCompact8, /* compact layout, 8-bit addresses */
+ kRegMapFormatCompact16, /* compact layout, 16-bit addresses */
+ kRegMapFormatDifferential, /* compressed, differential encoding */
+
+ kRegMapFormatOnHeap = 0x80, /* bit flag, indicates allocation on heap */
} RegisterMapFormat;
/*
* This is a single variable-size structure. It may be allocated on the
* heap or mapped out of a (post-dexopt) DEX file.
+ *
+ * 32-bit alignment of the structure is NOT guaranteed. This makes it a
+ * little awkward to deal with as a structure; to avoid accidents we use
+ * only byte types. Multi-byte values are little-endian.
+ *
+ * Size of (format==FormatNone): 1 byte
+ * Size of (format==FormatCompact8): 4 + (1 + regWidth) * numEntries
+ * Size of (format==FormatCompact16): 4 + (2 + regWidth) * numEntries
*/
struct RegisterMap {
/* header */
- u1 format; /* enum RegisterMapFormat */
+ u1 format; /* enum RegisterMapFormat; MUST be first entry */
u1 regWidth; /* bytes per register line, 1+ */
- u2 numEntries; /* number of entries */
+ u1 numEntries[2]; /* number of entries */
- /* data starts here; no alignment guarantees made */
+ /* raw data starts here; need not be aligned */
u1 data[1];
};
+bool dvmRegisterMapStartup(void);
+void dvmRegisterMapShutdown(void);
+
+/*
+ * Get the format.
+ */
+INLINE RegisterMapFormat dvmRegisterMapGetFormat(const RegisterMap* pMap) {
+ return pMap->format & ~(kRegMapFormatOnHeap);
+}
+
+/*
+ * Set the format.
+ */
+INLINE void dvmRegisterMapSetFormat(RegisterMap* pMap, RegisterMapFormat format)
+{
+ pMap->format &= kRegMapFormatOnHeap;
+ pMap->format |= format;
+}
+
+/*
+ * Get the "on heap" flag.
+ */
+INLINE bool dvmRegisterMapGetOnHeap(const RegisterMap* pMap) {
+ return (pMap->format & kRegMapFormatOnHeap) != 0;
+}
+
+/*
+ * Get the register bit vector width, in bytes.
+ */
+INLINE u1 dvmRegisterMapGetRegWidth(const RegisterMap* pMap) {
+ return pMap->regWidth;
+}
+
+/*
+ * Set the register bit vector width, in bytes.
+ */
+INLINE void dvmRegisterMapSetRegWidth(RegisterMap* pMap, int regWidth) {
+ pMap->regWidth = regWidth;
+}
+
+/*
+ * Set the "on heap" flag.
+ */
+INLINE void dvmRegisterMapSetOnHeap(RegisterMap* pMap, bool val) {
+ if (val)
+ pMap->format |= kRegMapFormatOnHeap;
+ else
+ pMap->format &= ~(kRegMapFormatOnHeap);
+}
+
+/*
+ * Get the number of entries in this map.
+ */
+INLINE u2 dvmRegisterMapGetNumEntries(const RegisterMap* pMap) {
+ return pMap->numEntries[0] | (pMap->numEntries[1] << 8);
+}
+
+/*
+ * Set the number of entries in this map.
+ */
+INLINE void dvmRegisterMapSetNumEntries(RegisterMap* pMap, u2 numEntries) {
+ pMap->numEntries[0] = (u1) numEntries;
+ pMap->numEntries[1] = numEntries >> 8;
+}
+
+/*
+ * Retrieve the bit vector for the specified address. This is a pointer
+ * to the bit data from an uncompressed map, or to a temporary copy of
+ * data from a compressed map.
+ *
+ * The caller must call dvmReleaseRegisterMapLine() with the result.
+ *
+ * Returns NULL if not found.
+ */
+const u1* dvmRegisterMapGetLine(const RegisterMap* pMap, int addr);
+
+/*
+ * Release "data".
+ *
+ * If "pMap" points to a compressed map from which we have expanded a
+ * single line onto the heap, this will free "data"; otherwise, it does
+ * nothing.
+ *
+ * TODO: decide if this is still a useful concept.
+ */
+INLINE void dvmReleaseRegisterMapLine(const RegisterMap* pMap, const u1* data)
+{}
+
+
+/*
+ * A pool of register maps for methods associated with a single class.
+ *
+ * Each entry is a 4-byte method index followed by the 32-bit-aligned
+ * RegisterMap. The size of the RegisterMap is determined by parsing
+ * the map. The lack of an index reduces random access speed, but we
+ * should be doing that rarely (during class load) and it saves space.
+ *
+ * These structures are 32-bit aligned.
+ */
+typedef struct RegisterMapMethodPool {
+ u2 methodCount; /* chiefly used as a sanity check */
+
+ /* stream of per-method data starts here */
+ u4 methodData[1];
+} RegisterMapMethodPool;
+
+/*
+ * Header for the memory-mapped RegisterMap pool in the DEX file.
+ *
+ * The classDataOffset table provides offsets from the start of the
+ * RegisterMapPool structure. There is one entry per class (including
+ * interfaces, which can have static initializers).
+ *
+ * The offset points to a RegisterMapMethodPool.
+ *
+ * These structures are 32-bit aligned.
+ */
+typedef struct RegisterMapClassPool {
+ u4 numClasses;
+
+ /* offset table starts here, 32-bit aligned; offset==0 means no data */
+ u4 classDataOffset[1];
+} RegisterMapClassPool;
+
+/*
+ * Find the register maps for this class. (Used during class loading.)
+ * If "pNumMaps" is non-NULL, it will return the number of maps in the set.
+ *
+ * Returns NULL if none is available.
+ */
+const void* dvmRegisterMapGetClassData(const DexFile* pDexFile, u4 classIdx,
+ u4* pNumMaps);
+
+/*
+ * Get the register map for the next method. "*pPtr" will be advanced past
+ * the end of the map. (Used during class loading.)
+ *
+ * This should initially be called with the result from
+ * dvmRegisterMapGetClassData().
+ */
+const RegisterMap* dvmRegisterMapGetNext(const void** pPtr);
+
+/*
+ * This holds some meta-data while we construct the set of register maps
+ * for a DEX file.
+ *
+ * In particular, it keeps track of our temporary mmap region so we can
+ * free it later.
+ */
+typedef struct RegisterMapBuilder {
+ /* public */
+ void* data;
+ size_t size;
+
+ /* private */
+ MemMapping memMap;
+} RegisterMapBuilder;
+
+/*
+ * Generate a register map set for all verified classes in "pDvmDex".
+ */
+RegisterMapBuilder* dvmGenerateRegisterMaps(DvmDex* pDvmDex);
+
+/*
+ * Free the builder.
+ */
+void dvmFreeRegisterMapBuilder(RegisterMapBuilder* pBuilder);
+
+
/*
* Generate the register map for a previously-verified method.
*
@@ -97,4 +280,31 @@
*/
RegisterMap* dvmGenerateRegisterMapV(VerifierData* vdata);
+/*
+ * Get the expanded form of the register map associated with the specified
+ * method. May update method->registerMap, possibly freeing the previous
+ * map.
+ *
+ * Returns NULL on failure (e.g. unable to expand map).
+ *
+ * NOTE: this function is not synchronized; external locking is mandatory.
+ * (This is expected to be called at GC time.)
+ */
+const RegisterMap* dvmGetExpandedRegisterMap0(Method* method);
+INLINE const RegisterMap* dvmGetExpandedRegisterMap(Method* method)
+{
+ const RegisterMap* curMap = method->registerMap;
+ if (curMap == NULL)
+ return NULL;
+ RegisterMapFormat format = dvmRegisterMapGetFormat(curMap);
+ if (format == kRegMapFormatCompact8 || format == kRegMapFormatCompact16) {
+ return curMap;
+ } else {
+ return dvmGetExpandedRegisterMap0(method);
+ }
+}
+
+/* dump stats gathered during register map creation process */
+void dvmRegisterMapDumpStats(void);
+
#endif /*_DALVIK_REGISTERMAP*/
diff --git a/vm/analysis/VerifySubs.h b/vm/analysis/VerifySubs.h
index 4d5b57c..a87c6f1 100644
--- a/vm/analysis/VerifySubs.h
+++ b/vm/analysis/VerifySubs.h
@@ -57,7 +57,11 @@
#define LOG_VFY_METH(_meth, ...) dvmLogVerifyFailure(_meth, __VA_ARGS__)
/* log verification failure with optional method info */
-void dvmLogVerifyFailure(const Method* meth, const char* format, ...);
+void dvmLogVerifyFailure(const Method* meth, const char* format, ...)
+#if defined(__GNUC__)
+ __attribute__ ((format(printf, 2, 3)))
+#endif
+ ;
/* log verification failure due to resolution trouble */
void dvmLogUnableToResolveClass(const char* missingClassDescr,
diff --git a/vm/arch/arm/CallEABI.S b/vm/arch/arm/CallEABI.S
index a98473f..25441f4 100644
--- a/vm/arch/arm/CallEABI.S
+++ b/vm/arch/arm/CallEABI.S
@@ -239,7 +239,12 @@
@ call the method
ldr ip, [r4, #8] @ func
+#ifdef __ARM_HAVE_BLX
blx ip
+#else
+ mov lr, pc
+ bx ip
+#endif
@ We're back, result is in r0 or (for long/double) r0-r1.
@
diff --git a/vm/interp/Interp.c b/vm/interp/Interp.c
index 27b9582..d2643de 100644
--- a/vm/interp/Interp.c
+++ b/vm/interp/Interp.c
@@ -389,6 +389,7 @@
static inline s4 s4FromSwitchData(const void* switchData) {
u2* data = switchData;
return data[0] | (((s4) data[1]) << 16);
+}
#endif
/*
diff --git a/vm/interp/Stack.c b/vm/interp/Stack.c
index 103d2b4..730b1a8 100644
--- a/vm/interp/Stack.c
+++ b/vm/interp/Stack.c
@@ -76,9 +76,10 @@
if (stackPtr - stackReq < self->interpStackEnd) {
/* not enough space */
- LOGW("Stack overflow on call to interp (top=%p cur=%p size=%d %s.%s)\n",
- self->interpStackStart, self->curFrame, self->interpStackSize,
- method->clazz->descriptor, method->name);
+ LOGW("Stack overflow on call to interp "
+ "(req=%d top=%p cur=%p size=%d %s.%s)\n",
+ stackReq, self->interpStackStart, self->curFrame,
+ self->interpStackSize, method->clazz->descriptor, method->name);
dvmHandleStackOverflow(self);
assert(dvmCheckException(self));
return false;
@@ -148,9 +149,10 @@
if (stackPtr - stackReq < self->interpStackEnd) {
/* not enough space */
- LOGW("Stack overflow on call to native (top=%p cur=%p size=%d '%s')\n",
- self->interpStackStart, self->curFrame, self->interpStackSize,
- method->name);
+ LOGW("Stack overflow on call to native "
+ "(req=%d top=%p cur=%p size=%d '%s')\n",
+ stackReq, self->interpStackStart, self->curFrame,
+ self->interpStackSize, method->name);
dvmHandleStackOverflow(self);
assert(dvmCheckException(self));
return false;
@@ -217,9 +219,10 @@
if (stackPtr - stackReq < self->interpStackEnd) {
/* not enough space; let JNI throw the exception */
- LOGW("Stack overflow on PushLocal (top=%p cur=%p size=%d '%s')\n",
- self->interpStackStart, self->curFrame, self->interpStackSize,
- method->name);
+ LOGW("Stack overflow on PushLocal "
+ "(req=%d top=%p cur=%p size=%d '%s')\n",
+ stackReq, self->interpStackStart, self->curFrame,
+ self->interpStackSize, method->name);
dvmHandleStackOverflow(self);
assert(dvmCheckException(self));
return false;
@@ -351,7 +354,8 @@
#ifndef NDEBUG
if (self->status != THREAD_RUNNING) {
- LOGW("Status=%d on call to %s.%s -\n", self->status,
+ LOGW("threadid=%d: status=%d on call to %s.%s -\n",
+ self->threadId, self->status,
method->clazz->descriptor, method->name);
}
#endif
@@ -504,11 +508,17 @@
//dvmDumpThreadStack(dvmThreadSelf());
if (dvmIsNativeMethod(method)) {
+#ifdef WITH_PROFILER
+ TRACE_METHOD_ENTER(self, method);
+#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, pResult, method, self);
+#ifdef WITH_PROFILER
+ TRACE_METHOD_EXIT(self, method);
+#endif
} else {
dvmInterpret(self, method, pResult);
}
@@ -608,11 +618,17 @@
#endif
if (dvmIsNativeMethod(method)) {
+#ifdef WITH_PROFILER
+ TRACE_METHOD_ENTER(self, method);
+#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, pResult, method, self);
+#ifdef WITH_PROFILER
+ TRACE_METHOD_EXIT(self, method);
+#endif
} else {
dvmInterpret(self, method, pResult);
}
@@ -712,11 +728,17 @@
//dvmDumpThreadStack(dvmThreadSelf());
if (dvmIsNativeMethod(method)) {
+#ifdef WITH_PROFILER
+ TRACE_METHOD_ENTER(self, method);
+#endif
/*
* Because we leave no space for local variables, "curFrame" points
* directly at the method arguments.
*/
(*method->nativeFunc)(self->curFrame, &retval, method, self);
+#ifdef WITH_PROFILER
+ TRACE_METHOD_EXIT(self, method);
+#endif
} else {
dvmInterpret(self, method, &retval);
}
diff --git a/vm/mterp/armv5te/OP_MONITOR_ENTER.S b/vm/mterp/armv5te/OP_MONITOR_ENTER.S
index 6d4c2d8..524621a 100644
--- a/vm/mterp/armv5te/OP_MONITOR_ENTER.S
+++ b/vm/mterp/armv5te/OP_MONITOR_ENTER.S
@@ -8,9 +8,7 @@
GET_VREG(r1, r2) @ r1<- vAA (object)
ldr r0, [rGLUE, #offGlue_self] @ r0<- glue->self
cmp r1, #0 @ null object?
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC() @ export PC so we can grab stack trace
-#endif
+ EXPORT_PC() @ need for precise GC, MONITOR_TRACKING
beq common_errNullObject @ null object, throw an exception
FETCH_ADVANCE_INST(1) @ advance rPC, load rINST
bl dvmLockObject @ call(self, obj)
diff --git a/vm/mterp/armv5te/footer.S b/vm/mterp/armv5te/footer.S
index 8f7cc41..22ad65a 100644
--- a/vm/mterp/armv5te/footer.S
+++ b/vm/mterp/armv5te/footer.S
@@ -54,7 +54,7 @@
#endif
cmp r3, #0 @ suspend pending?
- bne 2f @ yes, check suspend
+ bne 2f @ yes, do full suspension check
#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
# if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
@@ -72,6 +72,7 @@
2: @ check suspend
ldr r0, [rGLUE, #offGlue_self] @ r0<- glue->self
+ EXPORT_PC() @ need for precise GC
b dvmCheckSuspendPending @ suspend if necessary, then return
3: @ debugger/profiler enabled, bail out
@@ -119,10 +120,12 @@
@ (very few methods have > 10 args; could unroll for common cases)
add r3, rFP, r1, lsl #2 @ r3<- &fp[CCCC]
sub r10, r10, r2, lsl #2 @ r10<- "outs" area, for call args
+ ldrh r9, [r0, #offMethod_registersSize] @ r9<- methodToCall->regsSize
1: ldr r1, [r3], #4 @ val = *fp++
subs r2, r2, #1 @ count--
str r1, [r10], #4 @ *outs++ = val
bne 1b @ ...while count != 0
+ ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
b .LinvokeArgsDone
/*
@@ -136,47 +139,50 @@
@ prepare to copy args to "outs" area of current frame
movs r2, rINST, lsr #12 @ r2<- B (arg count) -- test for zero
SAVEAREA_FROM_FP(r10, rFP) @ r10<- stack save area
- beq .LinvokeArgsDone @ if no args, skip the rest
- FETCH(r1, 2) @ r1<- GFED
+ FETCH(r1, 2) @ r1<- GFED (load here to hide latency)
+ ldrh r9, [r0, #offMethod_registersSize] @ r9<- methodToCall->regsSize
+ ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
+ beq .LinvokeArgsDone
- @ r0=methodToCall, r1=GFED, r2=count, r10=outs
+ @ r0=methodToCall, r1=GFED, r3=outSize, r2=count, r9=regSize, r10=outs
.LinvokeNonRange:
rsb r2, r2, #5 @ r2<- 5-r2
add pc, pc, r2, lsl #4 @ computed goto, 4 instrs each
bl common_abort @ (skipped due to ARM prefetch)
5: and ip, rINST, #0x0f00 @ isolate A
- ldr r3, [rFP, ip, lsr #6] @ r3<- vA (shift right 8, left 2)
+ ldr r2, [rFP, ip, lsr #6] @ r2<- vA (shift right 8, left 2)
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vA
+ str r2, [r10, #-4]! @ *--outs = vA
4: and ip, r1, #0xf000 @ isolate G
- ldr r3, [rFP, ip, lsr #10] @ r3<- vG (shift right 12, left 2)
+ ldr r2, [rFP, ip, lsr #10] @ r2<- vG (shift right 12, left 2)
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vG
+ str r2, [r10, #-4]! @ *--outs = vG
3: and ip, r1, #0x0f00 @ isolate F
- ldr r3, [rFP, ip, lsr #6] @ r3<- vF
+ ldr r2, [rFP, ip, lsr #6] @ r2<- vF
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vF
+ str r2, [r10, #-4]! @ *--outs = vF
2: and ip, r1, #0x00f0 @ isolate E
- ldr r3, [rFP, ip, lsr #2] @ r3<- vE
+ ldr r2, [rFP, ip, lsr #2] @ r2<- vE
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vE
+ str r2, [r10, #-4]! @ *--outs = vE
1: and ip, r1, #0x000f @ isolate D
- ldr r3, [rFP, ip, lsl #2] @ r3<- vD
+ ldr r2, [rFP, ip, lsl #2] @ r2<- vD
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vD
+ str r2, [r10, #-4]! @ *--outs = vD
0: @ fall through to .LinvokeArgsDone
-.LinvokeArgsDone: @ r0=methodToCall
+.LinvokeArgsDone: @ r0=methodToCall, r3=outSize, r9=regSize
+ ldr r2, [r0, #offMethod_insns] @ r2<- method->insns
+ ldr rINST, [r0, #offMethod_clazz] @ rINST<- method->clazz
@ find space for the new stack frame, check for overflow
SAVEAREA_FROM_FP(r1, rFP) @ r1<- stack save area
- ldrh r2, [r0, #offMethod_registersSize] @ r2<- methodToCall->regsSize
- ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
- sub r1, r1, r2, lsl #2 @ r1<- newFp (old savearea - regsSize)
+ sub r1, r1, r9, lsl #2 @ r1<- newFp (old savearea - regsSize)
SAVEAREA_FROM_FP(r10, r1) @ r10<- newSaveArea
@ bl common_dumpRegs
ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd
sub r3, r10, r3, lsl #2 @ r3<- bottom (newsave - outsSize)
cmp r3, r9 @ bottom < interpStackEnd?
+ ldr r3, [r0, #offMethod_accessFlags] @ r3<- methodToCall->accessFlags
blt .LstackOverflow @ yes, this frame will overflow stack
@ set up newSaveArea
@@ -187,8 +193,6 @@
str rFP, [r10, #offStackSaveArea_prevFrame]
str rPC, [r10, #offStackSaveArea_savedPc]
str r0, [r10, #offStackSaveArea_method]
-
- ldr r3, [r0, #offMethod_accessFlags] @ r3<- methodToCall->accessFlags
tst r3, #ACC_NATIVE
bne .LinvokeNative
@@ -207,17 +211,18 @@
ldmfd sp!, {r0-r3}
*/
- @ Update "glue" values for the new method
- @ r0=methodToCall, r1=newFp
- ldr r3, [r0, #offMethod_clazz] @ r3<- method->clazz
- str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall
- ldr r3, [r3, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex
- ldr rPC, [r0, #offMethod_insns] @ rPC<- method->insns
- str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ...
+ ldrh r9, [r2] @ r9 <- load INST from new PC
+ ldr r3, [rINST, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex
+ mov rPC, r2 @ publish new rPC
ldr r2, [rGLUE, #offGlue_self] @ r2<- glue->self
- FETCH_INST() @ load rINST from rPC
+
+ @ Update "glue" values for the new method
+ @ r0=methodToCall, r1=newFp, r2=self, r3=newMethodClass, r9=newINST
+ str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall
+ str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ...
mov rFP, r1 @ fp = newFp
- GET_INST_OPCODE(ip) @ extract opcode from rINST
+ GET_PREFETCHED_OPCODE(ip, r9) @ extract prefetched opcode from r9
+ mov rINST, r9 @ publish new rINST
str r1, [r2, #offThread_curFrame] @ self->curFrame = newFp
GOTO_OPCODE(ip) @ jump to next instruction
@@ -312,20 +317,21 @@
SAVEAREA_FROM_FP(r0, rFP) @ r0<- saveArea (old)
ldr rFP, [r0, #offStackSaveArea_prevFrame] @ fp = saveArea->prevFrame
+ ldr r9, [r0, #offStackSaveArea_savedPc] @ r9 = saveArea->savedPc
ldr r2, [rFP, #(offStackSaveArea_method - sizeofStackSaveArea)]
@ r2<- method we're returning to
+ ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self
cmp r2, #0 @ is this a break frame?
+ ldrne r10, [r2, #offMethod_clazz] @ r10<- method->clazz
mov r1, #0 @ "want switch" = false
beq common_gotoBail @ break frame, bail out completely
- ldr rPC, [r0, #offStackSaveArea_savedPc] @ pc = saveArea->savedPc
- ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self
- str r2, [rGLUE, #offGlue_method] @ glue->method = newSave->method
+ PREFETCH_ADVANCE_INST(rINST, r9, 3) @ advance r9, update new rINST
+ str r2, [rGLUE, #offGlue_method]@ glue->method = newSave->method
+ ldr r1, [r10, #offClassObject_pDvmDex] @ r1<- method->clazz->pDvmDex
str rFP, [r3, #offThread_curFrame] @ self->curFrame = fp
- ldr r1, [r2, #offMethod_clazz] @ r1<- method->clazz
- FETCH_ADVANCE_INST(3) @ advance rPC, load rINST
- ldr r1, [r1, #offClassObject_pDvmDex] @ r1<- method->clazz->pDvmDex
GET_INST_OPCODE(ip) @ extract opcode from rINST
+ mov rPC, r9 @ publish new rPC
str r1, [rGLUE, #offGlue_methodClassDex]
GOTO_OPCODE(ip) @ jump to next instruction
diff --git a/vm/mterp/armv5te/header.S b/vm/mterp/armv5te/header.S
index 6f9ba97..2e5c6ed 100644
--- a/vm/mterp/armv5te/header.S
+++ b/vm/mterp/armv5te/header.S
@@ -117,6 +117,13 @@
#define FETCH_ADVANCE_INST(_count) ldrh rINST, [rPC, #(_count*2)]!
/*
+ * The operation performed here is similar to FETCH_ADVANCE_INST, except the
+ * src and dest registers are parameterized (not hard-wired to rPC and rINST).
+ */
+#define PREFETCH_ADVANCE_INST(_dreg, _sreg, _count) \
+ ldrh _dreg, [_sreg, #(_count*2)]!
+
+/*
* Fetch the next instruction from an offset specified by _reg. Updates
* rPC to point to the next instruction. "_reg" must specify the distance
* in bytes, *not* 16-bit code units, and may be a signed value.
@@ -150,6 +157,11 @@
#define GET_INST_OPCODE(_reg) and _reg, rINST, #255
/*
+ * Put the prefetched instruction's opcode field into the specified register.
+ */
+#define GET_PREFETCHED_OPCODE(_oreg, _ireg) and _oreg, _ireg, #255
+
+/*
* Begin executing the opcode in _reg. Because this only jumps within the
* interpreter, we don't have to worry about pre-ARMv5 THUMB interwork.
*/
diff --git a/vm/mterp/c/OP_MONITOR_ENTER.c b/vm/mterp/c/OP_MONITOR_ENTER.c
index 4d70da7..c9d8999 100644
--- a/vm/mterp/c/OP_MONITOR_ENTER.c
+++ b/vm/mterp/c/OP_MONITOR_ENTER.c
@@ -9,9 +9,7 @@
if (!checkForNullExportPC(obj, fp, pc))
GOTO_exceptionThrown();
ILOGV("+ locking %p %s\n", obj, obj->clazz->descriptor);
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC(); /* need for stack trace */
-#endif
+ EXPORT_PC(); /* need for precise GC, also WITH_MONITOR_TRACKING */
dvmLockObject(self, obj);
#ifdef WITH_DEADLOCK_PREDICTION
if (dvmCheckException(self))
diff --git a/vm/mterp/c/header.c b/vm/mterp/c/header.c
index e35ded4..d2fca9c 100644
--- a/vm/mterp/c/header.c
+++ b/vm/mterp/c/header.c
@@ -46,7 +46,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -86,6 +86,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -109,9 +121,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -296,6 +312,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
diff --git a/vm/mterp/cstubs/stubdefs.c b/vm/mterp/cstubs/stubdefs.c
index 1de6f0e..d4162c8 100644
--- a/vm/mterp/cstubs/stubdefs.c
+++ b/vm/mterp/cstubs/stubdefs.c
@@ -107,7 +107,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
glue->entryPoint = _entryPoint; \
diff --git a/vm/mterp/out/InterpAsm-armv5te.S b/vm/mterp/out/InterpAsm-armv5te.S
index 9987ff5..24708f5 100644
--- a/vm/mterp/out/InterpAsm-armv5te.S
+++ b/vm/mterp/out/InterpAsm-armv5te.S
@@ -124,6 +124,13 @@
#define FETCH_ADVANCE_INST(_count) ldrh rINST, [rPC, #(_count*2)]!
/*
+ * The operation performed here is similar to FETCH_ADVANCE_INST, except the
+ * src and dest registers are parameterized (not hard-wired to rPC and rINST).
+ */
+#define PREFETCH_ADVANCE_INST(_dreg, _sreg, _count) \
+ ldrh _dreg, [_sreg, #(_count*2)]!
+
+/*
* Fetch the next instruction from an offset specified by _reg. Updates
* rPC to point to the next instruction. "_reg" must specify the distance
* in bytes, *not* 16-bit code units, and may be a signed value.
@@ -157,6 +164,11 @@
#define GET_INST_OPCODE(_reg) and _reg, rINST, #255
/*
+ * Put the prefetched instruction's opcode field into the specified register.
+ */
+#define GET_PREFETCHED_OPCODE(_oreg, _ireg) and _oreg, _ireg, #255
+
+/*
* Begin executing the opcode in _reg. Because this only jumps within the
* interpreter, we don't have to worry about pre-ARMv5 THUMB interwork.
*/
@@ -818,9 +830,7 @@
GET_VREG(r1, r2) @ r1<- vAA (object)
ldr r0, [rGLUE, #offGlue_self] @ r0<- glue->self
cmp r1, #0 @ null object?
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC() @ export PC so we can grab stack trace
-#endif
+ EXPORT_PC() @ need for precise GC, MONITOR_TRACKING
beq common_errNullObject @ null object, throw an exception
FETCH_ADVANCE_INST(1) @ advance rPC, load rINST
bl dvmLockObject @ call(self, obj)
@@ -9336,7 +9346,7 @@
#endif
cmp r3, #0 @ suspend pending?
- bne 2f @ yes, check suspend
+ bne 2f @ yes, do full suspension check
#if defined(WITH_DEBUGGER) || defined(WITH_PROFILER)
# if defined(WITH_DEBUGGER) && defined(WITH_PROFILER)
@@ -9354,6 +9364,7 @@
2: @ check suspend
ldr r0, [rGLUE, #offGlue_self] @ r0<- glue->self
+ EXPORT_PC() @ need for precise GC
b dvmCheckSuspendPending @ suspend if necessary, then return
3: @ debugger/profiler enabled, bail out
@@ -9401,10 +9412,12 @@
@ (very few methods have > 10 args; could unroll for common cases)
add r3, rFP, r1, lsl #2 @ r3<- &fp[CCCC]
sub r10, r10, r2, lsl #2 @ r10<- "outs" area, for call args
+ ldrh r9, [r0, #offMethod_registersSize] @ r9<- methodToCall->regsSize
1: ldr r1, [r3], #4 @ val = *fp++
subs r2, r2, #1 @ count--
str r1, [r10], #4 @ *outs++ = val
bne 1b @ ...while count != 0
+ ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
b .LinvokeArgsDone
/*
@@ -9418,47 +9431,50 @@
@ prepare to copy args to "outs" area of current frame
movs r2, rINST, lsr #12 @ r2<- B (arg count) -- test for zero
SAVEAREA_FROM_FP(r10, rFP) @ r10<- stack save area
- beq .LinvokeArgsDone @ if no args, skip the rest
- FETCH(r1, 2) @ r1<- GFED
+ FETCH(r1, 2) @ r1<- GFED (load here to hide latency)
+ ldrh r9, [r0, #offMethod_registersSize] @ r9<- methodToCall->regsSize
+ ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
+ beq .LinvokeArgsDone
- @ r0=methodToCall, r1=GFED, r2=count, r10=outs
+ @ r0=methodToCall, r1=GFED, r3=outSize, r2=count, r9=regSize, r10=outs
.LinvokeNonRange:
rsb r2, r2, #5 @ r2<- 5-r2
add pc, pc, r2, lsl #4 @ computed goto, 4 instrs each
bl common_abort @ (skipped due to ARM prefetch)
5: and ip, rINST, #0x0f00 @ isolate A
- ldr r3, [rFP, ip, lsr #6] @ r3<- vA (shift right 8, left 2)
+ ldr r2, [rFP, ip, lsr #6] @ r2<- vA (shift right 8, left 2)
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vA
+ str r2, [r10, #-4]! @ *--outs = vA
4: and ip, r1, #0xf000 @ isolate G
- ldr r3, [rFP, ip, lsr #10] @ r3<- vG (shift right 12, left 2)
+ ldr r2, [rFP, ip, lsr #10] @ r2<- vG (shift right 12, left 2)
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vG
+ str r2, [r10, #-4]! @ *--outs = vG
3: and ip, r1, #0x0f00 @ isolate F
- ldr r3, [rFP, ip, lsr #6] @ r3<- vF
+ ldr r2, [rFP, ip, lsr #6] @ r2<- vF
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vF
+ str r2, [r10, #-4]! @ *--outs = vF
2: and ip, r1, #0x00f0 @ isolate E
- ldr r3, [rFP, ip, lsr #2] @ r3<- vE
+ ldr r2, [rFP, ip, lsr #2] @ r2<- vE
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vE
+ str r2, [r10, #-4]! @ *--outs = vE
1: and ip, r1, #0x000f @ isolate D
- ldr r3, [rFP, ip, lsl #2] @ r3<- vD
+ ldr r2, [rFP, ip, lsl #2] @ r2<- vD
mov r0, r0 @ nop
- str r3, [r10, #-4]! @ *--outs = vD
+ str r2, [r10, #-4]! @ *--outs = vD
0: @ fall through to .LinvokeArgsDone
-.LinvokeArgsDone: @ r0=methodToCall
+.LinvokeArgsDone: @ r0=methodToCall, r3=outSize, r9=regSize
+ ldr r2, [r0, #offMethod_insns] @ r2<- method->insns
+ ldr rINST, [r0, #offMethod_clazz] @ rINST<- method->clazz
@ find space for the new stack frame, check for overflow
SAVEAREA_FROM_FP(r1, rFP) @ r1<- stack save area
- ldrh r2, [r0, #offMethod_registersSize] @ r2<- methodToCall->regsSize
- ldrh r3, [r0, #offMethod_outsSize] @ r3<- methodToCall->outsSize
- sub r1, r1, r2, lsl #2 @ r1<- newFp (old savearea - regsSize)
+ sub r1, r1, r9, lsl #2 @ r1<- newFp (old savearea - regsSize)
SAVEAREA_FROM_FP(r10, r1) @ r10<- newSaveArea
@ bl common_dumpRegs
ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd
sub r3, r10, r3, lsl #2 @ r3<- bottom (newsave - outsSize)
cmp r3, r9 @ bottom < interpStackEnd?
+ ldr r3, [r0, #offMethod_accessFlags] @ r3<- methodToCall->accessFlags
blt .LstackOverflow @ yes, this frame will overflow stack
@ set up newSaveArea
@@ -9469,8 +9485,6 @@
str rFP, [r10, #offStackSaveArea_prevFrame]
str rPC, [r10, #offStackSaveArea_savedPc]
str r0, [r10, #offStackSaveArea_method]
-
- ldr r3, [r0, #offMethod_accessFlags] @ r3<- methodToCall->accessFlags
tst r3, #ACC_NATIVE
bne .LinvokeNative
@@ -9489,17 +9503,18 @@
ldmfd sp!, {r0-r3}
*/
- @ Update "glue" values for the new method
- @ r0=methodToCall, r1=newFp
- ldr r3, [r0, #offMethod_clazz] @ r3<- method->clazz
- str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall
- ldr r3, [r3, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex
- ldr rPC, [r0, #offMethod_insns] @ rPC<- method->insns
- str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ...
+ ldrh r9, [r2] @ r9 <- load INST from new PC
+ ldr r3, [rINST, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex
+ mov rPC, r2 @ publish new rPC
ldr r2, [rGLUE, #offGlue_self] @ r2<- glue->self
- FETCH_INST() @ load rINST from rPC
+
+ @ Update "glue" values for the new method
+ @ r0=methodToCall, r1=newFp, r2=self, r3=newMethodClass, r9=newINST
+ str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall
+ str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ...
mov rFP, r1 @ fp = newFp
- GET_INST_OPCODE(ip) @ extract opcode from rINST
+ GET_PREFETCHED_OPCODE(ip, r9) @ extract prefetched opcode from r9
+ mov rINST, r9 @ publish new rINST
str r1, [r2, #offThread_curFrame] @ self->curFrame = newFp
GOTO_OPCODE(ip) @ jump to next instruction
@@ -9594,20 +9609,21 @@
SAVEAREA_FROM_FP(r0, rFP) @ r0<- saveArea (old)
ldr rFP, [r0, #offStackSaveArea_prevFrame] @ fp = saveArea->prevFrame
+ ldr r9, [r0, #offStackSaveArea_savedPc] @ r9 = saveArea->savedPc
ldr r2, [rFP, #(offStackSaveArea_method - sizeofStackSaveArea)]
@ r2<- method we're returning to
+ ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self
cmp r2, #0 @ is this a break frame?
+ ldrne r10, [r2, #offMethod_clazz] @ r10<- method->clazz
mov r1, #0 @ "want switch" = false
beq common_gotoBail @ break frame, bail out completely
- ldr rPC, [r0, #offStackSaveArea_savedPc] @ pc = saveArea->savedPc
- ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self
- str r2, [rGLUE, #offGlue_method] @ glue->method = newSave->method
+ PREFETCH_ADVANCE_INST(rINST, r9, 3) @ advance r9, update new rINST
+ str r2, [rGLUE, #offGlue_method]@ glue->method = newSave->method
+ ldr r1, [r10, #offClassObject_pDvmDex] @ r1<- method->clazz->pDvmDex
str rFP, [r3, #offThread_curFrame] @ self->curFrame = fp
- ldr r1, [r2, #offMethod_clazz] @ r1<- method->clazz
- FETCH_ADVANCE_INST(3) @ advance rPC, load rINST
- ldr r1, [r1, #offClassObject_pDvmDex] @ r1<- method->clazz->pDvmDex
GET_INST_OPCODE(ip) @ extract opcode from rINST
+ mov rPC, r9 @ publish new rPC
str r1, [rGLUE, #offGlue_methodClassDex]
GOTO_OPCODE(ip) @ jump to next instruction
diff --git a/vm/mterp/out/InterpAsm-x86.S b/vm/mterp/out/InterpAsm-x86.S
index a80e59e..6d29a8e 100644
--- a/vm/mterp/out/InterpAsm-x86.S
+++ b/vm/mterp/out/InterpAsm-x86.S
@@ -682,9 +682,7 @@
movl offGlue_self(%ecx),%ecx # ecx<- glue->self
FETCH_INST_WORD(1)
testl %eax,%eax # null object?
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC()
-#endif
+ EXPORT_PC() # need for precise GC, MONITOR_TRACKING
jne .LOP_MONITOR_ENTER_continue
jmp common_errNullObject
@@ -2854,9 +2852,7 @@
.LOP_INVOKE_DIRECT_finish:
UNSPILL(rPC)
testl %ecx,%ecx # null "this"?
- movl $0,%ecx
- #jne common_invokeMethodNoRange # no, continue on
- jne common_invokeOld # no, continue on, eax<- method, ecx<- methodCallRange
+ jne common_invokeMethodNoRange # no, continue on
jmp common_errNullObject
/* ------------------------------ */
@@ -2876,10 +2872,8 @@
EXPORT_PC()
movl offDvmDex_pResMethods(%ecx),%ecx # ecx<- pDvmDex->pResMethods
movl (%ecx,%eax,4),%eax # eax<- resolved methodToCall
- movl $0,%ecx # needed by common_invokeOld - revisit
testl %eax,%eax
- #jne common_invokeMethodNoRange
- jne common_invokeOld
+ jne common_invokeMethodNoRange
GET_GLUE(%ecx)
movl offGlue_method(%ecx),%ecx # ecx<- glue->method
movzwl 2(rPC),%eax
@@ -3021,9 +3015,7 @@
.LOP_INVOKE_DIRECT_RANGE_finish:
UNSPILL(rPC)
testl %ecx,%ecx # null "this"?
- movl $1,%ecx
- #jne common_invokeMethodRange # no, continue on
- jne common_invokeOld # no, continue on, eax<- method, ecx<- methodCallRange
+ jne common_invokeMethodRange # no, continue on
jmp common_errNullObject
@@ -3045,10 +3037,8 @@
EXPORT_PC()
movl offDvmDex_pResMethods(%ecx),%ecx # ecx<- pDvmDex->pResMethods
movl (%ecx,%eax,4),%eax # eax<- resolved methodToCall
- movl $1,%ecx # needed by common_invokeOld - revisit
testl %eax,%eax
- #jne common_invokeMethodRange
- jne common_invokeOld
+ jne common_invokeMethodRange
GET_GLUE(%ecx)
movl offGlue_method(%ecx),%ecx # ecx<- glue->method
movzwl 2(rPC),%eax
@@ -6029,9 +6019,8 @@
movl offClassObject_vtable(%eax),%eax # eax<- thisPtr->clazz->vtable
EXPORT_PC() # might throw later - get ready
movl (%eax,%ecx,4),%eax # eax<- vtable[BBBB]
- movl $0,%ecx # pass range flag
- #jmp common_invokeMethodNoRange
- jmp common_invokeOld
+ jmp common_invokeMethodNoRange
+
/* ------------------------------ */
@@ -6058,9 +6047,8 @@
movl offClassObject_vtable(%eax),%eax # eax<- thisPtr->clazz->vtable
EXPORT_PC() # might throw later - get ready
movl (%eax,%ecx,4),%eax # eax<- vtable[BBBB]
- movl $1,%ecx # pass range flag
- #jmp common_invokeMethodRange
- jmp common_invokeOld
+ jmp common_invokeMethodRange
+
@@ -6090,9 +6078,7 @@
movl offClassObject_vtable(%ecx),%ecx # ecx<- vtable
EXPORT_PC()
movl (%ecx,%eax,4),%eax # eax<- super->vtable[BBBB]
- movl $0,%ecx # ecx<- range flag
- #jmp common_invokeMethodNoRange
- jmp common_invokeOld
+ jmp common_invokeMethodNoRange
/* ------------------------------ */
@@ -6122,9 +6108,7 @@
movl offClassObject_vtable(%ecx),%ecx # ecx<- vtable
EXPORT_PC()
movl (%ecx,%eax,4),%eax # eax<- super->vtable[BBBB]
- movl $1,%ecx # ecx<- range flag
- #jmp common_invokeMethodRange
- jmp common_invokeOld
+ jmp common_invokeMethodRange
@@ -7671,9 +7655,7 @@
movl offObject_clazz(%ecx),%ecx # ecx<- thisPtr->clazz
movl offClassObject_vtable(%ecx),%ecx # ecx<- thisPtr->clazz->vtable
movl (%ecx,%eax,4),%eax # eax<- vtable[methodIndex]
- movl $0,%ecx # needed for common_invokeOld
- #jmp common_invokeMethodNoRange
- jmp common_invokeOld
+ jmp common_invokeMethodNoRange
/* continuation for OP_INVOKE_SUPER */
@@ -7690,9 +7672,8 @@
jae .LOP_INVOKE_SUPER_nsm # method not present in superclass
movl offClassObject_vtable(%eax),%eax # eax<- ...clazz->super->vtable
movl (%eax,%ecx,4),%eax # eax<- vtable[methodIndex]
- movl $0,%ecx
- #jmp common_invokeMethodNoRange
- jmp common_invokeOld
+ jmp common_invokeMethodNoRange
+
/* At this point:
* ecx = null (needs to be resolved base method)
@@ -7755,10 +7736,8 @@
SPILL(rPC)
call dvmResolveMethod # call(clazz,ref,flags)
UNSPILL(rPC)
- movl $0,%ecx
testl %eax,%eax # got null?
- #jne common_invokeMethodNoRange
- jne common_invokeOld
+ jne common_invokeMethodNoRange
jmp common_exceptionThrown
@@ -7769,9 +7748,7 @@
UNSPILL(rPC)
testl %eax,%eax
je common_exceptionThrown
- movl $0,%ecx
- #jmp common_invokeMethodNoRange
- jmp common_invokeOld
+ jmp common_invokeMethodNoRange
/* continuation for OP_INVOKE_VIRTUAL_RANGE */
@@ -7803,9 +7780,7 @@
movl offObject_clazz(%ecx),%ecx # ecx<- thisPtr->clazz
movl offClassObject_vtable(%ecx),%ecx # ecx<- thisPtr->clazz->vtable
movl (%ecx,%eax,4),%eax # eax<- vtable[methodIndex]
- movl $1,%ecx # needed for common_invokeOld
- #jmp common_invokeMethodRange
- jmp common_invokeOld
+ jmp common_invokeMethodRange
/* continuation for OP_INVOKE_SUPER_RANGE */
@@ -7822,9 +7797,8 @@
jae .LOP_INVOKE_SUPER_RANGE_nsm # method not present in superclass
movl offClassObject_vtable(%eax),%eax # eax<- ...clazz->super->vtable
movl (%eax,%ecx,4),%eax # eax<- vtable[methodIndex]
- movl $1,%ecx
- #jmp common_invokeMethodRange
- jmp common_invokeOld
+ jmp common_invokeMethodRange
+
/* At this point:
* ecx = null (needs to be resolved base method)
@@ -7887,10 +7861,8 @@
SPILL(rPC)
call dvmResolveMethod # call(clazz,ref,flags)
UNSPILL(rPC)
- movl $1,%ecx
testl %eax,%eax # got null?
- #jne common_invokeMethodRange
- jne common_invokeOld
+ jne common_invokeMethodRange
jmp common_exceptionThrown
@@ -7901,9 +7873,7 @@
UNSPILL(rPC)
testl %eax,%eax
je common_exceptionThrown
- movl $1,%ecx
- #jmp common_invokeMethodRange
- jmp common_invokeOld
+ jmp common_invokeMethodRange
/* continuation for OP_FLOAT_TO_INT */
@@ -8537,11 +8507,217 @@
*/
common_backwardBranch:
GET_GLUE(%ecx)
- call common_periodicChecks # Note: expects rPC to be preserved
+ call common_periodicChecks # Note: expects rPC to be preserved
ADVANCE_PC_INDEXED(rINST_FULL)
FETCH_INST()
GOTO_NEXT
+
+
+/*
+ * Common code for method invocation with range.
+ *
+ * On entry:
+ * eax = Method* methodToCall
+ * rINST trashed, must reload
+ */
+
+common_invokeMethodRange:
+.LinvokeNewRange:
+
+ /*
+ * prepare to copy args to "outs" area of current frame
+ */
+
+ movzbl 1(rPC),rINST_FULL # rINST_FULL<- AA
+ movzwl 4(rPC), %ecx # %ecx<- CCCC
+ SPILL(rPC)
+ SAVEAREA_FROM_FP(%edx,rFP) # %edx<- &StackSaveArea
+ test rINST_FULL, rINST_FULL
+ movl rINST_FULL, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- AA
+ jz .LinvokeArgsDone # no args; jump to args done
+
+
+ /*
+ * %eax=methodToCall, %ecx=CCCC, LOCAL0_OFFSET(%ebp)=count, %edx=&outs (&stackSaveArea)
+ * (very few methods have > 10 args; could unroll for common cases)
+ */
+
+ movl %ebx, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- save %ebx
+ lea (rFP, %ecx, 4), %ecx # %ecx<- &vCCCC
+ shll $2, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- offset
+ subl LOCAL0_OFFSET(%ebp), %edx # %edx<- update &outs
+ shrl $2, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- offset
+1:
+ movl (%ecx), %ebx # %ebx<- vCCCC
+ lea 4(%ecx), %ecx # %ecx<- &vCCCC++
+ subl $1, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET<- LOCAL0_OFFSET--
+ movl %ebx, (%edx) # *outs<- vCCCC
+ lea 4(%edx), %edx # outs++
+ jne 1b # loop if count (LOCAL0_OFFSET(%ebp)) not zero
+ movl LOCAL1_OFFSET(%ebp), %ebx # %ebx<- restore %ebx
+ jmp .LinvokeArgsDone # continue
+
+ /*
+ * %eax is "Method* methodToCall", the method we're trying to call
+ * prepare to copy args to "outs" area of current frame
+ */
+
+common_invokeMethodNoRange:
+.LinvokeNewNoRange:
+ movzbl 1(rPC),rINST_FULL # rINST_FULL<- BA
+ SPILL(rPC)
+ movl rINST_FULL, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- BA
+ shrl $4, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- B
+ je .LinvokeArgsDone # no args; jump to args done
+ movzwl 4(rPC), %ecx # %ecx<- GFED
+ SAVEAREA_FROM_FP(%edx,rFP) # %edx<- &StackSaveArea
+
+ /*
+ * %eax=methodToCall, %ecx=GFED, LOCAL0_OFFSET(%ebp)=count, %edx=outs
+ */
+
+.LinvokeNonRange:
+ cmp $2, LOCAL0_OFFSET(%ebp) # compare LOCAL0_OFFSET(%ebp) to 2
+ movl %ecx, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- GFED
+ jl 1f # handle 1 arg
+ je 2f # handle 2 args
+ cmp $4, LOCAL0_OFFSET(%ebp) # compare LOCAL0_OFFSET(%ebp) to 4
+ jl 3f # handle 3 args
+ je 4f # handle 4 args
+5:
+ andl $15, rINST_FULL # rINST<- A
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, rINST_FULL, 4), %ecx # %ecx<- vA
+ movl %ecx, (%edx) # *outs<- vA
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+4:
+ shr $12, %ecx # %ecx<- G
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vG
+ movl %ecx, (%edx) # *outs<- vG
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+3:
+ and $0x0f00, %ecx # %ecx<- 0F00
+ shr $8, %ecx # %ecx<- F
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vF
+ movl %ecx, (%edx) # *outs<- vF
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+2:
+ and $0x00f0, %ecx # %ecx<- 00E0
+ shr $4, %ecx # %ecx<- E
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vE
+ movl %ecx, (%edx) # *outs<- vE
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+1:
+ and $0x000f, %ecx # %ecx<- 000D
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vD
+ movl %ecx, -4(%edx) # *--outs<- vD
+0:
+
+ /*
+ * %eax is "Method* methodToCall", the method we're trying to call
+ * find space for the new stack frame, check for overflow
+ */
+
+.LinvokeArgsDone:
+ movzwl offMethod_registersSize(%eax), %edx # %edx<- methodToCall->regsSize
+ movzwl offMethod_outsSize(%eax), %ecx # %ecx<- methodToCall->outsSize
+ movl %eax, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET<- methodToCall
+ shl $2, %edx # %edx<- update offset
+ SAVEAREA_FROM_FP(%eax,rFP) # %eax<- &StackSaveArea
+ subl %edx, %eax # %eax<- newFP; (old savearea - regsSize)
+ GET_GLUE(%edx) # %edx<- pMterpGlue
+ movl %eax, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- &outs
+ subl $sizeofStackSaveArea, %eax # %eax<- newSaveArea (stack save area using newFP)
+ movl offGlue_interpStackEnd(%edx), %edx # %edx<- glue->interpStackEnd
+ movl %edx, LOCAL2_OFFSET(%ebp) # LOCAL2_OFFSET<- glue->interpStackEnd
+ shl $2, %ecx # %ecx<- update offset for outsSize
+ movl %eax, %edx # %edx<- newSaveArea
+ sub %ecx, %eax # %eax<- bottom; (newSaveArea - outsSize)
+ cmp LOCAL2_OFFSET(%ebp), %eax # compare interpStackEnd and bottom
+ movl LOCAL0_OFFSET(%ebp), %eax # %eax<- restore methodToCall
+ jl .LstackOverflow # handle frame overflow
+
+ /*
+ * set up newSaveArea
+ */
+
+#ifdef EASY_GDB
+ SAVEAREA_FROM_FP(%ecx,rFP) # %ecx<- &StackSaveArea
+ movl %ecx, offStackSaveArea_prevSave(%edx) # newSaveArea->prevSave<- &outs
+#endif
+ movl rFP, offStackSaveArea_prevFrame(%edx) # newSaveArea->prevFrame<- rFP
+ movl rPC_SPILL(%ebp), %ecx
+ movl %ecx, offStackSaveArea_savedPc(%edx) # newSaveArea->savedPc<- rPC
+ testl $ACC_NATIVE, offMethod_accessFlags(%eax) # check for native call
+ movl %eax, offStackSaveArea_method(%edx) # newSaveArea->method<- method to call
+ jne .LinvokeNative # handle native call
+
+ /*
+ * Update "glue" values for the new method
+ * %eax=methodToCall, LOCAL1_OFFSET(%ebp)=newFp
+ */
+
+ movl offMethod_clazz(%eax), %edx # %edx<- method->clazz
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl offClassObject_pDvmDex(%edx), %edx # %edx<- method->clazz->pDvmDex
+ movl %eax, offGlue_method(%ecx) # glue->method<- methodToCall
+ movl %edx, offGlue_methodClassDex(%ecx) # glue->methodClassDex<- method->clazz->pDvmDex
+ movl offMethod_insns(%eax), rPC # rPC<- methodToCall->insns
+ movl offGlue_self(%ecx), %eax # %eax<- glue->self
+ movl LOCAL1_OFFSET(%ebp), rFP # rFP<- newFP
+ movl rFP, offThread_curFrame(%eax) # glue->self->curFrame<- newFP
+ FETCH_INST()
+ GOTO_NEXT # jump to methodToCall->insns
+
+ /*
+ * Prep for the native call
+ * %eax=methodToCall, LOCAL1_OFFSET(%ebp)=newFP, %edx=newSaveArea
+ */
+
+.LinvokeNative:
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl %eax, OUT_ARG1(%esp) # push parameter methodToCall
+ movl offGlue_self(%ecx), %ecx # %ecx<- glue->self
+ movl offThread_jniLocal_nextEntry(%ecx), %eax # %eax<- glue->self->thread->refNext
+ movl %eax, offStackSaveArea_localRefTop(%edx) # newSaveArea->localRefTop<- refNext
+ movl %edx, OUT_ARG4(%esp) # save newSaveArea
+ movl LOCAL1_OFFSET(%ebp), %edx # %edx<- newFP
+ movl %edx, offThread_curFrame(%ecx) # glue->self->curFrame<- newFP
+ movl %ecx, OUT_ARG3(%esp) # save glue->self
+ movl %ecx, OUT_ARG2(%esp) # push parameter glue->self
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl OUT_ARG1(%esp), %eax # %eax<- methodToCall
+ lea offGlue_retval(%ecx), %ecx # %ecx<- &retval
+ movl %ecx, OUT_ARG0(%esp) # push parameter pMterpGlue
+ push %edx # push parameter newFP
+
+ call *offMethod_nativeFunc(%eax) # call methodToCall->nativeFunc
+ lea 4(%esp), %esp
+ movl OUT_ARG4(%esp), %ecx # %ecx<- newSaveArea
+ movl OUT_ARG3(%esp), %eax # %eax<- glue->self
+ movl offStackSaveArea_localRefTop(%ecx), %edx # %edx<- newSaveArea->localRefTop
+ cmp $0, offThread_exception(%eax) # check for exception
+ movl rFP, offThread_curFrame(%eax) # glue->self->curFrame<- rFP
+ movl %edx, offThread_jniLocal_nextEntry(%eax) # glue->self<- newSaveArea->localRefTop
+ UNSPILL(rPC)
+ jne common_exceptionThrown # handle exception
+ FETCH_INST_WORD(3)
+ ADVANCE_PC(3)
+ GOTO_NEXT # jump to next instruction
+
+.LstackOverflow:
+ GET_GLUE(%eax) # %eax<- pMterpGlue
+ movl offGlue_self(%eax), %eax # %eax<- glue->self
+ movl %eax, OUT_ARG0(%esp) # push parameter self
+ call dvmHandleStackOverflow # call: (Thread* self)
+ UNSPILL(rPC) # return: void
+ jmp common_exceptionThrown # handle exception
+
+
/*
* Common invoke code (old-style).
* TUNING: Rewrite along lines of new armv5 code?
@@ -8618,6 +8794,7 @@
* bool dvmCheckSuspendPending(Thread* self)
* Because we reached here via a call, go ahead and build a new frame.
*/
+ EXPORT_PC() # need for precise GC
movl offGlue_self(%ecx),%eax # eax<- glue->self
SPILL(rPC) # save edx
push %ebp
diff --git a/vm/mterp/out/InterpC-allstubs.c b/vm/mterp/out/InterpC-allstubs.c
index 635a873..cde7b27 100644
--- a/vm/mterp/out/InterpC-allstubs.c
+++ b/vm/mterp/out/InterpC-allstubs.c
@@ -53,7 +53,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -93,6 +93,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -116,9 +128,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -303,6 +319,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
@@ -513,7 +531,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
glue->entryPoint = _entryPoint; \
@@ -1525,9 +1546,7 @@
if (!checkForNullExportPC(obj, fp, pc))
GOTO_exceptionThrown();
ILOGV("+ locking %p %s\n", obj, obj->clazz->descriptor);
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC(); /* need for stack trace */
-#endif
+ EXPORT_PC(); /* need for precise GC, also WITH_MONITOR_TRACKING */
dvmLockObject(self, obj);
#ifdef WITH_DEADLOCK_PREDICTION
if (dvmCheckException(self))
diff --git a/vm/mterp/out/InterpC-armv5te.c b/vm/mterp/out/InterpC-armv5te.c
index 47c8709..c8f4ced 100644
--- a/vm/mterp/out/InterpC-armv5te.c
+++ b/vm/mterp/out/InterpC-armv5te.c
@@ -53,7 +53,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -93,6 +93,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -116,9 +128,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -303,6 +319,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
@@ -513,7 +531,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
glue->entryPoint = _entryPoint; \
diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c
index d527cc0..7f7dd8a 100644
--- a/vm/mterp/out/InterpC-portdbg.c
+++ b/vm/mterp/out/InterpC-portdbg.c
@@ -53,7 +53,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -93,6 +93,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -116,9 +128,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -303,6 +319,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
@@ -486,7 +504,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
interpState->entryPoint = _entryPoint; \
@@ -1869,9 +1890,7 @@
if (!checkForNullExportPC(obj, fp, pc))
GOTO_exceptionThrown();
ILOGV("+ locking %p %s\n", obj, obj->clazz->descriptor);
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC(); /* need for stack trace */
-#endif
+ EXPORT_PC(); /* need for precise GC, also WITH_MONITOR_TRACKING */
dvmLockObject(self, obj);
#ifdef WITH_DEADLOCK_PREDICTION
if (dvmCheckException(self))
diff --git a/vm/mterp/out/InterpC-portstd.c b/vm/mterp/out/InterpC-portstd.c
index 64e5ccd..367332c 100644
--- a/vm/mterp/out/InterpC-portstd.c
+++ b/vm/mterp/out/InterpC-portstd.c
@@ -53,7 +53,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -93,6 +93,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -116,9 +128,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -303,6 +319,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
@@ -485,7 +503,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
interpState->entryPoint = _entryPoint; \
@@ -1589,9 +1610,7 @@
if (!checkForNullExportPC(obj, fp, pc))
GOTO_exceptionThrown();
ILOGV("+ locking %p %s\n", obj, obj->clazz->descriptor);
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC(); /* need for stack trace */
-#endif
+ EXPORT_PC(); /* need for precise GC, also WITH_MONITOR_TRACKING */
dvmLockObject(self, obj);
#ifdef WITH_DEADLOCK_PREDICTION
if (dvmCheckException(self))
diff --git a/vm/mterp/out/InterpC-x86.c b/vm/mterp/out/InterpC-x86.c
index cd5fe95..ac524f4 100644
--- a/vm/mterp/out/InterpC-x86.c
+++ b/vm/mterp/out/InterpC-x86.c
@@ -53,7 +53,7 @@
*/
#define THREADED_INTERP /* threaded vs. while-loop interpreter */
-#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia */
+#ifdef WITH_INSTR_CHECKS /* instruction-level paranoia (slow!) */
# define CHECK_BRANCH_OFFSETS
# define CHECK_REGISTER_INDICES
#endif
@@ -93,6 +93,18 @@
#endif
/*
+ * Export another copy of the PC on every instruction; this is largely
+ * redundant with EXPORT_PC and the debugger code. This value can be
+ * compared against what we have stored on the stack with EXPORT_PC to
+ * help ensure that we aren't missing any export calls.
+ */
+#if WITH_EXTRA_GC_CHECKS > 1
+# define EXPORT_EXTRA_PC() (self->currentPc2 = pc)
+#else
+# define EXPORT_EXTRA_PC()
+#endif
+
+/*
* Adjust the program counter. "_offset" is a signed int, in 16-bit units.
*
* Assumes the existence of "const u2* pc" and "const u2* curMethod->insns".
@@ -116,9 +128,13 @@
dvmAbort(); \
} \
pc += myoff; \
+ EXPORT_EXTRA_PC(); \
} while (false)
#else
-# define ADJUST_PC(_offset) (pc += _offset)
+# define ADJUST_PC(_offset) do { \
+ pc += _offset; \
+ EXPORT_EXTRA_PC(); \
+ } while (false)
#endif
/*
@@ -303,6 +319,8 @@
* within the current method won't be shown correctly. See the notes
* in Exception.c.
*
+ * This is also used to determine the address for precise GC.
+ *
* Assumes existence of "u4* fp" and "const u2* pc".
*/
#define EXPORT_PC() (SAVEAREA_FROM_FP(fp)->xtra.currentPc = pc)
@@ -513,7 +531,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
glue->entryPoint = _entryPoint; \
diff --git a/vm/mterp/portable/stubdefs.c b/vm/mterp/portable/stubdefs.c
index 0ea563c..b809caf 100644
--- a/vm/mterp/portable/stubdefs.c
+++ b/vm/mterp/portable/stubdefs.c
@@ -73,7 +73,10 @@
* started. If so, switch to a different "goto" table.
*/
#define PERIODIC_CHECKS(_entryPoint, _pcadj) { \
- dvmCheckSuspendQuick(self); \
+ if (dvmCheckSuspendQuick(self)) { \
+ EXPORT_PC(); /* need for precise GC */ \
+ dvmCheckSuspendPending(self); \
+ } \
if (NEED_INTERP_SWITCH(INTERP_TYPE)) { \
ADJUST_PC(_pcadj); \
interpState->entryPoint = _entryPoint; \
diff --git a/vm/mterp/x86/OP_INVOKE_DIRECT.S b/vm/mterp/x86/OP_INVOKE_DIRECT.S
index a772540..f423dc3 100644
--- a/vm/mterp/x86/OP_INVOKE_DIRECT.S
+++ b/vm/mterp/x86/OP_INVOKE_DIRECT.S
@@ -30,9 +30,7 @@
.L${opcode}_finish:
UNSPILL(rPC)
testl %ecx,%ecx # null "this"?
- movl $$$isrange,%ecx
- #jne common_invokeMethod${routine} # no, continue on
- jne common_invokeOld # no, continue on, eax<- method, ecx<- methodCallRange
+ jne common_invokeMethod${routine} # no, continue on
jmp common_errNullObject
%break
diff --git a/vm/mterp/x86/OP_INVOKE_INTERFACE.S b/vm/mterp/x86/OP_INVOKE_INTERFACE.S
index 02dc76f..1631177 100644
--- a/vm/mterp/x86/OP_INVOKE_INTERFACE.S
+++ b/vm/mterp/x86/OP_INVOKE_INTERFACE.S
@@ -35,7 +35,5 @@
UNSPILL(rPC)
testl %eax,%eax
je common_exceptionThrown
- movl $$$isrange,%ecx
- #jmp common_invokeMethod${routine}
- jmp common_invokeOld
+ jmp common_invokeMethod${routine}
diff --git a/vm/mterp/x86/OP_INVOKE_STATIC.S b/vm/mterp/x86/OP_INVOKE_STATIC.S
index c65fc1f..40dac06 100644
--- a/vm/mterp/x86/OP_INVOKE_STATIC.S
+++ b/vm/mterp/x86/OP_INVOKE_STATIC.S
@@ -14,10 +14,8 @@
EXPORT_PC()
movl offDvmDex_pResMethods(%ecx),%ecx # ecx<- pDvmDex->pResMethods
movl (%ecx,%eax,4),%eax # eax<- resolved methodToCall
- movl $$$isrange,%ecx # needed by common_invokeOld - revisit
testl %eax,%eax
- #jne common_invokeMethod${routine}
- jne common_invokeOld
+ jne common_invokeMethod${routine}
GET_GLUE(%ecx)
movl offGlue_method(%ecx),%ecx # ecx<- glue->method
movzwl 2(rPC),%eax
@@ -33,9 +31,7 @@
SPILL(rPC)
call dvmResolveMethod # call(clazz,ref,flags)
UNSPILL(rPC)
- movl $$$isrange,%ecx
testl %eax,%eax # got null?
- #jne common_invokeMethod${routine}
- jne common_invokeOld
+ jne common_invokeMethod${routine}
jmp common_exceptionThrown
diff --git a/vm/mterp/x86/OP_INVOKE_SUPER.S b/vm/mterp/x86/OP_INVOKE_SUPER.S
index d0a6ad6..013fc01 100644
--- a/vm/mterp/x86/OP_INVOKE_SUPER.S
+++ b/vm/mterp/x86/OP_INVOKE_SUPER.S
@@ -40,9 +40,8 @@
jae .L${opcode}_nsm # method not present in superclass
movl offClassObject_vtable(%eax),%eax # eax<- ...clazz->super->vtable
movl (%eax,%ecx,4),%eax # eax<- vtable[methodIndex]
- movl $$$isrange,%ecx
- #jmp common_invokeMethod${routine}
- jmp common_invokeOld
+ jmp common_invokeMethod${routine}
+
/* At this point:
* ecx = null (needs to be resolved base method)
diff --git a/vm/mterp/x86/OP_INVOKE_SUPER_QUICK.S b/vm/mterp/x86/OP_INVOKE_SUPER_QUICK.S
index b050c82..7545eb0 100644
--- a/vm/mterp/x86/OP_INVOKE_SUPER_QUICK.S
+++ b/vm/mterp/x86/OP_INVOKE_SUPER_QUICK.S
@@ -23,7 +23,5 @@
movl offClassObject_vtable(%ecx),%ecx # ecx<- vtable
EXPORT_PC()
movl (%ecx,%eax,4),%eax # eax<- super->vtable[BBBB]
- movl $$$isrange,%ecx # ecx<- range flag
- #jmp common_invokeMethod${routine}
- jmp common_invokeOld
+ jmp common_invokeMethod${routine}
diff --git a/vm/mterp/x86/OP_INVOKE_VIRTUAL.S b/vm/mterp/x86/OP_INVOKE_VIRTUAL.S
index 6d32a81..20d9120 100644
--- a/vm/mterp/x86/OP_INVOKE_VIRTUAL.S
+++ b/vm/mterp/x86/OP_INVOKE_VIRTUAL.S
@@ -52,7 +52,5 @@
movl offObject_clazz(%ecx),%ecx # ecx<- thisPtr->clazz
movl offClassObject_vtable(%ecx),%ecx # ecx<- thisPtr->clazz->vtable
movl (%ecx,%eax,4),%eax # eax<- vtable[methodIndex]
- movl $$$isrange,%ecx # needed for common_invokeOld
- #jmp common_invokeMethod${routine}
- jmp common_invokeOld
+ jmp common_invokeMethod${routine}
diff --git a/vm/mterp/x86/OP_INVOKE_VIRTUAL_QUICK.S b/vm/mterp/x86/OP_INVOKE_VIRTUAL_QUICK.S
index d197f29..f36ed2d 100644
--- a/vm/mterp/x86/OP_INVOKE_VIRTUAL_QUICK.S
+++ b/vm/mterp/x86/OP_INVOKE_VIRTUAL_QUICK.S
@@ -20,7 +20,6 @@
movl offClassObject_vtable(%eax),%eax # eax<- thisPtr->clazz->vtable
EXPORT_PC() # might throw later - get ready
movl (%eax,%ecx,4),%eax # eax<- vtable[BBBB]
- movl $$$isrange,%ecx # pass range flag
- #jmp common_invokeMethod${routine}
- jmp common_invokeOld
+ jmp common_invokeMethod${routine}
+
diff --git a/vm/mterp/x86/OP_MONITOR_ENTER.S b/vm/mterp/x86/OP_MONITOR_ENTER.S
index 18425f4..548f71f 100644
--- a/vm/mterp/x86/OP_MONITOR_ENTER.S
+++ b/vm/mterp/x86/OP_MONITOR_ENTER.S
@@ -10,9 +10,7 @@
movl offGlue_self(%ecx),%ecx # ecx<- glue->self
FETCH_INST_WORD(1)
testl %eax,%eax # null object?
-#ifdef WITH_MONITOR_TRACKING
- EXPORT_PC()
-#endif
+ EXPORT_PC() # need for precise GC, MONITOR_TRACKING
jne .L${opcode}_continue
jmp common_errNullObject
%break
diff --git a/vm/mterp/x86/footer.S b/vm/mterp/x86/footer.S
index 50634dd..d86207a 100644
--- a/vm/mterp/x86/footer.S
+++ b/vm/mterp/x86/footer.S
@@ -25,11 +25,217 @@
*/
common_backwardBranch:
GET_GLUE(%ecx)
- call common_periodicChecks # Note: expects rPC to be preserved
+ call common_periodicChecks # Note: expects rPC to be preserved
ADVANCE_PC_INDEXED(rINST_FULL)
FETCH_INST()
GOTO_NEXT
+
+
+/*
+ * Common code for method invocation with range.
+ *
+ * On entry:
+ * eax = Method* methodToCall
+ * rINST trashed, must reload
+ */
+
+common_invokeMethodRange:
+.LinvokeNewRange:
+
+ /*
+ * prepare to copy args to "outs" area of current frame
+ */
+
+ movzbl 1(rPC),rINST_FULL # rINST_FULL<- AA
+ movzwl 4(rPC), %ecx # %ecx<- CCCC
+ SPILL(rPC)
+ SAVEAREA_FROM_FP(%edx,rFP) # %edx<- &StackSaveArea
+ test rINST_FULL, rINST_FULL
+ movl rINST_FULL, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- AA
+ jz .LinvokeArgsDone # no args; jump to args done
+
+
+ /*
+ * %eax=methodToCall, %ecx=CCCC, LOCAL0_OFFSET(%ebp)=count, %edx=&outs (&stackSaveArea)
+ * (very few methods have > 10 args; could unroll for common cases)
+ */
+
+ movl %ebx, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- save %ebx
+ lea (rFP, %ecx, 4), %ecx # %ecx<- &vCCCC
+ shll $$2, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- offset
+ subl LOCAL0_OFFSET(%ebp), %edx # %edx<- update &outs
+ shrl $$2, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- offset
+1:
+ movl (%ecx), %ebx # %ebx<- vCCCC
+ lea 4(%ecx), %ecx # %ecx<- &vCCCC++
+ subl $$1, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET<- LOCAL0_OFFSET--
+ movl %ebx, (%edx) # *outs<- vCCCC
+ lea 4(%edx), %edx # outs++
+ jne 1b # loop if count (LOCAL0_OFFSET(%ebp)) not zero
+ movl LOCAL1_OFFSET(%ebp), %ebx # %ebx<- restore %ebx
+ jmp .LinvokeArgsDone # continue
+
+ /*
+ * %eax is "Method* methodToCall", the method we're trying to call
+ * prepare to copy args to "outs" area of current frame
+ */
+
+common_invokeMethodNoRange:
+.LinvokeNewNoRange:
+ movzbl 1(rPC),rINST_FULL # rINST_FULL<- BA
+ SPILL(rPC)
+ movl rINST_FULL, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- BA
+ shrl $$4, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET(%ebp)<- B
+ je .LinvokeArgsDone # no args; jump to args done
+ movzwl 4(rPC), %ecx # %ecx<- GFED
+ SAVEAREA_FROM_FP(%edx,rFP) # %edx<- &StackSaveArea
+
+ /*
+ * %eax=methodToCall, %ecx=GFED, LOCAL0_OFFSET(%ebp)=count, %edx=outs
+ */
+
+.LinvokeNonRange:
+ cmp $$2, LOCAL0_OFFSET(%ebp) # compare LOCAL0_OFFSET(%ebp) to 2
+ movl %ecx, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- GFED
+ jl 1f # handle 1 arg
+ je 2f # handle 2 args
+ cmp $$4, LOCAL0_OFFSET(%ebp) # compare LOCAL0_OFFSET(%ebp) to 4
+ jl 3f # handle 3 args
+ je 4f # handle 4 args
+5:
+ andl $$15, rINST_FULL # rINST<- A
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, rINST_FULL, 4), %ecx # %ecx<- vA
+ movl %ecx, (%edx) # *outs<- vA
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+4:
+ shr $$12, %ecx # %ecx<- G
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vG
+ movl %ecx, (%edx) # *outs<- vG
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+3:
+ and $$0x0f00, %ecx # %ecx<- 0F00
+ shr $$8, %ecx # %ecx<- F
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vF
+ movl %ecx, (%edx) # *outs<- vF
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+2:
+ and $$0x00f0, %ecx # %ecx<- 00E0
+ shr $$4, %ecx # %ecx<- E
+ lea -4(%edx), %edx # %edx<- update &outs; &outs--
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vE
+ movl %ecx, (%edx) # *outs<- vE
+ movl LOCAL1_OFFSET(%ebp), %ecx # %ecx<- GFED
+1:
+ and $$0x000f, %ecx # %ecx<- 000D
+ movl (rFP, %ecx, 4), %ecx # %ecx<- vD
+ movl %ecx, -4(%edx) # *--outs<- vD
+0:
+
+ /*
+ * %eax is "Method* methodToCall", the method we're trying to call
+ * find space for the new stack frame, check for overflow
+ */
+
+.LinvokeArgsDone:
+ movzwl offMethod_registersSize(%eax), %edx # %edx<- methodToCall->regsSize
+ movzwl offMethod_outsSize(%eax), %ecx # %ecx<- methodToCall->outsSize
+ movl %eax, LOCAL0_OFFSET(%ebp) # LOCAL0_OFFSET<- methodToCall
+ shl $$2, %edx # %edx<- update offset
+ SAVEAREA_FROM_FP(%eax,rFP) # %eax<- &StackSaveArea
+ subl %edx, %eax # %eax<- newFP; (old savearea - regsSize)
+ GET_GLUE(%edx) # %edx<- pMterpGlue
+ movl %eax, LOCAL1_OFFSET(%ebp) # LOCAL1_OFFSET(%ebp)<- &outs
+ subl $$sizeofStackSaveArea, %eax # %eax<- newSaveArea (stack save area using newFP)
+ movl offGlue_interpStackEnd(%edx), %edx # %edx<- glue->interpStackEnd
+ movl %edx, LOCAL2_OFFSET(%ebp) # LOCAL2_OFFSET<- glue->interpStackEnd
+ shl $$2, %ecx # %ecx<- update offset for outsSize
+ movl %eax, %edx # %edx<- newSaveArea
+ sub %ecx, %eax # %eax<- bottom; (newSaveArea - outsSize)
+ cmp LOCAL2_OFFSET(%ebp), %eax # compare interpStackEnd and bottom
+ movl LOCAL0_OFFSET(%ebp), %eax # %eax<- restore methodToCall
+ jl .LstackOverflow # handle frame overflow
+
+ /*
+ * set up newSaveArea
+ */
+
+#ifdef EASY_GDB
+ SAVEAREA_FROM_FP(%ecx,rFP) # %ecx<- &StackSaveArea
+ movl %ecx, offStackSaveArea_prevSave(%edx) # newSaveArea->prevSave<- &outs
+#endif
+ movl rFP, offStackSaveArea_prevFrame(%edx) # newSaveArea->prevFrame<- rFP
+ movl rPC_SPILL(%ebp), %ecx
+ movl %ecx, offStackSaveArea_savedPc(%edx) # newSaveArea->savedPc<- rPC
+ testl $$ACC_NATIVE, offMethod_accessFlags(%eax) # check for native call
+ movl %eax, offStackSaveArea_method(%edx) # newSaveArea->method<- method to call
+ jne .LinvokeNative # handle native call
+
+ /*
+ * Update "glue" values for the new method
+ * %eax=methodToCall, LOCAL1_OFFSET(%ebp)=newFp
+ */
+
+ movl offMethod_clazz(%eax), %edx # %edx<- method->clazz
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl offClassObject_pDvmDex(%edx), %edx # %edx<- method->clazz->pDvmDex
+ movl %eax, offGlue_method(%ecx) # glue->method<- methodToCall
+ movl %edx, offGlue_methodClassDex(%ecx) # glue->methodClassDex<- method->clazz->pDvmDex
+ movl offMethod_insns(%eax), rPC # rPC<- methodToCall->insns
+ movl offGlue_self(%ecx), %eax # %eax<- glue->self
+ movl LOCAL1_OFFSET(%ebp), rFP # rFP<- newFP
+ movl rFP, offThread_curFrame(%eax) # glue->self->curFrame<- newFP
+ FETCH_INST()
+ GOTO_NEXT # jump to methodToCall->insns
+
+ /*
+ * Prep for the native call
+ * %eax=methodToCall, LOCAL1_OFFSET(%ebp)=newFP, %edx=newSaveArea
+ */
+
+.LinvokeNative:
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl %eax, OUT_ARG1(%esp) # push parameter methodToCall
+ movl offGlue_self(%ecx), %ecx # %ecx<- glue->self
+ movl offThread_jniLocal_nextEntry(%ecx), %eax # %eax<- glue->self->thread->refNext
+ movl %eax, offStackSaveArea_localRefTop(%edx) # newSaveArea->localRefTop<- refNext
+ movl %edx, OUT_ARG4(%esp) # save newSaveArea
+ movl LOCAL1_OFFSET(%ebp), %edx # %edx<- newFP
+ movl %edx, offThread_curFrame(%ecx) # glue->self->curFrame<- newFP
+ movl %ecx, OUT_ARG3(%esp) # save glue->self
+ movl %ecx, OUT_ARG2(%esp) # push parameter glue->self
+ GET_GLUE(%ecx) # %ecx<- pMterpGlue
+ movl OUT_ARG1(%esp), %eax # %eax<- methodToCall
+ lea offGlue_retval(%ecx), %ecx # %ecx<- &retval
+ movl %ecx, OUT_ARG0(%esp) # push parameter pMterpGlue
+ push %edx # push parameter newFP
+
+ call *offMethod_nativeFunc(%eax) # call methodToCall->nativeFunc
+ lea 4(%esp), %esp
+ movl OUT_ARG4(%esp), %ecx # %ecx<- newSaveArea
+ movl OUT_ARG3(%esp), %eax # %eax<- glue->self
+ movl offStackSaveArea_localRefTop(%ecx), %edx # %edx<- newSaveArea->localRefTop
+ cmp $$0, offThread_exception(%eax) # check for exception
+ movl rFP, offThread_curFrame(%eax) # glue->self->curFrame<- rFP
+ movl %edx, offThread_jniLocal_nextEntry(%eax) # glue->self<- newSaveArea->localRefTop
+ UNSPILL(rPC)
+ jne common_exceptionThrown # handle exception
+ FETCH_INST_WORD(3)
+ ADVANCE_PC(3)
+ GOTO_NEXT # jump to next instruction
+
+.LstackOverflow:
+ GET_GLUE(%eax) # %eax<- pMterpGlue
+ movl offGlue_self(%eax), %eax # %eax<- glue->self
+ movl %eax, OUT_ARG0(%esp) # push parameter self
+ call dvmHandleStackOverflow # call: (Thread* self)
+ UNSPILL(rPC) # return: void
+ jmp common_exceptionThrown # handle exception
+
+
/*
* Common invoke code (old-style).
* TUNING: Rewrite along lines of new armv5 code?
@@ -106,6 +312,7 @@
* bool dvmCheckSuspendPending(Thread* self)
* Because we reached here via a call, go ahead and build a new frame.
*/
+ EXPORT_PC() # need for precise GC
movl offGlue_self(%ecx),%eax # eax<- glue->self
SPILL(rPC) # save edx
push %ebp
diff --git a/vm/native/dalvik_system_VMDebug.c b/vm/native/dalvik_system_VMDebug.c
index ec6d92e..d3d0d42 100644
--- a/vm/native/dalvik_system_VMDebug.c
+++ b/vm/native/dalvik_system_VMDebug.c
@@ -574,6 +574,118 @@
RETURN_VOID();
}
+/*
+ * static boolean cacheRegisterMap(String classAndMethodDescr)
+ *
+ * If the specified class is loaded, and the named method exists, ensure
+ * that the method's register map is ready for use. If the class/method
+ * cannot be found, nothing happens.
+ *
+ * This can improve the zygote's sharing of compressed register maps. Do
+ * this after class preloading.
+ *
+ * Returns true if the register map is cached and ready, either as a result
+ * of this call or earlier activity. Returns false if the class isn't loaded,
+ * if the method couldn't be found, or if the method has no register map.
+ *
+ * (Uncomment logs in dvmGetExpandedRegisterMap0() to gather stats.)
+ */
+static void Dalvik_dalvik_system_VMDebug_cacheRegisterMap(const u4* args,
+ JValue* pResult)
+{
+ StringObject* classAndMethodDescStr = (StringObject*) args[0];
+ ClassObject* clazz;
+ bool result = false;
+
+ if (classAndMethodDescStr == NULL) {
+ dvmThrowException("Ljava/lang/NullPointerException;", NULL);
+ RETURN_VOID();
+ }
+
+ char* classAndMethodDesc = NULL;
+
+ /*
+ * Pick the string apart. We have a local copy, so just modify it
+ * in place.
+ */
+ classAndMethodDesc = dvmCreateCstrFromString(classAndMethodDescStr);
+
+ char* methodName = strchr(classAndMethodDesc, '.');
+ if (methodName == NULL) {
+ dvmThrowException("Ljava/lang/RuntimeException;",
+ "method name not found in string");
+ RETURN_VOID();
+ }
+ *methodName++ = '\0';
+
+ char* methodDescr = strchr(methodName, ':');
+ if (methodDescr == NULL) {
+ dvmThrowException("Ljava/lang/RuntimeException;",
+ "method descriptor not found in string");
+ RETURN_VOID();
+ }
+ *methodDescr++ = '\0';
+
+ //LOGD("GOT: %s %s %s\n", classAndMethodDesc, methodName, methodDescr);
+
+ /*
+ * Find the class, but only if it's already loaded.
+ */
+ clazz = dvmLookupClass(classAndMethodDesc, NULL, false);
+ if (clazz == NULL) {
+ LOGD("Class %s not found in bootstrap loader\n", classAndMethodDesc);
+ goto bail;
+ }
+
+ Method* method;
+
+ /*
+ * Find the method, which could be virtual or direct, defined directly
+ * or inherited.
+ */
+ if (methodName[0] == '<') {
+ /*
+ * Constructor or class initializer. Only need to examine the
+ * "direct" list, and don't need to search up the class hierarchy.
+ */
+ method = dvmFindDirectMethodByDescriptor(clazz, methodName,
+ methodDescr);
+ } else {
+ /*
+ * Try both lists, and scan up the tree.
+ */
+ method = dvmFindVirtualMethodHierByDescriptor(clazz, methodName,
+ methodDescr);
+ if (method == NULL) {
+ method = dvmFindDirectMethodHierByDescriptor(clazz, methodName,
+ methodDescr);
+ }
+ }
+
+ if (method != NULL) {
+ /*
+ * Got it. See if there's a register map here.
+ */
+ const RegisterMap* pMap;
+ pMap = dvmGetExpandedRegisterMap(method);
+ if (pMap == NULL) {
+ LOGV("No map for %s.%s %s\n",
+ classAndMethodDesc, methodName, methodDescr);
+ } else {
+ LOGV("Found map %s.%s %s\n",
+ classAndMethodDesc, methodName, methodDescr);
+ result = true;
+ }
+ } else {
+ LOGV("Unable to find %s.%s %s\n",
+ classAndMethodDesc, methodName, methodDescr);
+ }
+
+bail:
+ free(classAndMethodDesc);
+ RETURN_BOOLEAN(result);
+}
+
const DalvikNativeMethod dvm_dalvik_system_VMDebug[] = {
{ "getAllocCount", "(I)I",
Dalvik_dalvik_system_VMDebug_getAllocCount },
@@ -621,6 +733,8 @@
Dalvik_dalvik_system_VMDebug_threadCpuTimeNanos },
{ "dumpHprofData", "(Ljava/lang/String;)V",
Dalvik_dalvik_system_VMDebug_dumpHprofData },
+ { "cacheRegisterMap", "(Ljava/lang/String;)Z",
+ Dalvik_dalvik_system_VMDebug_cacheRegisterMap },
{ NULL, NULL, NULL },
};
diff --git a/vm/oo/Class.c b/vm/oo/Class.c
index 47e2a87..0832d99 100644
--- a/vm/oo/Class.c
+++ b/vm/oo/Class.c
@@ -1750,7 +1750,39 @@
dvmLinearReadOnly(classLoader, newClass->ifields);
}
- /* load method definitions */
+ /*
+ * Load method definitions. We do this in two batches, direct then
+ * virtual.
+ *
+ * If register maps have already been generated for this class, and
+ * precise GC is enabled, we pull out pointers to them. We know that
+ * they were streamed to the DEX file in the same order in which the
+ * methods appear.
+ *
+ * If the class wasn't pre-verified, the maps will be generated when
+ * the class is verified during class initialization.
+ */
+ u4 classDefIdx = dexGetIndexForClassDef(pDexFile, pClassDef);
+ const void* classMapData;
+ u4 numMethods;
+
+ if (gDvm.preciseGc) {
+ classMapData =
+ dvmRegisterMapGetClassData(pDexFile, classDefIdx, &numMethods);
+
+ /* sanity check */
+ if (classMapData != NULL &&
+ pHeader->directMethodsSize + pHeader->virtualMethodsSize != numMethods)
+ {
+ LOGE("ERROR: in %s, direct=%d virtual=%d, maps have %d\n",
+ newClass->descriptor, pHeader->directMethodsSize,
+ pHeader->virtualMethodsSize, numMethods);
+ assert(false);
+ classMapData = NULL; /* abandon */
+ }
+ } else {
+ classMapData = NULL;
+ }
if (pHeader->directMethodsSize != 0) {
int count = (int) pHeader->directMethodsSize;
@@ -1763,6 +1795,15 @@
for (i = 0; i < count; i++) {
dexReadClassDataMethod(&pEncodedData, &method, &lastIndex);
loadMethodFromDex(newClass, &method, &newClass->directMethods[i]);
+ if (classMapData != NULL) {
+ const RegisterMap* pMap = dvmRegisterMapGetNext(&classMapData);
+ if (dvmRegisterMapGetFormat(pMap) != kRegMapFormatNone) {
+ newClass->directMethods[i].registerMap = pMap;
+ /* TODO: add rigorous checks */
+ assert((newClass->directMethods[i].registersSize+7) / 8 ==
+ newClass->directMethods[i].registerMap->regWidth);
+ }
+ }
}
dvmLinearReadOnly(classLoader, newClass->directMethods);
}
@@ -1778,6 +1819,15 @@
for (i = 0; i < count; i++) {
dexReadClassDataMethod(&pEncodedData, &method, &lastIndex);
loadMethodFromDex(newClass, &method, &newClass->virtualMethods[i]);
+ if (classMapData != NULL) {
+ const RegisterMap* pMap = dvmRegisterMapGetNext(&classMapData);
+ if (dvmRegisterMapGetFormat(pMap) != kRegMapFormatNone) {
+ newClass->virtualMethods[i].registerMap = pMap;
+ /* TODO: add rigorous checks */
+ assert((newClass->virtualMethods[i].registersSize+7) / 8 ==
+ newClass->virtualMethods[i].registerMap->regWidth);
+ }
+ }
}
dvmLinearReadOnly(classLoader, newClass->virtualMethods);
}
@@ -1943,6 +1993,8 @@
/*
* Free anything in a Method that was allocated on the system heap.
+ *
+ * The containing class is largely torn down by this point.
*/
static void freeMethodInnards(Method* meth)
{
@@ -1950,26 +2002,31 @@
free(meth->exceptions);
free(meth->lines);
free(meth->locals);
-#else
- // TODO: call dvmFreeRegisterMap() if meth->registerMap was allocated
- // on the system heap
- UNUSED_PARAMETER(meth);
#endif
+
+ /*
+ * Some register maps are allocated on the heap, either because of late
+ * verification or because we're caching an uncompressed form.
+ */
+ const RegisterMap* pMap = meth->registerMap;
+ if (pMap != NULL && dvmRegisterMapGetOnHeap(pMap)) {
+ dvmFreeRegisterMap((RegisterMap*) pMap);
+ meth->registerMap = NULL;
+ }
}
/*
* Clone a Method, making new copies of anything that will be freed up
- * by freeMethodInnards().
+ * by freeMethodInnards(). This is used for "miranda" methods.
*/
static void cloneMethod(Method* dst, const Method* src)
{
+ if (src->registerMap != NULL) {
+ LOGE("GLITCH: only expected abstract methods here\n");
+ LOGE(" cloning %s.%s\n", src->clazz->descriptor, src->name);
+ dvmAbort();
+ }
memcpy(dst, src, sizeof(Method));
-#if 0
- /* for current usage, these are never set, so no need to implement copy */
- assert(dst->exceptions == NULL);
- assert(dst->lines == NULL);
- assert(dst->locals == NULL);
-#endif
}
/*
@@ -4300,19 +4357,21 @@
/*
* Add a RegisterMap to a Method. This is done when we verify the class
- * and compute the register maps at class initialization time, which means
- * that "pMap" is on the heap and should be freed when the Method is
- * discarded.
+ * and compute the register maps at class initialization time (i.e. when
+ * we don't have a pre-generated map). This means "pMap" is on the heap
+ * and should be freed when the Method is discarded.
*/
void dvmSetRegisterMap(Method* method, const RegisterMap* pMap)
{
ClassObject* clazz = method->clazz;
if (method->registerMap != NULL) {
- LOGW("WARNING: registerMap already set for %s.%s\n",
+ /* unexpected during class loading, okay on first use (uncompress) */
+ LOGV("NOTE: registerMap already set for %s.%s\n",
method->clazz->descriptor, method->name);
/* keep going */
}
+ assert(!dvmIsNativeMethod(method) && !dvmIsAbstractMethod(method));
/* might be virtual or direct */
dvmLinearReadWrite(clazz->classLoader, clazz->virtualMethods);
diff --git a/vm/oo/Object.c b/vm/oo/Object.c
index 189ad09..9cd0afd 100644
--- a/vm/oo/Object.c
+++ b/vm/oo/Object.c
@@ -90,18 +90,16 @@
assert(clazz != NULL);
+ /*
+ * Find a field with a matching name and signature. As with instance
+ * fields, the VM allows you to have two fields with the same name so
+ * long as they have different types.
+ */
pField = clazz->sfields;
for (i = 0; i < clazz->sfieldCount; i++, pField++) {
- if (strcmp(fieldName, pField->field.name) == 0) {
- /*
- * The name matches. Unlike methods, we can't have two fields
- * with the same names but differing types.
- */
- if (strcmp(signature, pField->field.signature) != 0) {
- LOGW("Found field '%s', but sig is '%s' not '%s'\n",
- fieldName, pField->field.signature, signature);
- return NULL;
- }
+ if (strcmp(fieldName, pField->field.name) == 0 &&
+ strcmp(signature, pField->field.signature) == 0)
+ {
return pField;
}
}
diff --git a/vm/oo/Resolve.c b/vm/oo/Resolve.c
index 52eeee0..68fdd51 100644
--- a/vm/oo/Resolve.c
+++ b/vm/oo/Resolve.c
@@ -130,8 +130,11 @@
referrer->pDvmDex,
resClass->descriptor, resClassCheck->descriptor,
resClassCheck->classLoader, resClassCheck->pDvmDex);
+ LOGW("(%s had used a different %s during pre-verification)\n",
+ referrer->descriptor, resClass->descriptor);
dvmThrowException("Ljava/lang/IllegalAccessError;",
- "cross-loader access from pre-verified class");
+ "Class ref in pre-verified class resolved to unexpected "
+ "implementation");
return NULL;
}
}
diff --git a/vm/test/AtomicSpeed.c b/vm/test/AtomicSpeed.c
new file mode 100644
index 0000000..e2ffbef
--- /dev/null
+++ b/vm/test/AtomicSpeed.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Atomic operation performance test.
+ */
+#include "Dalvik.h"
+
+//#define TRIVIAL_COMPARE /* do something simple instead of an atomic op */
+
+/*
+ * Perform operation. Returns elapsed time.
+ */
+u8 dvmTestAtomicSpeedSub(int repeatCount)
+{
+ static int value = 7;
+ int* valuePtr = &value;
+ u8 start, end;
+ int i;
+
+#ifdef TRIVIAL_COMPARE
+ /* init to arg value so compiler can't pre-determine result */
+ int j = repeatCount;
+#endif
+
+ assert((repeatCount % 10) == 0);
+
+ start = dvmGetRelativeTimeNsec();
+
+ for (i = repeatCount / 10; i != 0; i--) {
+#ifdef TRIVIAL_COMPARE
+ // integer add (Dream: 3.4ns -- THUMB has 10 adds, ARM condenses)
+ j += i; j += i; j += i; j += i; j += i;
+ j += i; j += i; j += i; j += i; j += i;
+#else
+ // succeed 10x (Dream: 155.9ns)
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 7, 7);
+
+ // fail 10x (Dream: 158.5ns)
+ /*
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ ATOMIC_CMP_SWAP(valuePtr, 6, 7);
+ */
+#endif
+ }
+
+ end = dvmGetRelativeTimeNsec();
+
+#ifdef TRIVIAL_COMPARE
+ /* use value so compiler can't eliminate it */
+ dvmFprintf(stdout, "%d\n", j);
+#else
+ dvmFprintf(stdout, ".");
+ fflush(stdout); // not quite right if they intercepted fprintf
+#endif
+ return end - start;
+}
+
+/*
+ * Control loop.
+ */
+bool dvmTestAtomicSpeed(void)
+{
+ static const int kIterations = 10;
+ static const int kRepeatCount = 5 * 1000 * 1000;
+ static const int kDelay = 500 * 1000;
+ u8 results[kIterations];
+ int i;
+
+ for (i = 0; i < kIterations; i++) {
+ results[i] = dvmTestAtomicSpeedSub(kRepeatCount);
+ usleep(kDelay);
+ }
+
+ dvmFprintf(stdout, "\n");
+ dvmFprintf(stdout, "Atomic speed test results (%d per iteration):\n",
+ kRepeatCount);
+ for (i = 0; i < kIterations; i++) {
+ dvmFprintf(stdout,
+ " %2d: %.3fns\n", i, (double) results[i] / kRepeatCount);
+ }
+
+ return true;
+}
+
diff --git a/vm/test/Test.h b/vm/test/Test.h
index a6b54a5..ce47aae 100644
--- a/vm/test/Test.h
+++ b/vm/test/Test.h
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* Internal unit tests.
*/
@@ -20,5 +21,6 @@
#define _DALVIK_TEST_TEST
bool dvmTestHash(void);
+bool dvmTestAtomicSpeed(void);
#endif /*_DALVIK_TEST_TEST*/