Commits

Anonymous committed 88ffb4d

#69: Mainlining directly

  • Participants
  • Parent commits 43d7014

Comments (0)

Files changed (11)

File src/vm/frame.c

 {
     PmReturn_t retval = PM_RET_OK;
     int16_t fsize = 0;
-    int8_t stacksz = 0;
-    int8_t nlocals = 0;
+    int8_t stacksz = (int8_t)0;
+    int8_t nlocals = (int8_t)0;
     pPmCo_t pco = C_NULL;
     pPmFrame_t pframe = C_NULL;
     uint8_t *paddr = C_NULL;

File src/vm/img.c

             return retval;
         }
         /* get index of last obj in tuple */
-        n = mem_getByte(memspace, paddr) - 1;
+        n = mem_getByte(memspace, paddr) - (uint8_t)1;
         /* point to names tuple */
         *paddr = imgtop + CI_NAMES_FIELD;
         /* load name at index */

File src/vm/int.c

     C_ASSERT(bytesWritten != 0);
     C_ASSERT(bytesWritten < sizeof(tBuffer));
 
-    for (k = 0; k < bytesWritten; k++)
+    for (k = (uint8_t)0; k < bytesWritten; k++)
     {
         retval = plat_putByte(tBuffer[k]);
         PM_RETURN_IF_ERROR(retval);
     retval = plat_putByte(nibble);
     PM_RETURN_IF_ERROR(retval);
 
-    nibble = (b & 0x0F) + '0';
+    nibble = (b & (uint8_t)0x0F) + '0';
     if (nibble > '9')
-        nibble += ('a' - '0' - 10);
+        nibble += ('a' - '0' - (uint8_t)10);
     retval = plat_putByte(nibble);
     return retval;
 }
     PmReturn_t retval;
 
     /* Print the hex value, most significant byte first */
-    retval = int_printHexByte((n >> 24) & (uint8_t)0xFF);
+    retval = int_printHexByte((n >> (uint8_t)24) & (uint8_t)0xFF);
     PM_RETURN_IF_ERROR(retval);
-    retval = int_printHexByte((n >> 16) & (uint8_t)0xFF);
+    retval = int_printHexByte((n >> (uint8_t)16) & (uint8_t)0xFF);
     PM_RETURN_IF_ERROR(retval);
-    retval = int_printHexByte((n >> 8) & (uint8_t)0xFF);
+    retval = int_printHexByte((n >> (uint8_t)8) & (uint8_t)0xFF);
     PM_RETURN_IF_ERROR(retval);
     retval = int_printHexByte(n & (uint8_t)0xFF);
 

File src/vm/interp.c

             case PRINT_ITEM:
                 /* Print out topmost stack element */
                 pobj1 = PM_POP();
-                retval = obj_print(pobj1, 0);
+                retval = obj_print(pobj1, (uint8_t)0);
                 PM_BREAK_IF_ERROR(retval);
                 if (bc != PRINT_EXPR)
                 {
                     switch (t16)
                     {
                         /* *INDENT-OFF* */
-                        case COMP_LT: t8 = (a <  b); break;
-                        case COMP_LE: t8 = (a <= b); break;
-                        case COMP_EQ: t8 = (a == b); break;
-                        case COMP_NE: t8 = (a != b); break;
-                        case COMP_GT: t8 = (a >  b); break;
-                        case COMP_GE: t8 = (a >= b); break;
-                        case COMP_IS: t8 = (pobj1 == pobj2); break;
-                        case COMP_IS_NOT: t8 = (pobj1 != pobj2); break;
+                        case COMP_LT: t8 = (int8_t)(a <  b); break;
+                        case COMP_LE: t8 = (int8_t)(a <= b); break;
+                        case COMP_EQ: t8 = (int8_t)(a == b); break;
+                        case COMP_NE: t8 = (int8_t)(a != b); break;
+                        case COMP_GT: t8 = (int8_t)(a >  b); break;
+                        case COMP_GE: t8 = (int8_t)(a >= b); break;
+                        case COMP_IS: t8 = (int8_t)(pobj1 == pobj2); break;
+                        case COMP_IS_NOT: t8 = (int8_t)(pobj1 != pobj2); break;
                         case COMP_IN:
                         case COMP_NOT_IN:
                             PM_RAISE(retval, PM_RET_EX_TYPE);
                 /* keep ref to current frame */
                 ((pPmFrame_t)pobj3)->fo_back = FP;
                 /* handle to have None popped on return */
-                ((pPmFrame_t)pobj3)->fo_isImport = 1;
+                ((pPmFrame_t)pobj3)->fo_isImport = (uint8_t)1;
 
                 /* set new frame */
                 FP = (pPmFrame_t)pobj3;
     {
         if (++threadIndex >= gVmGlobal.threadList->length)
         {
-            threadIndex = 0;
+            threadIndex = (uint8_t)0;
         }
         retval = list_getItem((pPmObj_t)gVmGlobal.threadList,
                               threadIndex, (pPmObj_t *)&gVmGlobal.pthread);

File src/vm/list.c

 list_replicate(pPmObj_t psrclist, int16_t n, pPmObj_t *r_pnewlist)
 {
     PmReturn_t retval = PM_RET_OK;
-    int8_t i = 0;
-    int8_t j = 0;
-    int8_t length = 0;
+    int16_t i = 0;
+    int16_t j = 0;
+    int16_t length = 0;
     pPmObj_t pitem = C_NULL;
 
     C_ASSERT(psrclist != C_NULL);

File src/vm/mem.c

     uint8_t blo = mem_getByte(memspace, paddr);
     uint8_t bhi = mem_getByte(memspace, paddr);
 
-    return (uint16_t)(blo | (bhi << 8));
+    return (uint16_t)(blo | (bhi << (int8_t)8));
 }
 
 
     uint16_t wlo = mem_getWord(memspace, paddr);
     uint32_t whi = mem_getWord(memspace, paddr);
 
-    return (uint32_t)(wlo | (whi << 16));
+    return (uint32_t)(wlo | (whi << (int8_t)16));
 }
 
 
 {
     uint8_t *pbase = *psrc;
 
-    while (mem_getByte(memspace, psrc) != 0);
+    while (mem_getByte(memspace, psrc) != (uint8_t)0);
     return *psrc - pbase - 1;
 }
 
     if ((pm_timerMsTicks - pm_lastRescheduleTimestamp)
         >= PM_THREAD_TIMESLICE_MS)
     {
-        interp_setRescheduleFlag(1);
+        interp_setRescheduleFlag((uint8_t)1);
         pm_lastRescheduleTimestamp = pm_timerMsTicks;
     }
     return PM_RET_OK;
 #define C_TRUE          (!C_FALSE)
 
 /** Comparison result is that items are the same */
-#define C_SAME 0
+#define C_SAME (int8_t)0
 
 /** Comparison result is that items differ */
-#define C_DIFFER -1
+#define C_DIFFER (int8_t)-1
 
 /** PORT inline for C code */
 #define INLINE          __inline__

File src/vm/seglist.c

  * List and Dict data types.
  * The segmented list is used in preference to the linked list
  * in order to reduce the memory overhead.
- * 
+ *
  * Unused slots in the segments are expected to contain C_NULL.
  *
  * List implementation:
 
     /* Walk out to the starting segment */
     pseg = pseglist->sl_rootseg;
-    for (i = (*r_index / SEGLIST_OBJS_PER_SEG); i > 0; i--)
+    for (i = (*r_index / SEGLIST_OBJS_PER_SEG); i > (int8_t)0; i--)
     {
         C_ASSERT(pseg != C_NULL);
         pseg = pseg->next;
     pSegment_t pseg = C_NULL;
     pPmObj_t pobj1 = C_NULL;
     pPmObj_t pobj2 = C_NULL;
-    int8_t indx = 0;
+    int8_t indx = (int8_t)0;
     int16_t i = 0;
     uint8_t *pchunk;
 
         {
             pseg = pseg->next;
             C_ASSERT(pseg != C_NULL);
-            indx = 0;
+            indx = (int8_t)0;
         }
     }
     pseglist->sl_length++;

File src/vm/string.c

     uint8_t *pchunk;
 
     /* if not loading from image */
-    if (isimg == 0)
+    if (isimg == (uint8_t)0)
     {
         /* get length of string */
         len = mem_getNumUtf8Bytes(memspace, paddr);
         }
 
         /* If the marshalled char is not printable, print its hex escape code */
-        if (marshall && (ch < 32 || ch >= 128))
+        if (marshall && (ch < (uint8_t)32 || ch >= (uint8_t)128))
         {
             plat_putByte('\\');
             plat_putByte('x');
 
-            nibble = (ch >> 4) + '0';
+            nibble = (ch >> (uint8_t)4) + '0';
             if (nibble > '9')
-                nibble += ('a' - '0' - 10);
+                nibble += ('a' - '0' - (uint8_t)10);
             plat_putByte(nibble);
 
-            nibble = (ch & 0x0F) + '0';
+            nibble = (ch & (uint8_t)0x0F) + '0';
             if (nibble > '9')
-                nibble += ('a' - '0' - 10);
+                nibble += ('a' - '0' - (uint8_t)10);
             plat_putByte(nibble);
         }
         else

File src/vm/tuple.c

 tuple_loadFromImg(PmMemSpace_t memspace, uint8_t **paddr, pPmObj_t *r_ptuple)
 {
     PmReturn_t retval = PM_RET_OK;
-    uint8_t i = 0;
-    uint8_t n = 0;
+    uint8_t i = (uint8_t)0;
+    uint8_t n = (uint8_t)0;
 
     /* get num objs in tuple */
     n = mem_getByte(memspace, paddr);
     PM_RETURN_IF_ERROR(retval);
 
     /* load the next n objs into tuple */
-    for (i = 0; i < n; i++)
+    for (i = (uint8_t)0; i < n; i++)
     {
         retval = obj_loadFromImg(memspace,
                                  paddr,