Opened 15 years ago

Closed 15 years ago

#89 closed defect (fixed)

compiler stack inconsistency

Reported by: Mark Evenson Owned by: ehuelsmann
Priority: critical Milestone: 0.21
Component: compiler Version: 0.20
Keywords: Cc:
Parent Tickets:

Description

In checking out the latest ASDF, I was able to factor out the following case of the compiler generating stack inconsistency:

(defun get-uid (stream uid-string)
    (with-input-from-string (stream uid-string)
      (read-line stream)
      (handler-case (parse-integer (read-line stream))
        (error () (error "Unable to find out user ID")))))

Loading the generated code causes a java.lang.VerifyError? to be thrown.

Attachments (3)

abcl-ticket-89.patch (1.2 KB) - added by Mark Evenson 15 years ago.
Fix stack inconsistency in P2-BLOCK-NODE
abcl-compiler-analysis-proposal.svg (7.9 KB) - added by Mark Evenson 15 years ago.
proposed visualization
g.svg (52.2 KB) - added by ehuelsmann 15 years ago.
The graph that I used to find the problem and fix it

Download all attachments as: .zip

Change History (11)

comment:1 Changed 15 years ago by Mark Evenson

Simplified test case (which only produces one stack inconsistency message):

(defun get-uid ()
  (let ((stream (make-string-input-stream "foo" 0)))
    (read-line stream)
    (handler-case 42)))

comment:2 Changed 15 years ago by Mark Evenson

Without a HANDLER-CASE:

(defun f ()
  (let ((stream (make-string-input-stream "f" 0)))
    (read-line stream)
    (lambda () 
      (return-from f))))

comment:3 Changed 15 years ago by Mark Evenson

Attaching a patch which fixes the last two test cases, but not the original.

I suspect that this error was introduced in r12170, which means that P2-TAGBODY-NODE needs the same sort of fix.

Changed 15 years ago by Mark Evenson

Attachment: abcl-ticket-89.patch added

Fix stack inconsistency in P2-BLOCK-NODE

comment:4 Changed 15 years ago by Mark Evenson

Milestone: 0.20

That patch doesn't do as much as I had hoped, as the analysis of the problem here is still rather incomplete.

Erik has suggested that due to the heavy use of specials in P2, it is rather hard to follow any sufficiently complicated example as the information as to which code sections corresponds to which handler quickly get lost.

comment:5 Changed 15 years ago by Mark Evenson

r12620 patches the system to use the interpreted form if a stack inconsistency is detected.

comment:6 Changed 15 years ago by ehuelsmann

Milestone: 0.200.21
Priority: majorcritical

Alessio tested this on 0.18.1 and there's no regression here, so, while I do find this a critical prio issue (and raising to that level); I don't see a blocker - not a regression.

Increasing milestone to 0.21.

Changed 15 years ago by Mark Evenson

proposed visualization

comment:7 Changed 15 years ago by Mark Evenson

Attached a sketch of the idea that came to my mind biking to work today.

Essentially, I don't think we have a graph that is very interesting. What we have is a linear list of instructions for which there are various line segments associated with each excution path. Each such path has an expected stack height that would best be represented as a "height" as displacement from the axis of the linear list of instructions.

comment:8 Changed 15 years ago by ehuelsmann

Resolution: fixed
Status: newclosed

(In [12639]) Fix #89: Stack inconsistency error when discarding READ-LINE return value.

Changed 15 years ago by ehuelsmann

Attachment: g.svg added

The graph that I used to find the problem and fix it

Note: See TracTickets for help on using tickets.