Closed Bug 441872 Opened 17 years ago Closed 17 years ago

Introduce support for signed and unsigned overflow detection (LIR_ov and LIR_cs)

Categories

(Tamarin Graveyard :: Tracing Virtual Machine, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gal, Assigned: gal)

Details

Attachments

(3 obsolete files)

This patch adds support for guarding and obtaining the boolean value of signed and unsigned overflow conditions. In contrast to LIR_eq and friends, LIR_ov and LIR_cs do not imply a CMP/TEST. Instead, LIR_ov and LIR_cs are placed immediately after the arithmetic operation we are interested in. The operand or LIR_ov and LIR_cs should point to this instruction for readability, but is otherwise unused (except during verbose mode).
Attached patch Patch against TT tip. (obsolete) — Splinter Review
It would be nice to ensure that LIR_ov and LIR_cs immediately precede the guard. I don't know how to assert that.
Attachment #326754 - Flags: review?(edwsmith)
also need to update lirNames[] and operandCount[] tables. will it be a problem that isCmp() will be true for ov and cs? to check that the next (backwards) instruction is what you want would require reading a head in the pipline, thats probably tricky in general. this would work if there arent any dead instructions inbetween that the pipeline has removed: case LIR_xt: LirReader r(ins); LInsp next = r.previous(); NanoAssert(next->isop(LIR_ov) || ... ); another idea is to put the assert in LIR_ov and LIR_cs, and require that the last assembled instruction was a guard. that would be easy with a local variable in gen().
We could have isCond() and isCmp(). isCmp() is the other once, isCond() is ov or cs or isCmp(). What do you think? I don't think there is anything in there for xt/xt->lt either, so I will not worry about this assert for now but we should leave this bug open until we have one. This is going to be nasty to debug if someone gets it wrong higher up in the pipeline. I wil fix up the other stuff and re-post.
Attached patch Added Ed's fixes. (obsolete) — Splinter Review
isCmp() is no longer true for ov and cs. isCond() includes isCmp() and ov and cs.
Attachment #326754 - Attachment is obsolete: true
Attachment #326807 - Flags: review?(edwsmith)
Attachment #326754 - Flags: review?(edwsmith)
Comment on attachment 326807 [details] [diff] [review] Added Ed's fixes. testing now, will push soon assuming favorable outcome
Attachment #326807 - Flags: review?(edwsmith) → review+
Patch is failing to compile on Debug ARM PocketPC builds for me
Could you post the error message here? I don't have an arm platform to test with.
From the buildbot: http://tamarin-builds.mozilla.org/tamarin-tracing/builders/windows/builds/49 1>..\..\nanojit\Assembler.cpp(888) : error C3861: 'MRNO': identifier not found 1>..\..\nanojit\Assembler.cpp(889) : error C3861: 'MRNC': identifier not found 1>..\..\nanojit\Assembler.cpp(1134) : error C3861: 'JNO': identifier not found 1>..\..\nanojit\Assembler.cpp(1136) : error C3861: 'JNC': identifier not found 1>..\..\nanojit\Assembler.cpp(1159) : error C3861: 'JO': identifier not found 1>..\..\nanojit\Assembler.cpp(1161) : error C3861: 'JC': identifier not found 1>..\..\nanojit\Assembler.cpp(1244) : error C3861: 'SETO': identifier not found 1>..\..\nanojit\Assembler.cpp(1246) : error C3861: 'SETC': identifier not found
isCond is true for LIR instruction that modify the flags. isCmp only for the comparison op. This makes sure LIR_xf/xt check for isCond, not narrowly for isCmp.
Assignee: nobody → gal
Attachment #326807 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #327754 - Flags: review?(edwsmith)
Attachment #327754 - Flags: review?(edwsmith) → review+
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Attachment #327754 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: