Commit 03d63424 authored by simonmar's avatar simonmar
Browse files

[project @ 2005-04-27 09:48:34 by simonmar]

Remove uses of stderr from .cmm code.

We can't reliably refer to stdin/stdout/stderr from .cmm, because the
C standard doesn't specify whether stderr is a variable or a macro.
parent 8a1f6023
...@@ -41,7 +41,7 @@ INFO_TABLE_RET( stg_ap_0, ...@@ -41,7 +41,7 @@ INFO_TABLE_RET( stg_ap_0,
// fn is in R1, no args on the stack // fn is in R1, no args on the stack
IF_DEBUG(apply, IF_DEBUG(apply,
foreign "C" fprintf(W_[stderr] "ptr", stg_ap_0_ret_str); foreign "C" debugBelch(stg_ap_0_ret_str);
foreign "C" printClosure(R1 "ptr")); foreign "C" printClosure(R1 "ptr"));
IF_DEBUG(sanity, IF_DEBUG(sanity,
......
...@@ -330,7 +330,7 @@ raisezh_fast ...@@ -330,7 +330,7 @@ raisezh_fast
* the info was only displayed for an *uncaught* exception. * the info was only displayed for an *uncaught* exception.
*/ */
if (RtsFlags_ProfFlags_showCCSOnException(RtsFlags)) { if (RtsFlags_ProfFlags_showCCSOnException(RtsFlags)) {
foreign "C" fprintCCS(W_[stderr] "ptr",W_[CCCS] "ptr"); foreign "C" fprintCCS_stderr(W_[CCCS] "ptr");
} }
#endif #endif
......
...@@ -611,7 +611,7 @@ __stg_gc_fun ...@@ -611,7 +611,7 @@ __stg_gc_fun
Sp(2) = R1; Sp(2) = R1;
Sp(1) = size; Sp(1) = size;
Sp(0) = stg_gc_fun_info; Sp(0) = stg_gc_fun_info;
// DEBUG_ONLY(foreign "C" fprintf(stderr, "stg_fun_gc_gen(ARG_GEN)");); // DEBUG_ONLY(foreign "C" debugBelch("stg_fun_gc_gen(ARG_GEN)"););
GC_GENERIC GC_GENERIC
} else { } else {
jump W_[stg_stack_save_entries + WDS(type)]; jump W_[stg_stack_save_entries + WDS(type)];
......
...@@ -289,7 +289,7 @@ mkWeakzh_fast ...@@ -289,7 +289,7 @@ mkWeakzh_fast
StgWeak_link(w) = W_[weak_ptr_list]; StgWeak_link(w) = W_[weak_ptr_list];
W_[weak_ptr_list] = w; W_[weak_ptr_list] = w;
IF_DEBUG(weak, foreign "C" fprintf(W_[stderr] "ptr",stg_weak_msg,w)); IF_DEBUG(weak, foreign "C" debugBelch(stg_weak_msg,w));
RET_P(w); RET_P(w);
} }
......
...@@ -916,6 +916,13 @@ fprintCCS( FILE *f, CostCentreStack *ccs ) ...@@ -916,6 +916,13 @@ fprintCCS( FILE *f, CostCentreStack *ccs )
fprintf(f,">"); fprintf(f,">");
} }
/* For calling from .cmm code, where we can't reliably refer to stderr */
void
fprintCCS_stderr( CostCentreStack *ccs )
{
fprintCCS(stderr, ccs);
}
#ifdef DEBUG #ifdef DEBUG
void void
debugCCS( CostCentreStack *ccs ) debugCCS( CostCentreStack *ccs )
......
...@@ -27,6 +27,7 @@ void PrintNewStackDecls ( void ); ...@@ -27,6 +27,7 @@ void PrintNewStackDecls ( void );
extern lnat RTS_VAR(total_prof_ticks); extern lnat RTS_VAR(total_prof_ticks);
extern void fprintCCS( FILE *f, CostCentreStack *ccs ); extern void fprintCCS( FILE *f, CostCentreStack *ccs );
extern void fprintCCS_stderr( CostCentreStack *ccs );
#ifdef DEBUG #ifdef DEBUG
extern void debugCCS( CostCentreStack *ccs ); extern void debugCCS( CostCentreStack *ccs );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment