Opened 12 years ago

Closed 8 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)

0001-Include-debug-info-on-core-direct_call-nodes.patch (1.2 KB) - added by evhan 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by sjamaan

Milestone: 4.12.0

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

comment:2 Changed 8 years ago by sjamaan

Estimated difficulty: easy

comment:3 Changed 8 years ago by sjamaan

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 in reply to:  3 Changed 8 years ago by felix winkelmann

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 Changed 8 years ago by sjamaan

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.

comment:6 Changed 8 years ago by evhan

Resolution: fixed
Status: newclosed

Fixed by 1ad3512a and 06577311.

Note: See TracTickets for help on using tickets.