harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r673325 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
Date Wed, 02 Jul 2008 09:08:52 GMT
Author: sjanuary
Date: Wed Jul  2 02:08:52 2008
New Revision: 673325

URL: http://svn.apache.org/viewvc?rev=673325&view=rev
Log:
Apply patch for HARMONY-5889 ([classlib][pack200] Some bytecodes can be cached)

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java?rev=673325&r1=673324&r2=673325&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java
Wed Jul  2 02:08:52 2008
@@ -28,9 +28,18 @@
 public class ByteCode extends ClassFileEntry {
 
     public static ByteCode getByteCode(int opcode) {
-        return new ByteCode(0xFF & opcode);
+        int byteOpcode = 0xFF & opcode;
+        if(ByteCodeForm.get(byteOpcode).hasNoOperand()) {
+            if(null == noArgByteCodes[byteOpcode]) {
+                noArgByteCodes[byteOpcode] = new ByteCode(byteOpcode);
+            }
+            return noArgByteCodes[byteOpcode];
+        }
+        return new ByteCode(byteOpcode);
     }
 
+    private static ByteCode[] noArgByteCodes = new ByteCode[255];
+
     private final ByteCodeForm byteCodeForm;
 
     private ClassFileEntry[] nested;



Mime
View raw message