Opened 16 years ago

Closed 16 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 16 years ago.
Fix stack inconsistency in P2-BLOCK-NODE
abcl-compiler-analysis-proposal.svg (7.9 KB ) - added by Mark Evenson 16 years ago.
proposed visualization
g.svg (52.2 KB ) - added by ehuelsmann 16 years ago.
The graph that I used to find the problem and fix it

Download all attachments as: .zip

Change History (11)

comment:1 by Mark Evenson, 16 years ago

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 by Mark Evenson, 16 years ago

Without a HANDLER-CASE:

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

comment:3 by Mark Evenson, 16 years ago

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.

by Mark Evenson, 16 years ago

Attachment: abcl-ticket-89.patch added

Fix stack inconsistency in P2-BLOCK-NODE

comment:4 by Mark Evenson, 16 years ago

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 by Mark Evenson, 16 years ago

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

comment:6 by ehuelsmann, 16 years ago

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.

by Mark Evenson, 16 years ago

proposed visualization

comment:7 by Mark Evenson, 16 years ago

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 by ehuelsmann, 16 years ago

Resolution: fixed
Status: newclosed

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

by ehuelsmann, 16 years ago

Attachment: g.svg added

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

Note: See TracTickets for help on using tickets.