[project @ 2004-09-12 12:12:18 by panne]
authorpanne <unknown>
Sun, 12 Sep 2004 12:12:19 +0000 (12:12 +0000)
committerpanne <unknown>
Sun, 12 Sep 2004 12:12:19 +0000 (12:12 +0000)
Warning police. Why is x86_init_fpu disabled, BTW?

ghc/rts/MBlock.c
ghc/rts/Profiling.c
ghc/rts/RtsStartup.c
ghc/rts/Schedule.c

index ff4467f..60aa97b 100644 (file)
@@ -119,7 +119,7 @@ my_mmap (void *addr, lnat size)
        err = vm_allocate(mach_task_self(),(vm_address_t*) &ret, size, TRUE);
        
     if(err) // don't know what the error codes mean exactly
-       barf("memory allocation failed (requested %d bytes)", size);
+       barf("memory allocation failed (requested %lu bytes)", size);
     else
        vm_protect(mach_task_self(),ret,size,FALSE,VM_PROT_READ|VM_PROT_WRITE);
 #else
@@ -132,7 +132,7 @@ my_mmap (void *addr, lnat size)
            (errno == EINVAL && sizeof(void*)==4 && size >= 0xc0000000)) {
            // If we request more than 3Gig, then we get EINVAL
            // instead of ENOMEM (at least on Linux).
-           errorBelch("out of memory (requested %d bytes)", size);
+           errorBelch("out of memory (requested %lu bytes)", size);
            stg_exit(EXIT_FAILURE);
        } else {
            barf("getMBlock: mmap: %s", strerror(errno));
index 1746c53..bec04fe 100644 (file)
@@ -663,7 +663,7 @@ report_per_cc_costs( void )
          );
       
       if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
-         fprintf(prof_file, "  %5lu %9llu", cc->time_ticks, cc->mem_alloc);
+       fprintf(prof_file, "  %5llu %9llu", (StgWord64)(cc->time_ticks), cc->mem_alloc);
       }
       fprintf(prof_file, "\n");
   }
@@ -777,7 +777,7 @@ reportCCS(CostCentreStack *ccs, nat indent)
            );
 
     if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
-      fprintf(prof_file, "  %5lu %9llu", ccs->time_ticks, ccs->mem_alloc*sizeof(W_));
+      fprintf(prof_file, "  %5llu %9llu", (StgWord64)(ccs->time_ticks), ccs->mem_alloc*sizeof(W_));
 #if defined(PROFILING_DETAIL_COUNTS)
       fprintf(prof_file, "  %8ld %8ld %8ld %8ld %8ld %8ld %8ld",
              ccs->mem_allocs, ccs->thunk_count,
@@ -893,8 +893,8 @@ reportCCS_XML(CostCentreStack *ccs)
 
   cc = ccs->cc;
   
-  fprintf(prof_file, " 1 %d %llu %lu %llu", 
-         ccs->ccsID, ccs->scc_count, ccs->time_ticks, ccs->mem_alloc);
+  fprintf(prof_file, " 1 %d %llu %llu %llu", 
+         ccs->ccsID, ccs->scc_count, (StgWord64)(ccs->time_ticks), ccs->mem_alloc);
 
   for (i = ccs->indexTable; i != 0; i = i->next) {
     if (!i->back_edge) {
index a806763..d605328 100644 (file)
@@ -88,8 +88,31 @@ __hscore_set_saved_termios(int fd, void* ts)
   }
 }
 
-#if i386_TARGET_ARCH
-static void x86_init_fpu ( void );
+/* -----------------------------------------------------------------------------
+   Initialise floating point unit on x86 (currently disabled. why?)
+   -------------------------------------------------------------------------- */
+
+#define X86_INIT_FPU 0
+
+#if X86_INIT_FPU
+static void
+x86_init_fpu ( void )
+{
+  __volatile unsigned short int fpu_cw;
+
+  // Grab the control word
+  __asm __volatile ("fnstcw %0" : "=m" (fpu_cw));
+
+#if 0
+  printf("fpu_cw: %x\n", fpu_cw);
+#endif
+
+  // Set bits 8-9 to 10 (64-bit precision).
+  fpu_cw = (fpu_cw & 0xfcff) | 0x0200;
+
+  // Store the new control word back
+  __asm __volatile ("fldcw %0" : : "m" (fpu_cw));
+}
 #endif
 
 /* -----------------------------------------------------------------------------
@@ -204,8 +227,8 @@ hs_init(int *argc, char **argv[])
     setlocale(LC_CTYPE,"");
 #endif
 
-#if i386_TARGET_ARCH
-//    x86_init_fpu();
+#if X86_INIT_FPU
+    x86_init_fpu();
 #endif
 
     /* Record initialization times */
@@ -465,29 +488,3 @@ stg_exit(int n)
 #endif
   exit(n);
 }
-
-/* -----------------------------------------------------------------------------
-   Initialise floating point unit on x86
-   -------------------------------------------------------------------------- */
-
-#if i386_TARGET_ARCH
-static void
-x86_init_fpu ( void )
-{
-  __volatile unsigned short int fpu_cw;
-
-  // Grab the control word
-  __asm __volatile ("fnstcw %0" : "=m" (fpu_cw));
-
-#if 0
-  printf("fpu_cw: %x\n", fpu_cw);
-#endif
-
-  // Set bits 8-9 to 10 (64-bit precision).
-  fpu_cw = (fpu_cw & 0xfcff) | 0x0200;
-
-  // Store the new control word back
-  __asm __volatile ("fldcw %0" : : "m" (fpu_cw));
-}
-#endif
-
index 9e2a5d0..c845c3d 100644 (file)
@@ -216,7 +216,9 @@ void            addToBlockedQueue ( StgTSO *tso );
 static void     schedule          ( StgMainThread *mainThread, Capability *initialCapability );
        void     interruptStgRts   ( void );
 
+#if !defined(PAR) && !defined(RTS_SUPPORTS_THREADS)
 static void     detectBlackHoles  ( void );
+#endif
 
 #if defined(RTS_SUPPORTS_THREADS)
 /* ToDo: carefully document the invariants that go together
@@ -3286,6 +3288,7 @@ resurrectThreads( StgTSO *threads )
  * Locks: sched_mutex is held upon entry and exit.
  * -------------------------------------------------------------------------- */
 
+#if !defined(PAR) && !defined(RTS_SUPPORTS_THREADS)
 static void
 detectBlackHoles( void )
 {
@@ -3336,6 +3339,7 @@ detectBlackHoles( void )
        done: ;
     }
 }
+#endif
 
 /* ----------------------------------------------------------------------------
  * Debugging: why is a thread blocked