Opened 13 years ago
Closed 9 years ago
#894 closed defect (fixed)
##core#direct_call nodes should get debug-info
| Reported by: | felix winkelmann | Owned by: | felix winkelmann |
|---|---|---|---|
| Priority: | minor | Milestone: | 4.12.0 |
| Component: | compiler | Version: | 4.7.x |
| Keywords: | Cc: | ||
| Estimated difficulty: | easy |
Description
Transformation of ##core#direct_call nodes never receive any debug-info. It should be possible to obtain at least some information for many calls, and could also emit C_trace operations to make direct-calls appear in backtraces.
Attachments (1)
Change History (7)
by , 11 years ago
| Attachment: | 0001-Include-debug-info-on-core-direct_call-nodes.patch added |
|---|
comment:1 by , 10 years ago
| Milestone: | → 4.12.0 |
|---|
comment:2 by , 9 years ago
| Estimated difficulty: | → easy |
|---|
follow-up: 4 comment:3 by , 9 years ago
What is the reason this patch has been sitting in this ticket for 2 years without being applied?
I'd apply it, but I have no clue how to test whether this does what it should do.
comment:4 by , 9 years ago
Replying to sjamaan:
What is the reason this patch has been sitting in this ticket for 2 years without being applied?
Ignorance, Sir, pure ignorance.
I'd apply it, but I have no clue how to test whether this does what it should do.
A direct call should result when a non-allocating, not externally visible function is invoked. You can use "-debug 7" to check whether such a call is generated. Note that such calls are often inlined, so it may be not totally trivial to produce such a case.
comment:5 by , 9 years ago
Wow, that was quite tricky indeed! Here's an example program that you can use to test:
(define modulo-two #f)
(define quotient-of-two #f)
(define seen #f)
(let* ((seen-zeroes #f)
(ensure-nonzero (lambda (value)
(when (eq? value 0)
(set! seen-zeroes #t))
value)))
(set! modulo-two (lambda (x)
(ensure-nonzero x)
(modulo x 2)))
(set! quotient-of-two (lambda (x)
(ensure-nonzero x)
(quotient x 2)))
(set! seen? (lambda () seen-zeroes)))
If I compile this with -O3 -d3, I get the direct_call nodes to ensure-nonzero.

Since there's a patch already, might be worth adding to chicken 4.12