

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.java.dev.jna.users[jna-users] FPU control word safeguard?| From | Sent On | Attachments |
|---|---|---|
| Hueneke, Immo | Oct 27, 2008 5:33 am | |
| Timothy Wall | Oct 27, 2008 6:24 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [jna-users] FPU control word safeguard? | Actions... |
|---|---|---|
| From: | Hueneke, Immo (ih...@zuhlke.com) | |
| Date: | Oct 27, 2008 5:33:10 am | |
| List: | net.java.dev.jna.users | |
Hi all,
When using JNI, there is a well known method of crashing the JVM by changing the
value of the FPU control word within the native code and failing to restore it.
Whenever the VM executes the so-called "Safepoint Blob" to switch threads, it
has to pop all the floating-point registers into a thread context area and does
not expect the FPU to raise an exception when it underflows. Some native
libraries need to unmask floating-point exceptions, so to honour the JNI
contract they should restore the CW register afterwards (a relatively slow
operation, which is why the JNI implementation doesn't do this).
I can't find any documentation on this issue where JNA is concerned. Does JNA
safeguard the FPUCW each time execution passes between Java and native code, or
does the native library have to conform to a contract similar to JNI? Are there
any documented instances of VMs crashing sporadically with error messages along
the following lines?
- Java HotSpot(TM) Client VM warning: Floating point control word
changed by native JNI code.
- An unexpected error has been detected by HotSpot Virtual Machine:
EXCEPTION_ACCESS_VIOLATION
- EXCEPTION_FLT_DIVIDE_BY_ZERO
- EXCEPTION_FLT_STACK_CHECK
Thanks in advance for any information.
More background: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6346124 and
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5105765
Best regards, Immo
___________________________________
Consulting · Development · Integration
Immo Hüneke Senior Systems Architect
Zühlke Engineering Ltd<http://tinyurl.com/34mdeb> Marble Arch Tower 55 Bryanston Street London W1H 7AA United Kingdom
Phone +44(0)870 777 2337 Mobile +44(0)7941 072 238 Fax +44(0)870 777 2366 ih...@zuhlke.com<mailto:ih...@zuhlke.com>
____________________________________
Zuhlke Engineering Ltd Registered in England Company No: 4103211 Registered Office: 25 Moorgate London EC2R 6AY
This e-mail is for the addressees only. The information it contains is
confidential
and may be legally privileged. If you are not an addressee you must not
distribute,
copy, disclose, use or rely on this e-mail or its contents and you must
immediately
notify the sender and delete all copies from your system. Any unauthorised use
may
be unlawful.







