ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.62k stars 810 forks source link

AVM2 now supports pushfloat and probably more? #15954

Open hydroper opened 6 months ago

hydroper commented 6 months ago

Describe the feature Support for the new pushfloat instruction (it's apparently the case).

I've tried inspecting the following new ActionScript 3 in FFDec and got an error and could not browse it:

package {
    import flash.display.Sprite;

    public class Main extends Sprite {
        public function Main() {
            const v: float = 18f;
        }
    }
}

It looks like Samsung has brought something from ECMAScript 4, Tamarin, or alpha AVM2 drafts. Probably a new opcode for pushing IEEE 754 single-precision floating points.

adrian17 commented 6 months ago

Indeed, float stuff was part of proposed AS4 changes and can be seen in experimental stage in the archived avmplus repo.

That said - is there any real content that actually uses this at all? AFAIK it never got into the Flash Player, and even if it did get into AIR (which I don't think it did, but maybe I'm wrong), it surely must have been late enough that content relying on it is happily embedded in modern AIR apps.

If there's no real practical content that uses this, I don't think there'll be any motivation to implement it here.

hydroper commented 6 months ago

@adrian17 Yes, added to AIR in February. It was rather just as convenience for users of the SWF crate...

adrian17 commented 6 months ago

Just for the record, about your comment there:

It seems like parsing SWF compiled from a 10f literal results in an error at FFDec.

I don't think Harman has anything to do with FFDec ;)

It was rather just as convenience for users of the SWF crate...

As far as the SWF crate goes, sure, I don't think adding support for the opcode parsing is a bad idea; but we'd prefer it to be well documented (or at least supported in FFDec first), since we have no idea how much it differs from the original idea from years ago that we can see in avmplus (is the file format for AIR SDK's swfs even open?); and I still don't think there'll be much interest in supporting it in the engine itself; without us having a JIT, it'll just slow everything down more.

adrian17 commented 6 months ago

let's keep it open, at least for the missing support on swf reading/writing crate.

Dinnerbone commented 6 months ago

@hydroper You mentioned you were inspecting new actionscript; are you able to share that swf, and where you got it from?

hydroper commented 6 months ago

@Dinnerbone Right, here is a ZIP containing the SWF and AS&MXML project for the above program: float.zip