Closed Bug 411843 Opened 18 years ago Closed 18 years ago

ESC line numbers incorrect

Categories

(Tamarin Graveyard :: Self-hosting compiler (ESC), defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: markh, Assigned: lhansen)

Details

Attachments

(3 files)

ESC sometimes generates OP_debugline instructions in the wrong place. To reproduce, create a sourcefile containing 'x=y\n'. Compile it using esc.sh and encode it using abcencode.sh. The 'code' in the resulting .asm file shows: , 'code': [ [ 'getlocal0' ] , [ 'pushscope' ] , [ 'debugfile', 5 ] , [ 'debugline', 1 ] , [ 'findproperty', 4 ] , [ 'debugline', 2 ] , [ 'findpropstrict', 5 ] , [ 'getproperty', 5 ] Note the second 'debugline' instruction - it is indicating we are on line 2 way too early - that first 'findproperty' is locating the 'x' - assignment doesn't finish until 6 or 7 instructions later.
Attached patch Fix the bugSplinter Review
ESC was using the line number for the wrong token. And then it was mistakenly adding 1 to it. The first problem ended up with the correct line number sometimes, since often the next token was on the same line. The second problem made everything off by one.
Attachment #298746 - Flags: review?(lhansen)
Attachment #298746 - Flags: review?(lhansen) → review+
Pushed fix to tc.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
works for me - thanks!
Status: RESOLVED → VERIFIED
There appears to have been a regression here - the same sample above appears to generate identical asm as shown above - ie, a premature debugline instruction.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Assignee: nobody → lhansen
Status: REOPENED → NEW
The problem was that the token was consumed before its source position was recorded. This happened all over the place and I've gone over the parser and fixed the obvious ones.
Attachment #302524 - Flags: review?(mhammond)
Comment on attachment 302524 [details] [diff] [review] Patches for the regression (and for similar, unfixed bugs) looks good and works for me.
Attachment #302524 - Flags: review?(mhammond) → review+
378:e5dc4ee7b1ff
Status: NEW → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
This seems to have come back (at rev 548). In the example above, the runtime error seen is: ReferenceError: Error #1065: Variable y is not defined. at global$init()[hello.as:0] You can add as many lines at the start as you like, and the line will continue to be reported as 0. If you put a successful line first, the error will then be reported as being at the line which worked. Sadly, the abc encoder is currently broken so I can't paste in the assembler.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I may have misled - rev 548 is what I happen to be at and is only a couple of days old. There is nothing to suggest that rev was responsible for the problem though.
Status: REOPENED → ASSIGNED
Attachment #323690 - Flags: review?(jodyer) → review+
Pushed.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: