Closed
Bug 555805
Opened 14 years ago
Closed 14 years ago
Support architectures that don't implement subnormal floats
Categories
(Tamarin Graveyard :: Virtual Machine, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
flash10.1
People
(Reporter: stan, Assigned: lhansen)
Details
(Whiteboard: Has patch)
Attachments
(1 file, 1 obsolete file)
9.19 KB,
patch
|
edwsmith
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 Build Identifier: Tamarin Redux, March '10 A number of architectures don't implement subnormal floating point representations in hardware, but instead trap to a software emulator. Some of these (in particular, ARM) support a "run-fast" mode that simply flushes subnormal values to zero. While the run-fast mode is under control of the user program, the trap handler appears to be the province of the operating system, so clearing the flush-to-zero bit is not necessarily a solution but can instead result in an unhandled trap. The upshot is that the smallest non-zero number (Number.MIN_VALUE) is larger (2.2250738585072014e-308) than the currently hard-coded IEEE value (4.94e-324). After much discussion of whether this should be fixed using conditional compilation or with dynamic code, I've decided that only a dynamic solution is completely satisfactory (we COULD conditionally-compile whether it is dynamic, but to that end?). On systems that have this issue, subnormal support is something that could change with any operating system upgrade or, say, between different processors in the same product family. So the value of MIN_VALUE might be different for different invocations or installations of the same program. What would we like to be able to say about MIN_VALUE? I think we want the following two things to be true: Min value is not zero: Number.MIN_VALUE > 0 and All smaller values (for instance MIN_VALUE/2) are zero: Number.MIN_VALUE/2 == 0 Reproducible: Always Steps to Reproduce: Currently, the value of Number.MIN_VALUE is equal to zero on the iPhone.
Reporter | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
FYI, the ARM arch manual states the following as being "rounded to +0" in flush-to-zero mode; (1) single precision results which lie in the range -2e-126 < x < +2e-126 (2) double precision results which lie in the range -2e-1022 < x < +2e-1022
Reporter | ||
Comment 3•14 years ago
|
||
To clarify: -2^(-1022) < x < 2^(1022) is the round-to-zero range. 2^(-1022) ~= 2.2250738585072014e-308
Comment 4•14 years ago
|
||
Good point, I meant base 2 not base 10.
Assignee | ||
Updated•14 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Target Milestone: --- → flash10.1.1
Reporter | ||
Comment 5•14 years ago
|
||
Perforce CL 643276; still on a sideline branch. Watson Bugs 2552754, 2471354
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → lhansen
Assignee | ||
Comment 6•14 years ago
|
||
Documentation update request filed: bug #557277.
Status: NEW → ASSIGNED
Assignee | ||
Comment 7•14 years ago
|
||
A couple of issues with the patch: - I don't know why this code should be #ifdef ARM, particularly. - The code in the DEBUG block is probably wrong, it assumes a particular floating-point layout but floating point layouts can be strange, for example with high/low words laid out in one endianness and the bytes within the words laid out in the other. I have to dig out some references. Other than that the patch seems sound.
Assignee | ||
Updated•14 years ago
|
Target Milestone: flash10.1.1 → flash10.1
Assignee | ||
Comment 8•14 years ago
|
||
Specifically, look at AVMSYSTEM_DOUBLE_MSW_FIRST in core/avmfeatures.h. It looks as though we're not handling this case well throughout the code, however - the only code that appears to handle it systematically is the UNIX case in MathUtils.cpp. Other code #errors out or ignores the problem. There are no obvious open bugs to track this problem though.
Comment 9•14 years ago
|
||
(In reply to comment #8) > Specifically, look at AVMSYSTEM_DOUBLE_MSW_FIRST in core/avmfeatures.h. It > looks as though we're not handling this case well throughout the code, however AFAIK, the only mainstream architecture with this property is MIPS (and even then maybe only some configs) -- as our MIPS support is still poorly tested, I'm not surprised if it's dodgy.
Assignee | ||
Comment 10•14 years ago
|
||
Mess around floating point layouts filed as bug #557286, won't record it as a blocker though, and won't require us to deal with it for the purposes of closing the present bug.
Assignee | ||
Comment 11•14 years ago
|
||
Acceptance test cases will require updating too.
Assignee | ||
Comment 12•14 years ago
|
||
Slightly cleaned up patch; cleaned up test cases.
Attachment #435692 -
Attachment is obsolete: true
Attachment #437113 -
Flags: review?(edwsmith)
Assignee | ||
Updated•14 years ago
|
Whiteboard: Has patch
Comment 13•14 years ago
|
||
Comment on attachment 437113 [details] [diff] [review] Restructured patch I assume the plan is to start using double_overlay all over the code where necessary, and thats why its not just defined in NumberClass.cpp.
Attachment #437113 -
Flags: review?(edwsmith) → review+
Assignee | ||
Comment 14•14 years ago
|
||
(In reply to comment #13) > (From update of attachment 437113 [details] [diff] [review]) > I assume the plan is to start using double_overlay all over the code where > necessary, and thats why its not just defined in NumberClass.cpp. yep. every day in every way things are going better and better.
Reporter | ||
Comment 15•14 years ago
|
||
(In reply to comment #9) > AFAIK, the only mainstream architecture with this property is MIPS (and even > then maybe only some configs) It's surprisingly common, actually, but most OS/RTL implementations hide it by handling the trap. This paper has a lot of interesting information on that: http://doc.cat-v.org/plan_9/4th_edition/papers/port Yeah, a lot of that is only interesting to us old-timers.
Assignee | ||
Comment 16•14 years ago
|
||
tamarin-redux-argo changeset: 3934:57a1c695b847
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
QA Contact: vm → brbaker
Comment 17•14 years ago
|
||
Testcase was added with proper changeset: (changeset in comment #16 is incorrect) tamarin-redux-argo changeset: 3935:57a1c695b847 http://asteam.macromedia.com/hg/tamarin-redux-argo/diff/57a1c695b847/test/acceptance/ecma3/Number/e15_7_1.as
Status: RESOLVED → VERIFIED
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•