I don't know :(
In external world (C) i guess libraries should care of
saving/restoring FPU state.
For MultiThread, I guess this saving/restoring of FPU state occurs
automatically when switching thread...
We could mimic this at process switch with Process-bound variables...
To limit the overhead, only Process with a declared interest in FPU
could perform a Pre-activate, Pre-suspend action.
Maybe something like:
FPU >> changeFPUstatus: aFPUstatus
(Processor activeProcess)
saveSuspendedFPUStatus;
setActivatedFPUStatus: aFPUstatus
FPU setFPUstatus: aFPUstatus.
Process >> saveSuspendedFPUStatus
suspendedFPUstatus ifNil: [suspendedFPUstatus := FPU currentFPUstatus ].
Process >> suspend
suspendedFPUstatus ifNotNil: [FPU setFPUstatus: suspendedFPUstatus ].
self suspendCore.
Process >> activate
activatedFPUstatus ifNotNil: [FPU changeFPUstatus: activatedFPUstatus].
self activateCore.
Process >> restoreSuspendedFPUStatus
suspendedFPUstatus ifNotNil: [
FPU setFPUstatus: suspendedFPUstatus.
suspendedFPUstatus := activatedFPUstatus := nil].
Or more ellaborated with a statusStack...
Nicolas
2009/7/8 Andres Valloud <[email protected]>:
> Well, that's going to be an issue because the parts of the code will see
> different VM behavior. Of course, however, the parts of the application
> can change the VM's behavior on the fly to do as they like. In general,
> however, I'd expect that kind of stuff to be rather problematic. What
> would you do?
>
> Nicolas Cellier wrote:
>> 2009/7/8 Andres Valloud <[email protected]>:
>>
>>> FWIW... VW has two choices... a) fail the primitives when the answer is
>>> INF or NaN, or b) return whatever the FPU says. Also, NaN and INF are
>>> regular instances of Float and Double...
>>>
>>>
>>
>> What if some part of the code rely on signalling an Exception , and
>> another part rely on answering exceptional values?
>>
>> Nicolas
>>
>>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project