Skip to content

avm2: Speed up some native calls #20328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
avm2: Apply FastCall optimization to most Math methods
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed May 23, 2025
commit 13c86e844f5095fadec25eb52aab4491e9f8f6f0
15 changes: 15 additions & 0 deletions core/src/avm2/globals/Math.as
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,33 @@ package {
public static const SQRT1_2: Number = 0.7071067811865476;
public static const SQRT2: Number = 1.4142135623730951;

[Ruffle(FastCall)]
public static native function abs(x: Number): Number;
[Ruffle(FastCall)]
public static native function acos(x: Number): Number;
[Ruffle(FastCall)]
public static native function asin(x: Number): Number;
[Ruffle(FastCall)]
public static native function atan(x: Number): Number;
[Ruffle(FastCall)]
public static native function ceil(x: Number): Number;
[Ruffle(FastCall)]
public static native function cos(x: Number): Number;
[Ruffle(FastCall)]
public static native function exp(x: Number): Number;
[Ruffle(FastCall)]
public static native function floor(x: Number): Number;
[Ruffle(FastCall)]
public static native function log(x: Number): Number;
[Ruffle(FastCall)]
public static native function round(x: Number): Number;
[Ruffle(FastCall)]
public static native function sin(x: Number): Number;
[Ruffle(FastCall)]
public static native function sqrt(x: Number): Number;
[Ruffle(FastCall)]
public static native function tan(x: Number): Number;

public static native function atan2(y: Number, x: Number): Number;
public static native function pow(x: Number, y: Number): Number;

Expand All @@ -32,6 +46,7 @@ package {
public static native function max(x: Number = NegInfinity, y: Number = NegInfinity, ...rest): Number;
public static native function min(x: Number = Infinity, y: Number = Infinity, ...rest): Number;

[Ruffle(FastCall)]
public static native function random(): Number;
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy