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:41:41 UTC

svn commit: r312646 - in /incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src: classfile.c classfile.h

Author: geirm
Date: Mon Oct 10 06:41:37 2005
New Revision: 312646

URL: http://svn.apache.org/viewcvs?rev=312646&view=rev
Log:
1) Switch to the packing pragma for classfile
   only (remove as compile option) 
2) remove the extraneous MACHINE_SWAP_XXXX macros
   as they followed the GETX macro, which already
   did the necessary swapping


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

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.c?rev=312646&r1=312645&r2=312646&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.c Mon Oct 10 06:41:37 2005
@@ -349,7 +349,7 @@
     u2 tmplenutf;
 
     /* Needed for CP_ITEM_SWAP_Ux() macros */
-#ifdef CONFIG_LITTLE_ENDIAN
+#ifdef ARCH_LITTLE_ENDIAN
     u2    *pcpu2;
     u4    *pcpu4;
 #endif
@@ -401,7 +401,6 @@
      * Perform little-endian byte swapping,
      * where appropriate (NOP otherwise)
      */
-    MACHINE_JINT_SWAP(pcfs->magic);
 
     sysDbgMsg(DMLNORM,
               "classfile_loadclassdata",
@@ -448,8 +447,6 @@
 
     pcfs->major_version = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->major_version);
-
     sysDbgMsg(DMLNORM,
               "classfile_loadclassdata",
               "major=%d",
@@ -484,8 +481,6 @@
     /*****************************************************************/
     pcfs->constant_pool_count = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->constant_pool_count);
-
     sysDbgMsg(DMLNORM,
               "classfile_loadclassdata",
               "cp count=%d",
@@ -542,12 +537,14 @@
          * Look up structure size, perform in-place byte swap
          * for little-endian architectures.
          */
+         
         switch (((cp_info *) pcpbytes)->tag)
         {
             case CONSTANT_Class:
+            
                 ALLOC_CP_INFO(CONSTANT_Class_info,
                               LOCAL_Class_binding);
-
+                                                           
                 CP_ITEM_SWAP_U2(CONSTANT_Class_info, name_index);
 
                 CPTYPEIDX_RANGE_CHECK(CONSTANT_Class_info,
@@ -884,8 +881,6 @@
     /*****************************************************************/
     pcfs->this_class = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->this_class);
-
     /*!
      * @todo Need to free constant_pool[0..n] also if failure
      */
@@ -901,8 +896,6 @@
     /*****************************************************************/
     pcfs->super_class = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->super_class);
-
     /* LOAD_SYSCALL_FAILURE(what needs checking here?,"access flags");*/
 
     cfmsgs_typemsg("super", pcfs, pcfs->super_class);
@@ -912,8 +905,7 @@
     /*****************************************************************/
     pcfs->interfaces_count = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->interfaces_count);
-
+ 
     sysDbgMsg(DMLNORM,
               "classfile_loadclassdata",
               "intfc count=%d",
@@ -999,8 +991,7 @@
     /*****************************************************************/
     pcfs->fields_count = GETRS2(pu2++);
 
-    MACHINE_JSHORT_SWAP(pcfs->fields_count);
-
+ 
     /* LOAD_SYSCALL_FAILURE(what needs checking here?,"fields_count");*/
 
     sysDbgMsg(DMLNORM,
@@ -1020,7 +1011,7 @@
         pcfs->fields = (field_info **) rnull;
     }
     else
-    {
+    {    	
         jvm_field_index fldidx;
 
         /*
@@ -1111,8 +1102,8 @@
                             pcfs,
                             &pcfs->fields[fldidx]->attributes[atridx],
                             (attribute_info *) pfbytes);
-
-                    LOAD_SYSCALL_FAILURE((rnull == pfbytes),
+     
+               LOAD_SYSCALL_FAILURE((rnull == pfbytes),
                                          "load field attribute",
                                          rnull,
                                          rnull);
@@ -1129,7 +1120,6 @@
 
     } /* if pcfs->fields */
 
-
     /*****************************************************************/
     /* Get method_count                                              */
     /*****************************************************************/
@@ -1138,7 +1128,8 @@
     MAKE_PU2(pu2, pfbytes);
 
     /*LOAD_SYSCALL_FAILURE(what needs checking here?,"methods count");*/
-    MACHINE_JSHORT_SWAP(pu2);
+ 
+ 
     pcfs->methods_count =  GETRS2(pu2++);
 
     sysDbgMsg(DMLNORM,
@@ -1229,7 +1220,6 @@
                     ->LOCAL_method_binding.nmordJVM =
                                      jvm_native_method_ordinal_null;
 
-
             /*
              * Map the indices in the class file to point to actual
              * constant pool enties via a pointer lookup table.
@@ -1338,7 +1328,7 @@
     MAKE_PU2(pu2, pmbytes);
 
     /*LOAD_SYSCALL_FAILURE(what needs checking here?,"methods count");*/
-    MACHINE_JSHORT_SWAP(pu2);
+   
     pcfs->attributes_count = GETRS2(pu2++);
 
     sysDbgMsg(DMLNORM,

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.h?rev=312646&r1=312645&r2=312646&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/bootjvm/bootJVM/jvm/src/classfile.h Mon Oct 10 06:41:37 2005
@@ -76,6 +76,13 @@
 
 ARCH_COPYRIGHT_APACHE(classfile, h, "$URL: https://svn.apache.org/path/name/classfile.h $ $Id: classfile.h 0 09/28/2005 dlydick $");
 
+/*
+ *  classfile code depends on packed structures.  Change from 
+ *  global project-wide -fpack-struct to local for the 
+ *  structures that need it
+ */
+
+#pragma pack(1)
 
 /*!
  * @brief Attributes of a field, method, or class.
@@ -2537,6 +2544,11 @@
 extern rvoid cfmsgs_atrmsg(rchar *fn,
                            ClassFile *pcfs,
                            attribute_info_dup *atr);
+
+/*
+ * restore packing
+ */
+#pragma pack()
 
 #endif /* _classfile_h_included_ */