You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2005/10/10 15:48:23 UTC

svn commit: r312652 - /incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c

Author: geirm
Date: Mon Oct 10 06:48:20 2005
New Revision: 312652

URL: http://svn.apache.org/viewcvs?rev=312652&view=rev
Log:
For a local code attribute, we need to swap the 
constant pool index.

Also, remove extra swaps....


Modified:
    incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c?rev=312652&r1=312651&r2=312652&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/cfattrib.c Mon Oct 10 06:48:20 2005
@@ -313,12 +313,10 @@
     tmpatr.attribute_name_index = GETRS2(&src->attribute_name_index);
     tmpatr.attribute_length     = GETRI4(&src->attribute_length);
 
-    MACHINE_JSHORT_SWAP(tmpatr.attribute_name_index);
-    MACHINE_JINT_SWAP(tmpatr.attribute_length);
-
     cfmsgs_typemsg("cfattrib_loadattribute",
                    pcfs,
                    tmpatr.attribute_name_index);
+
     sysDbgMsg(DMLNORM,
               "cfattrib_loadattribute",
               "len=%d",
@@ -376,7 +374,7 @@
 
     classfile_attribute_enum atrenum =
         cfattrib_atr2enum(pcfs, (*dst)->ai.attribute_name_index);
-
+        
     if (LOCAL_CODE_ATTRIBUTE == atrenum)
     {
         /*
@@ -390,6 +388,7 @@
          *        byte-stream class file, which has no guaranteed
          *        word alignment.
          */
+         
         PTR_DST_AI(dst)->max_stack =
             GETRS2(&((Code_attribute *) src)->max_stack);
 
@@ -399,11 +398,7 @@
         PTR_DST_AI(dst)->code_length =
             GETRI4(&((Code_attribute *) src)->code_length);
 
-        MACHINE_JSHORT_SWAP(*PTR_DST_AI(dst)->max_stack);
-        MACHINE_JSHORT_SWAP(*PTR_DST_AI(dst)->max_locals);
-        MACHINE_JINT_SWAP(*PTR_DST_AI(dst)->code_length);
-
-        if (0 == PTR_DST_AI(dst)->code_length)
+	        if (0 == PTR_DST_AI(dst)->code_length)
         {
             /*
              * Possible, but not theoretically reasonable,
@@ -517,8 +512,26 @@
         }
 
     } /* if LOCAL_CODE_ATTRIBUTE */
+    else if (LOCAL_CONSTANTVALUE_ATTRIBUTE == atrenum) 
+    {
+        if (0 != tmpatr.attribute_length)
+        {
+            memcpy(&(*dst)->ai.info,
+                   &src->info,
+                   tmpatr.attribute_length);
+        }
+
+		/*
+		 *  we need to swap the index for the value
+		 */
+        ((ConstantValue_attribute *) &(*dst)->ai)->constantvalue_index =
+        	GETRS2(&((ConstantValue_attribute *) &(*dst)->ai)->constantvalue_index);
+        	
+    } /* if LOCAL_CONSTANT_ATTRIBUTE */
     else
     {
+    	/* $$$ GMJ: I don't agree... things need to be byteswapped for indices and such
+    	 */
         /*
          * See comments at top of @c @b if statment as to why
          * all other structures can be directly copied into the heap