am 1c7705b6: Merge change I96996494 into eclair-mr2
Merge commit '1c7705b6066ea57109557fc1cb0609991ac0af24' into eclair-mr2-plus-aosp
* commit '1c7705b6066ea57109557fc1cb0609991ac0af24':
Fix browser crashes if server certificates have > 32 subjectAltNames.
diff --git a/dx/src/com/android/dx/cf/code/BytecodeArray.java b/dx/src/com/android/dx/cf/code/BytecodeArray.java
index 60f0cee..83cff5d 100644
--- a/dx/src/com/android/dx/cf/code/BytecodeArray.java
+++ b/dx/src/com/android/dx/cf/code/BytecodeArray.java
@@ -1235,7 +1235,7 @@
*
* @param offset offset to the instruction
* @param length length of the instruction, in bytes
- * @param cst {@code non-null;} the type of the array
+ * @param type {@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,
diff --git a/dx/src/com/android/dx/dex/code/LocalList.java b/dx/src/com/android/dx/dex/code/LocalList.java
index 93e7c3f..94ca663 100644
--- a/dx/src/com/android/dx/dex/code/LocalList.java
+++ b/dx/src/com/android/dx/dex/code/LocalList.java
@@ -280,7 +280,7 @@
/**
* Returns whether or not this instance matches the given spec.
*
- * @param spec {@code non-null;} the spec in question
+ * @param otherSpec {@code non-null;} the spec in question
* @return {@code true} iff this instance matches
* {@code spec}
*/
diff --git a/libcore/regex/src/main/java/java/util/regex/Pattern.java b/libcore/regex/src/main/java/java/util/regex/Pattern.java
index 2853bbe..2c71de1 100644
--- a/libcore/regex/src/main/java/java/util/regex/Pattern.java
+++ b/libcore/regex/src/main/java/java/util/regex/Pattern.java
@@ -47,7 +47,7 @@
* boolean b2 = Pattern.matches("Hello, A[a-z]*!", "Hello, Robot!"); // false
* </pre>
* <p/>
- * Please consult the <a href="package.html">package documentation</a> for an
+ * Please consult the <a href="package-summary.html">package documentation</a> for an
* overview of the regular expression syntax used in this class as well as
* Android-specific implementation details.
*
diff --git a/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 7149272..40a4116 100644
--- a/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/libcore/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -479,7 +479,7 @@
* @returns index of the separator
*/
static int findSeparator(const char* s) {
- char* pointer = strchr(s, '|');
+ const char* pointer = strchr(s, '|');
return pointer == NULL ? -1 : pointer - s;
}
diff --git a/vm/oo/Class.c b/vm/oo/Class.c
index 1bde718..115a122 100644
--- a/vm/oo/Class.c
+++ b/vm/oo/Class.c
@@ -180,6 +180,8 @@
const DexField* pDexSField, StaticField* sfield);
static void loadIFieldFromDex(ClassObject* clazz,
const DexField* pDexIField, InstField* field);
+static bool precacheReferenceOffsets(ClassObject* clazz);
+static void computeRefOffsets(ClassObject* clazz);
static void freeMethodInnards(Method* meth);
static bool createVtable(ClassObject* clazz);
static bool createIftable(ClassObject* clazz);
@@ -2289,7 +2291,7 @@
/*
* Cache java.lang.ref.Reference fields and methods.
*/
-static bool precacheReferenceOffsets(ClassObject *clazz)
+static bool precacheReferenceOffsets(ClassObject* clazz)
{
Method *meth;
int i;
@@ -2388,6 +2390,51 @@
/*
+ * Set the bitmap of reference offsets, refOffsets, from the ifields
+ * list.
+ */
+static void computeRefOffsets(ClassObject* clazz)
+{
+ if (clazz->super != NULL) {
+ clazz->refOffsets = clazz->super->refOffsets;
+ } else {
+ clazz->refOffsets = 0;
+ }
+ /*
+ * If our superclass overflowed, we don't stand a chance.
+ */
+ if (clazz->refOffsets != CLASS_WALK_SUPER) {
+ InstField *f;
+ int i;
+
+ /* All of the fields that contain object references
+ * are guaranteed to be at the beginning of the ifields list.
+ */
+ f = clazz->ifields;
+ const int ifieldRefCount = clazz->ifieldRefCount;
+ for (i = 0; i < ifieldRefCount; i++) {
+ /*
+ * Note that, per the comment on struct InstField,
+ * f->byteOffset is the offset from the beginning of
+ * obj, not the offset into obj->instanceData.
+ */
+ assert(f->byteOffset >= CLASS_SMALLEST_OFFSET);
+ assert((f->byteOffset & (CLASS_OFFSET_ALIGNMENT - 1)) == 0);
+ if (CLASS_CAN_ENCODE_OFFSET(f->byteOffset)) {
+ u4 newBit = CLASS_BIT_FROM_OFFSET(f->byteOffset);
+ assert(newBit != 0);
+ clazz->refOffsets |= newBit;
+ } else {
+ clazz->refOffsets = CLASS_WALK_SUPER;
+ break;
+ }
+ f++;
+ }
+ }
+}
+
+
+/*
* Link (prepare and resolve). Verification is deferred until later.
*
* This converts symbolic references into pointers. It's independent of
@@ -2755,6 +2802,13 @@
}
/*
+ * Compact the offsets the GC has to examine into a bitmap, if
+ * possible. (This has to happen after Reference.referent is
+ * massaged in precacheReferenceOffsets.)
+ */
+ computeRefOffsets(clazz);
+
+ /*
* Done!
*/
if (IS_CLASS_FLAG_SET(clazz, CLASS_ISPREVERIFIED))
@@ -4421,44 +4475,6 @@
dvmCallMethod(self, method, NULL, &unused);
}
- /* Set the bitmap of reference offsets. Except for class Object,
- * start with the superclass offsets.
- */
- if (clazz->super != NULL) {
- clazz->refOffsets = clazz->super->refOffsets;
- } else {
- clazz->refOffsets = 0;
- }
- /*
- * If our superclass overflowed, we don't stand a chance.
- */
- if (clazz->refOffsets != CLASS_WALK_SUPER) {
- InstField *f;
- int i;
-
- /* All of the fields that contain object references
- * are guaranteed to be at the beginning of the ifields list.
- */
- f = clazz->ifields;
- for (i = 0; i < clazz->ifieldRefCount; i++) {
- /*
- * Note that, per the comment on struct InstField,
- * f->byteOffset is the offset from the beginning of
- * obj, not the offset into obj->instanceData.
- */
- assert(f->byteOffset >= (int) CLASS_SMALLEST_OFFSET);
- assert((f->byteOffset & (CLASS_OFFSET_ALIGNMENT - 1)) == 0);
- u4 newBit = CLASS_BIT_FROM_OFFSET(f->byteOffset);
- if (newBit != 0) {
- clazz->refOffsets |= newBit;
- } else {
- clazz->refOffsets = CLASS_WALK_SUPER;
- break;
- }
- f++;
- }
- }
-
if (dvmCheckException(self)) {
/*
* We've had an exception thrown during static initialization. We
diff --git a/vm/oo/Object.h b/vm/oo/Object.h
index 3e724f4..e467fe9 100644
--- a/vm/oo/Object.h
+++ b/vm/oo/Object.h
@@ -187,12 +187,23 @@
#define CLASS_OFFSET_ALIGNMENT 4
#define CLASS_HIGH_BIT ((unsigned int)1 << (CLASS_BITS_PER_WORD - 1))
/*
- * Return a single bit, or zero if the encoding can't encode the offset.
+ * Given an offset, return the bit number which would encode that offset.
+ * Local use only.
+ */
+#define _CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset) \
+ (((unsigned int)(byteOffset) - CLASS_SMALLEST_OFFSET) / \
+ CLASS_OFFSET_ALIGNMENT)
+/*
+ * Is the given offset too large to be encoded?
+ */
+#define CLASS_CAN_ENCODE_OFFSET(byteOffset) \
+ (_CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset) < CLASS_BITS_PER_WORD)
+/*
+ * Return a single bit, encoding the offset.
+ * Undefined if the offset is too large, as defined above.
*/
#define CLASS_BIT_FROM_OFFSET(byteOffset) \
- (CLASS_HIGH_BIT >> \
- (((unsigned int)(byteOffset) - CLASS_SMALLEST_OFFSET) / \
- CLASS_OFFSET_ALIGNMENT))
+ (CLASS_HIGH_BIT >> _CLASS_BIT_NUMBER_FROM_OFFSET(byteOffset))
/*
* Return an offset, given a bit number as returned from CLZ.
*/