changeset 323:6ffb6a00cf55

- cosmetics and comments cleanup for readability
author Tassilo Philipp
date Sat, 16 Nov 2019 00:15:58 +0100
parents a1fcb3e02270
children dd78bd0152af
files dyncall/dyncall_callvm_mips_o32.c dyncall/dyncall_vector.c
diffstat 2 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/dyncall/dyncall_callvm_mips_o32.c	Sat Nov 16 00:12:32 2019 +0100
+++ b/dyncall/dyncall_callvm_mips_o32.c	Sat Nov 16 00:15:58 2019 +0100
@@ -172,11 +172,9 @@
 void dc_callvm_call_mips_o32(DCCallVM* in_self, DCpointer target)
 {
   DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
-  /* at minimum provide 16-bytes
-     which hold the first four integer register as spill area 
-     and are automatically loaded to $4-$7
-   */
 
+  /* provide multiple of 8 (reflecting stack area alignment requirement), and
+     minimum of 16-bytes (to hold first 4 int regis as spill area ($4-$7)) */
   size_t size = DC_MAX(16, ( ( (unsigned) dcVecSize(&self->mVecHead) ) +7UL ) & (-8UL) );
 
   dcCall_mips_o32(target, &self->mRegData, size, dcVecData(&self->mVecHead));
--- a/dyncall/dyncall_vector.c	Sat Nov 16 00:12:32 2019 +0100
+++ b/dyncall/dyncall_vector.c	Sat Nov 16 00:15:58 2019 +0100
@@ -34,18 +34,19 @@
   size_t newSize = pHead->mSize + size;
   if(newSize <= pHead->mTotal) 
   {
-  	void* dst = (DCchar*)dcVecData(pHead) + pHead->mSize;
-  	switch (size) {
-  	  case 1: *(DCchar    *)dst = *(const DCchar    *)pData; break;
-  	  case 2: *(DCshort   *)dst = *(const DCshort   *)pData; break;
-  	  case 4: *(DCint     *)dst = *(const DCint     *)pData; break;
-  	  case 8: *(DCint     *)( ( (char*)dst )+4) = *(const DCint     *)( ( (char*)pData )+4); 
-  	          *(DCint     *)dst = *(const DCint     *)pData; break;
- 	  /* On sparc 32-bit, this one crashes if ptrs are not aligned.
-          case 8: *(DClonglong*)dst = *(const DClonglong*)pData; break;
-  	  */
-          default: memcpy(dst, pData, size); /* for all the rest. */
-  	}
+    void* dst = (DCchar*)dcVecData(pHead) + pHead->mSize;
+    switch (size) {
+      case 1: *(DCchar    *)dst = *(const DCchar    *)pData; break;
+      case 2: *(DCshort   *)dst = *(const DCshort   *)pData; break;
+      case 4: *(DCint     *)dst = *(const DCint     *)pData; break;
+      case 8: *(DCint     *)( ( (char*)dst )+4) = *(const DCint     *)( ( (char*)pData )+4); 
+              *(DCint     *)dst = *(const DCint     *)pData; break;
+      /* On sparc 32-bit, this one crashes if ptrs are not aligned, so use above.
+      case 8: *(DClonglong*)dst = *(const DClonglong*)pData; break;
+      */
+
+      default: memcpy(dst, pData, size); /* for all the rest. */
+    }
     pHead->mSize = newSize;
   }
   /*else @@@ warning? error?*/