OSDN Git Service

Merge tag 'android-4.4.4_r2' into kitkat-x86 kitkat-x86 android-x86-4.4-r2 android-x86-4.4-r3
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 27 Aug 2014 10:35:20 +0000 (18:35 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 27 Aug 2014 10:35:20 +0000 (18:35 +0800)
Android 4.4.4 Release 2

Conflicts:
vm/JarFile.cpp

dx/src/com/android/dx/command/dexer/Main.java
dx/src/com/android/dx/dex/cf/CfTranslator.java
dx/src/com/android/dx/dex/file/FieldIdsSection.java
dx/src/com/android/dx/dex/file/MethodIdsSection.java
dx/src/com/android/dx/dex/file/TypeIdsSection.java
dx/src/com/android/dx/merge/DexMerger.java
vm/JarFile.cpp

index ab6d2f7..8c77d89 100644 (file)
@@ -1477,8 +1477,9 @@ public class Main {
             }
 
             if (multiDex && numThreads != 1) {
-                System.out.println(NUM_THREADS_OPTION + "is ignored when used with "
+                System.out.println(NUM_THREADS_OPTION + " is ignored when used with "
                     + MULTI_DEX_OPTION);
+                numThreads = 1;
             }
 
             if (multiDex && incremental) {
index 8ab1c84..92ea0f7 100644 (file)
@@ -142,20 +142,18 @@ public class CfTranslator {
         ConstantPool constantPool = cf.getConstantPool();
         int constantPoolSize = constantPool.size();
 
-        synchronized (dexFile) {
-            for (int i = 0; i < constantPoolSize; i++) {
-                Constant constant = constantPool.getOrNull(i);
-                if (constant instanceof CstMethodRef) {
-                    methodIdsSection.intern((CstBaseMethodRef) constant);
-                } else if (constant instanceof CstInterfaceMethodRef) {
-                    methodIdsSection.intern(((CstInterfaceMethodRef) constant).toMethodRef());
-                } else if (constant instanceof CstFieldRef) {
-                    fieldIdsSection.intern((CstFieldRef) constant);
-                } else if (constant instanceof CstEnumRef) {
-                    fieldIdsSection.intern(((CstEnumRef) constant).getFieldRef());
-                } else if (constant instanceof CstType) {
-                    typeIdsSection.intern((CstType) constant);
-                }
+        for (int i = 0; i < constantPoolSize; i++) {
+            Constant constant = constantPool.getOrNull(i);
+            if (constant instanceof CstMethodRef) {
+                methodIdsSection.intern((CstBaseMethodRef) constant);
+            } else if (constant instanceof CstInterfaceMethodRef) {
+                methodIdsSection.intern(((CstInterfaceMethodRef) constant).toMethodRef());
+            } else if (constant instanceof CstFieldRef) {
+                fieldIdsSection.intern((CstFieldRef) constant);
+            } else if (constant instanceof CstEnumRef) {
+                fieldIdsSection.intern(((CstEnumRef) constant).getFieldRef());
+            } else if (constant instanceof CstType) {
+                typeIdsSection.intern((CstType) constant);
             }
         }
 
@@ -197,9 +195,7 @@ public class CfTranslator {
                 if (annotations.size() != 0) {
                     out.addFieldAnnotations(field, annotations);
                 }
-                synchronized (fieldIdsSection) {
-                    fieldIdsSection.intern(field);
-                }
+                fieldIdsSection.intern(field);
             } catch (RuntimeException ex) {
                 String msg = "...while processing " + one.getName().toHuman() +
                     " " + one.getDescriptor().toHuman();
@@ -368,9 +364,7 @@ public class CfTranslator {
                 if (list.size() != 0) {
                     out.addParameterAnnotations(meth, list);
                 }
-                synchronized (methodIds) {
-                  methodIds.intern(meth);
-                }
+                methodIds.intern(meth);
             } catch (RuntimeException ex) {
                 String msg = "...while processing " + one.getName().toHuman() +
                     " " + one.getDescriptor().toHuman();
index 27d946d..f422bab 100644 (file)
@@ -20,6 +20,7 @@ import com.android.dx.rop.cst.Constant;
 import com.android.dx.rop.cst.CstFieldRef;
 import com.android.dx.util.AnnotatedOutput;
 import com.android.dx.util.Hex;
+
 import java.util.Collection;
 import java.util.TreeMap;
 
@@ -94,7 +95,7 @@ public final class FieldIdsSection extends MemberIdsSection {
      * @param field {@code non-null;} the reference to intern
      * @return {@code non-null;} the interned reference
      */
-    public FieldIdItem intern(CstFieldRef field) {
+    public synchronized FieldIdItem intern(CstFieldRef field) {
         if (field == null) {
             throw new NullPointerException("field == null");
         }
index d99198b..254d7fe 100644 (file)
@@ -20,6 +20,7 @@ import com.android.dx.rop.cst.Constant;
 import com.android.dx.rop.cst.CstBaseMethodRef;
 import com.android.dx.util.AnnotatedOutput;
 import com.android.dx.util.Hex;
+
 import java.util.Collection;
 import java.util.TreeMap;
 
@@ -94,7 +95,7 @@ public final class MethodIdsSection extends MemberIdsSection {
      * @param method {@code non-null;} the reference to intern
      * @return {@code non-null;} the interned reference
      */
-    public MethodIdItem intern(CstBaseMethodRef method) {
+    public synchronized MethodIdItem intern(CstBaseMethodRef method) {
         if (method == null) {
             throw new NullPointerException("method == null");
         }
index ef47262..d9ab274 100644 (file)
@@ -128,7 +128,7 @@ public final class TypeIdsSection extends UniformItemSection {
      * @param type {@code non-null;} the type to intern
      * @return {@code non-null;} the interned reference
      */
-    public TypeIdItem intern(CstType type) {
+    public synchronized TypeIdItem intern(CstType type) {
         if (type == null) {
             throw new NullPointerException("type == null");
         }
index 8080947..507c076 100644 (file)
@@ -28,6 +28,7 @@ import com.android.dex.ProtoId;
 import com.android.dex.SizeOf;
 import com.android.dex.TableOfContents;
 import com.android.dex.TypeList;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -1049,7 +1050,12 @@ public final class DexMerger {
                     + contents.methodIds.size * SizeOf.MEMBER_ID_ITEM
                     + contents.classDefs.size * SizeOf.CLASS_DEF_ITEM;
             mapList = SizeOf.UINT + (contents.sections.length * SizeOf.MAP_ITEM);
-            typeList += contents.typeLists.byteCount;
+            typeList += fourByteAlign(contents.typeLists.byteCount); // We count each dex's
+            // typelists section as realigned on 4 bytes, because each typelist of each dex's
+            // typelists section is aligned on 4 bytes. If we didn't, there is a case where each
+            // size of both dex's typelists section is a multiple of 2 but not a multiple of 4,
+            // and the sum of both sizes is a multiple of 4 but would not be sufficient to write
+            // each typelist aligned on 4 bytes.
             stringData += contents.stringDatas.byteCount;
             annotationsDirectory += contents.annotationsDirectories.byteCount;
             annotationsSet += contents.annotationSets.byteCount;
index 4425224..e643a5f 100644 (file)
@@ -130,7 +130,8 @@ tryArchive:
          * Pre-created .odex absent or stale.  Look inside the jar for a
          * "classes.dex".
          */
-        if ((entry = dexZipFindEntry(&archive, kDexInJarName)) != NULL) {
+        entry = dexZipFindEntry(&archive, kDexInJarName);
+        if (entry != NULL) {
             bool newFile = false;
 
             /*