summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2018-06-17 12:50:18 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-17 12:50:25 -0400
commit008ea12dd93b9f9104f0b532b278a31b719bafb8 (patch)
tree1143a67d47f70071e1c22e90187279db9e8b56fc
parentb8e349922b4841771a59e264183219e6cad3e942 (diff)
downloadhaskell-008ea12dd93b9f9104f0b532b278a31b719bafb8.tar.gz
Use __FILE__ for Cmm assertion locations, fix #8619
It seems like we currently support string literals in Cmm, so we can use __LINE__ CPP macro in assertion macros. This improves error messages that previously looked like ASSERTION FAILED: file (null), line 1302 (null) part now shows the actual file name. Also inline some single-use string literals in PrimOps.cmm. Reviewers: bgamari, simonmar, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4862
-rw-r--r--compiler/cmm/CmmParse.y2
-rw-r--r--includes/Cmm.h2
-rw-r--r--rts/PrimOps.cmm21
3 files changed, 7 insertions, 18 deletions
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 2113f20a0f..4d7e288381 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -402,8 +402,6 @@ statics :: { [CmmParse [CmmStatic]] }
: {- empty -} { [] }
| static statics { $1 : $2 }
--- Strings aren't used much in the RTS HC code, so it doesn't seem
--- worth allowing inline strings. C-- doesn't allow them anyway.
static :: { CmmParse [CmmStatic] }
: type expr ';' { do e <- $2;
return [CmmStaticLit (getLit e)] }
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 1306a2222d..059220a813 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -211,7 +211,7 @@
if (predicate) { \
/*null*/; \
} else { \
- foreign "C" _assertFail(NULL, __LINE__) never returns; \
+ foreign "C" _assertFail(__FILE__, __LINE__) never returns; \
}
#else
#define ASSERT(p) /* nothing */
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 6986d9b527..6081fabe93 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -646,8 +646,6 @@ stg_atomicModifyMutVarzh ( gcptr mv, gcptr f )
Weak Pointer Primitives
-------------------------------------------------------------------------- */
-STRING(stg_weak_msg,"New weak pointer at %p\n")
-
stg_mkWeakzh ( gcptr key,
gcptr value,
gcptr finalizer /* or stg_NO_FINALIZER_closure */ )
@@ -670,7 +668,7 @@ stg_mkWeakzh ( gcptr key,
Capability_weak_ptr_list_tl(MyCapability()) = w;
}
- IF_DEBUG(weak, ccall debugBelch(stg_weak_msg,w));
+ IF_DEBUG(weak, ccall debugBelch("New weak pointer at %p\n",w));
return (w);
}
@@ -680,8 +678,6 @@ stg_mkWeakNoFinalizzerzh ( gcptr key, gcptr value )
jump stg_mkWeakzh (key, value, stg_NO_FINALIZER_closure);
}
-STRING(stg_cfinalizer_msg,"Adding a finalizer to %p\n")
-
stg_addCFinalizzerToWeakzh ( W_ fptr, // finalizer
W_ ptr,
W_ flag, // has environment (0 or 1)
@@ -715,7 +711,7 @@ stg_addCFinalizzerToWeakzh ( W_ fptr, // finalizer
recordMutable(w);
- IF_DEBUG(weak, ccall debugBelch(stg_cfinalizer_msg,w));
+ IF_DEBUG(weak, ccall debugBelch("Adding a finalizer to %p\n",w));
return (1);
}
@@ -2037,8 +2033,6 @@ stg_waitWritezh ( W_ fd )
#endif
}
-
-STRING(stg_delayzh_malloc_str, "stg_delayzh")
stg_delayzh ( W_ us_delay )
{
#if defined(mingw32_HOST_OS)
@@ -2059,7 +2053,7 @@ stg_delayzh ( W_ us_delay )
/* could probably allocate this on the heap instead */
("ptr" ares) = ccall stgMallocBytes(SIZEOF_StgAsyncIOResult,
- stg_delayzh_malloc_str);
+ "stg_delayzh");
(reqID) = ccall addDelayRequest(us_delay);
StgAsyncIOResult_reqID(ares) = reqID;
StgAsyncIOResult_len(ares) = 0;
@@ -2104,7 +2098,6 @@ while:
#if defined(mingw32_HOST_OS)
-STRING(stg_asyncReadzh_malloc_str, "stg_asyncReadzh")
stg_asyncReadzh ( W_ fd, W_ is_sock, W_ len, W_ buf )
{
W_ ares;
@@ -2119,7 +2112,7 @@ stg_asyncReadzh ( W_ fd, W_ is_sock, W_ len, W_ buf )
/* could probably allocate this on the heap instead */
("ptr" ares) = ccall stgMallocBytes(SIZEOF_StgAsyncIOResult,
- stg_asyncReadzh_malloc_str);
+ "stg_asyncReadzh");
(reqID) = ccall addIORequest(fd, 0/*FALSE*/,is_sock,len,buf "ptr");
StgAsyncIOResult_reqID(ares) = reqID;
StgAsyncIOResult_len(ares) = 0;
@@ -2130,7 +2123,6 @@ stg_asyncReadzh ( W_ fd, W_ is_sock, W_ len, W_ buf )
#endif
}
-STRING(stg_asyncWritezh_malloc_str, "stg_asyncWritezh")
stg_asyncWritezh ( W_ fd, W_ is_sock, W_ len, W_ buf )
{
W_ ares;
@@ -2144,7 +2136,7 @@ stg_asyncWritezh ( W_ fd, W_ is_sock, W_ len, W_ buf )
StgTSO_why_blocked(CurrentTSO) = BlockedOnWrite::I16;
("ptr" ares) = ccall stgMallocBytes(SIZEOF_StgAsyncIOResult,
- stg_asyncWritezh_malloc_str);
+ "stg_asyncWritezh");
(reqID) = ccall addIORequest(fd, 1/*TRUE*/,is_sock,len,buf "ptr");
StgAsyncIOResult_reqID(ares) = reqID;
@@ -2156,7 +2148,6 @@ stg_asyncWritezh ( W_ fd, W_ is_sock, W_ len, W_ buf )
#endif
}
-STRING(stg_asyncDoProczh_malloc_str, "stg_asyncDoProczh")
stg_asyncDoProczh ( W_ proc, W_ param )
{
W_ ares;
@@ -2171,7 +2162,7 @@ stg_asyncDoProczh ( W_ proc, W_ param )
/* could probably allocate this on the heap instead */
("ptr" ares) = ccall stgMallocBytes(SIZEOF_StgAsyncIOResult,
- stg_asyncDoProczh_malloc_str);
+ "stg_asyncDoProczh");
(reqID) = ccall addDoProcRequest(proc "ptr",param "ptr");
StgAsyncIOResult_reqID(ares) = reqID;
StgAsyncIOResult_len(ares) = 0;