@@ -145,9 +145,6 @@ extern "C" void sysMonitorTimedWait(Word, long long);
145
145
extern "C" void sysMonitorWait (Word );
146
146
extern "C" void sysMonitorBroadcast (Word );
147
147
148
- static void * checkMalloc (int );
149
- static void checkFree (void * );
150
-
151
148
// #define DEBUG_SYS
152
149
// #define DEBUG_THREAD
153
150
@@ -1029,7 +1026,7 @@ sysThreadCreate(Address tr, Address ip, Address fp)
1029
1026
1030
1027
// create arguments
1031
1028
//
1032
- sysThreadArguments = ( Address * ) checkMalloc ( sizeof ( Address ) * 3 ) ;
1029
+ sysThreadArguments = new Address [ 3 ] ;
1033
1030
sysThreadArguments [0 ] = tr ;
1034
1031
sysThreadArguments [1 ] = ip ;
1035
1032
sysThreadArguments [2 ] = fp ;
@@ -1137,7 +1134,7 @@ sysThreadStartup(void *args)
1137
1134
char * stackBuf ;
1138
1135
1139
1136
memset (& stack , 0 , sizeof stack );
1140
- stack .ss_sp = stackBuf = ( char * ) checkMalloc ( sizeof ( char ) * SIGSTKSZ ) ;
1137
+ stack .ss_sp = stackBuf = new char [ SIGSTKSZ ] ;
1141
1138
stack .ss_flags = 0 ;
1142
1139
stack .ss_size = SIGSTKSZ ;
1143
1140
if (sigaltstack (& stack , 0 )) {
@@ -1147,18 +1144,18 @@ sysThreadStartup(void *args)
1147
1144
1148
1145
Address tr = ((Address * )args )[0 ];
1149
1146
1150
- jmp_buf * jb = (jmp_buf * )checkMalloc (sizeof (jmp_buf ));
1147
+ jmp_buf * jb = (jmp_buf * )malloc (sizeof (jmp_buf ));
1151
1148
if (setjmp (* jb )) {
1152
1149
// this is where we come to terminate the thread
1153
1150
#ifdef RVM_FOR_HARMONY
1154
1151
hythread_detach (NULL );
1155
1152
#endif
1156
- checkFree (jb );
1153
+ free (jb );
1157
1154
* (int * )(tr + RVMThread_execStatus_offset ) = RVMThread_TERMINATED ;
1158
1155
1159
1156
stack .ss_flags = SS_DISABLE ;
1160
1157
sigaltstack (& stack , 0 );
1161
- checkFree ( stackBuf ) ;
1158
+ delete [] stackBuf ;
1162
1159
} else {
1163
1160
setThreadLocal (TerminateJmpBufKey , (void * )jb );
1164
1161
@@ -1245,7 +1242,7 @@ sysSetupHardwareTrapHandler()
1245
1242
stack_t stack ;
1246
1243
1247
1244
memset (& stack , 0 , sizeof stack );
1248
- stack .ss_sp = ( char * ) checkMalloc ( sizeof ( char ) * SIGSTKSZ ) ;
1245
+ stack .ss_sp = new char [ SIGSTKSZ ] ;
1249
1246
1250
1247
stack .ss_size = SIGSTKSZ ;
1251
1248
if (sigaltstack (& stack , 0 )) {
@@ -1420,7 +1417,7 @@ sysMonitorCreate()
1420
1417
hythread_monitor_t monitor ;
1421
1418
hythread_monitor_init_with_name (& monitor , 0 , NULL );
1422
1419
#else
1423
- vmmonitor_t * monitor = ( vmmonitor_t * ) checkMalloc ( sizeof ( vmmonitor_t )) ;
1420
+ vmmonitor_t * monitor = new vmmonitor_t ;
1424
1421
pthread_mutex_init (& monitor -> mutex , NULL );
1425
1422
pthread_cond_init (& monitor -> cond , NULL );
1426
1423
#endif
@@ -1436,7 +1433,7 @@ sysMonitorDestroy(Word _monitor)
1436
1433
vmmonitor_t * monitor = (vmmonitor_t * )_monitor ;
1437
1434
pthread_mutex_destroy (& monitor -> mutex );
1438
1435
pthread_cond_destroy (& monitor -> cond );
1439
- checkFree ( monitor ) ;
1436
+ delete monitor ;
1440
1437
#endif
1441
1438
}
1442
1439
@@ -1735,8 +1732,10 @@ sysMemmove(void *dst, const void *src, Extent cnt)
1735
1732
1736
1733
int inRVMAddressSpace (Address a );
1737
1734
1738
- static void *
1739
- checkMalloc (int length )
1735
+ // Allocate memory.
1736
+ //
1737
+ extern "C" void *
1738
+ sysMalloc (int length )
1740
1739
{
1741
1740
void * result = malloc (length );
1742
1741
if (inRVMAddressSpace ((Address )result )) {
@@ -1745,20 +1744,6 @@ checkMalloc(int length)
1745
1744
return result ;
1746
1745
}
1747
1746
1748
- static void
1749
- checkFree (void * mem )
1750
- {
1751
- free (mem );
1752
- }
1753
-
1754
- // Allocate memory.
1755
- //
1756
- extern "C" void *
1757
- sysMalloc (int length )
1758
- {
1759
- return checkMalloc (length );
1760
- }
1761
-
1762
1747
extern "C" void *
1763
1748
sysCalloc (int length )
1764
1749
{
@@ -1770,7 +1755,7 @@ sysCalloc(int length)
1770
1755
extern "C" void
1771
1756
sysFree (void * location )
1772
1757
{
1773
- checkFree (location );
1758
+ free (location );
1774
1759
}
1775
1760
1776
1761
// Zero a range of memory with non-temporal instructions on x86
0 commit comments