Summary

##core#direct_call nodes should get debug-info

Metadata

Attachments

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.

Changes and comments

[2014-09-27 23:26:20 UTC] evhan attached 0001-Include-debug-info-on-core-direct_call-nodes.patch (description=#f)

[2016-02-20 13:03:46 UTC] sjamaan set milestone to 4.12.0

[2016-02-20 13:03:46 UTC] sjamaan wrote:

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

[2016-08-25 21:03:23 UTC] sjamaan set difficulty to easy

[2016-12-18 14:19:10 UTC] sjamaan wrote:

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.

[2016-12-18 15:08:18 UTC] felix wrote:

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.

[2016-12-18 19:50:41 UTC] sjamaan wrote:

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.

[2016-12-19 05:54:34 UTC] evhan wrote:

Fixed by 1ad3512a and 06577311.

[2016-12-19 05:54:34 UTC] evhan changed status from new to closed

[2016-12-19 05:54:34 UTC] evhan set resolution to fixed