core: Remove all static strings, shrink Value structs - #19716
Conversation
|
|
||
| globals.set_vtable(mc, global_obj_vtable); | ||
|
|
||
| activation.context.avm2.toplevel_global_object = Some(globals); |
There was a problem hiding this comment.
To be sure, why was this moved later?
There was a problem hiding this comment.
We have three script global objects right now- one for the builtin classes script, one for Toplevel.as, and one for globals.as. The "toplevel" global object has pointed to the builtin one for a long time, but as we moved classes out of it and into Toplevel.as it makes more sense to make it point to the Toplevel.as global object.
The hacky part was that some tests depended on the "toplevel" global object having the parseInt, parseFloat, etc properties, which, since they were defined in Toplevel.as, we had to copy over to the builtin global object manually. Now that the only properties left on the builtin global object are Object and Class anyway, I made the "toplevel" global object point to Toplevel.as and removed the copying hack.
| &name[(start + 2)..(name.len() - 1)], | ||
| )); | ||
| name = "__AS3__.vec::Vector".into(); | ||
| name = AvmString::new_utf8(activation.gc(), "__AS3__.vec::Vector"); |
There was a problem hiding this comment.
This could still be an AvmString-pointing-to-static, right?
| let gc_context = activation.gc(); | ||
| let namespaces = activation.avm2().namespaces; | ||
|
|
||
| let class_name = AvmString::new_utf8(gc_context, "Class$"); |
There was a problem hiding this comment.
Managed-pointing-to-static?
|
So a lot of these Also after this gets merged, I'll do an instrumented test to see what dynamic strings we now allocate from our own code during normal runtime. |
17c9bc0 to
45c741e
Compare
| const _: () = assert!(size_of::<Value<'_>>() <= 16); | ||
|
|
||
| #[cfg(target_pointer_width = "64")] | ||
| const _: () = assert!(size_of::<Value<'_>>() == 24); |
There was a problem hiding this comment.
Can you keep them separate, to be more explicit? Will be also useful if we ever do NaN boxing on 32-bit.
|
|
||
| // This type is used very frequently, so make sure it doesn't unexpectedly grow. | ||
| #[cfg(target_family = "wasm")] | ||
| const _: () = assert!(size_of::<Result<Value<'_>, Error<'_>>>() == 24); |
There was a problem hiding this comment.
I thought that the size is smaller (16?) on non-wasm due to x86 being less strict with alignment?
At least at some point it was. Do we do any testing on 32-bit?
That's why I suggest keeping them separate here too.
…EventObject::io_error_event
-----------------------------------------------------------------------------------------------------
chromebook-linux-audio.mk d244d144d2a410f2fad23d25446c401096d0ce8e # Version: Commits on Mar 07, 2025
-----------------------------------------------------------------------------------------------------
functions: return from config check if unable to read config,
------------------------------------------------------------------------------------
cubeb.mk f8633c0c9217ed5499fdda391946d416c52e6809 # Version: Commits on Mar 10, 2025
------------------------------------------------------------------------------------
Join thread before calling cond var dtor to avoid race,
-------------------------------------------------------------------------------------
zmusic.mk 6928b8609db9b1c104c4cd4f9b163486121fb0f0 # Version: Commits on Mar 08, 2025
-------------------------------------------------------------------------------------
Fix building with no sndfile support at all
The stub functions still reference SNDFILE, so we still need to include
the bundled header in this case.,
--------------------------------------------------------------------------------------------------------
batocera-emulationstation.mk 3731cc03b8d243d42eae5ba15ec977862adb7b69 # Version: Commits on Mar 09, 2025
--------------------------------------------------------------------------------------------------------
Merge pull request #1889 from bulzipke/batocera_netplay_settings
[NetPlay] Added Netplay options: Auto Lobby & Relay Filter,
------------------------------------------------------------------------------------------------
batocera-es-piboy.mk 3731cc03b8d243d42eae5ba15ec977862adb7b69 # Version: Commits on Mar 09, 2025
------------------------------------------------------------------------------------------------
Merge pull request #1889 from bulzipke/batocera_netplay_settings
[NetPlay] Added Netplay options: Auto Lobby & Relay Filter,
---------------------------------------------------------------------------------------
applewin.mk cbfce26e214787b20a4be7520b843ad0905e2436 # Version: Commits on Mar 09, 2025
---------------------------------------------------------------------------------------
Merge pull request #252 from AppleWin/master
tfe_store: explicit cases to avoid warning. (PR #1389),
-------------------------------------------------------------------------------------
azahar.mk a5ad887771bbbe7b49cdad6ea0e79268bdc61279 # Version: Commits on Mar 09, 2025
-------------------------------------------------------------------------------------
Do data migration before QtConfig is constructed,
------------------------------------------------------------------------------------
citra.mk e0d78ada69000bf2ad808873c3852f3ef64c80da # Version: Commits on Mar 10, 2025
------------------------------------------------------------------------------------
Android: Update various dependencies,
------------------------------------------------------------------------------------------
dolphin-emu.mk 5ed8b7bc9d8f70d5dae4f009939ac9715adf83b4 # Version: Commits on Mar 10, 2025
------------------------------------------------------------------------------------------
Merge pull request #13403 from jordan-woyak/backend_info
VideoCommon: Move backend_info out of VideoConfig struct.,
------------------------------------------------------------------------------------------
duckstation.mk c717f547cfaba2b24bfd98e39148a5b1bc2edc5a # Version: Commits on Mar 10, 2025
------------------------------------------------------------------------------------------
Deps: Update to SDL3 3.2.8,
-----------------------------------------------------------------------------------------------
lindbergh-loader.mk 6e751f16f0934ab64fffdd65582c46654ddd81b6 # Version: Commits on Mar 09, 2025
-----------------------------------------------------------------------------------------------
Fixed bug in ABC res patch after cleaning up code.,
--------------------------------------------------------------------------------------
melonds.mk 0fcf1f6e3a443cb249f85d948ff6e58dc58501d6 # Version: Commits on Mar 09, 2025
--------------------------------------------------------------------------------------
Add support for using the solar sensor without requiring a Boktai ROM (#2221)
* Add a `GBAHeader` struct
* Add extra `GBAAddon` entries for the Boktai carts
- Each game in the trilogy has a different effect on Lunar Knights (the only commercial DS game to support the solar sensor)
* Copy the logo data from the NDS ROM's header to the Boktai stub's header,
--------------------------------------------------------------------------------------
openmsx.mk 3af263ee65c523cd235991223f3f7d5c8bfedd21 # Version: Commits on Mar 10, 2025
--------------------------------------------------------------------------------------
Added Contrib/dmk/Makefile, Contrib/tsx/Makefile
Based on:
Include Makefiles for Contrib/dmk and Contrib/tsx
openMSX/openMSX#1872
Thanks!,
----------------------------------------------------
pcsx2.mk v2.3.212 # Version: Commits on Mar 09, 2025
----------------------------------------------------
- [Qt: Fix pad vibration binding window](PCSX2/pcsx2#12396)
,
----------------------------------------------------------
python-pyxel.mk v2.3.11 # Version: Commits on Mar 10, 2025
----------------------------------------------------------
Updated the WASM wheel to version 2.3.11,
------------------------------------------------------------------------------------
rpcs3.mk db945f6aed82563e88a5f7552d6df68ae5f96d38 # Version: Commits on Mar 06, 2025
------------------------------------------------------------------------------------
android: do not invalidate swapchain on VK_SUBOPTIMAL_KHR
Workaround,
---------------------------------------------------------------
ruffle.mk nightly-2025-03-10 # Version: Commits on Mar 10, 2025
---------------------------------------------------------------
## What's Changed
* chore: Ignore advisory about `paste` being unmaintained by @torokati44 in ruffle-rs/ruffle#19757
* core: Remove all static strings, shrink Value structs by @Lord-McSweeney in ruffle-rs/ruffle#19716
* core/avm1/avm2: Add `AvmString::new_ascii_static` and use it by @Lord-McSweeney in ruffle-rs/ruffle#19760
**Full Changelog**: ruffle-rs/ruffle@nightly-2025-03-08...nightly-2025-03-10,
--------------------------------------------------------------------------------------
scummvm.mk 2c0c1ca4a6d1a30cdbb8d738d76d34ea7a918e19 # Version: Commits on Mar 09, 2025
--------------------------------------------------------------------------------------
CREDITS: Rebrand rootfather to felsqualle,
--------------------------------------------------------------------------------------
shadps4.mk ba1eb298dec48f88431068390232e3978ae07bda # Version: Commits on Mar 10, 2025
--------------------------------------------------------------------------------------
New Crowdin updates (#2631)
* New translations en_us.ts (French)
* New translations en_us.ts (Spanish)
* New translations en_us.ts (Polish)
* New translations en_us.ts (Spanish)
* New translations en_us.ts (Albanian),
---------------------------------------------------------------------------------------
thextech.mk 72fb925bc71cd104fdba2ab9ce1c429b7e1ad9cc # Version: Commits on Mar 10, 2025
---------------------------------------------------------------------------------------
files.cpp: fix handling of Archives paths on win32,
-----------------------------------------------------------------------------------
xemu.mk 4665515d801e7b3d15eaab24fb35ff04c9e782bc # Version: Commits on Mar 10, 2025
-----------------------------------------------------------------------------------
nv2a: Group attributes in pgraph_get_glsl_vtx_header,
-------------------------------------------------------------------------------------------
xenia-native.mk 27d9cb8cfcf2f88f59fa0e783e6be3305cf19813 # Version: Commits on Mar 10, 2025
-------------------------------------------------------------------------------------------
[XAM] Added missing nullptr check.
This partially fixes Fable 2 main menu crashes.
Figure out why game tries to save invalid data.,
-----------------------------------------------------------------------------------------
rpi-eeprom.mk d50b2b32f162292ab6e235932075ce00bddda4ae # Version: Commits on Mar 10, 2025
-----------------------------------------------------------------------------------------
pieeprom-2025-03-10: 2712: Add [boot_partition] filter plus SDRAM init fixes (latest)
* Update SDRAM init timings to intermittent 8-flash SDRAM init errors
on some boards.
See: raspberrypi/rpi-eeprom#67
* config: Fix missing initialisation of selected_expr to 1 in config.txt
Without an [all] section the new expression filter might default to
false. This impacts the bootloader early parsing of config.txt
for things like boot_ramdisk rather than the later config.txt pass
for device-tree parsing.
* config_loader: Add support [boot_partition=N] as an expression filter
The boot_partition tests whether the partition number N matches
the number that the system is booting from. This expression is
only supported in config.txt and is designed to make it easier
to have common boot.img ramdisks in an A/B system where the
conditional loads a different cmdline.txt file depending on
which partition boot.img is loaded from.,
-------------------------------------------------------------------------------------------
sdl12-compat.mk 990ce7bd9a19720b3481154edbcd31b42318457f # Version: Commits on Mar 10, 2025
-------------------------------------------------------------------------------------------
SDL_stdinc.h: Fix apparent copy/paste error
SDL_strcasecmp, rather than SDL_strncasecmp, being defined as _strnicmp.,
---------------------------------------------------------------------------------------
alephone.mk b573f51c949904f5ad5bc0dd8ce491c7b63dac30 # Version: Commits on Mar 10, 2025
---------------------------------------------------------------------------------------
Don't run CI tests in forks without submodules,
------------------------------------------------------------------------------------
box64.mk 2b300bd199a7a65a3de1eecd24d6dff5593a9b55 # Version: Commits on Mar 10, 2025
------------------------------------------------------------------------------------
Bumped version to v0.3.4,
------------------------------------------------------------------------------------------
devilutionx.mk 390d7600a31dc67d9773123e2c68c55a5791e9fc # Version: Commits on Mar 09, 2025
------------------------------------------------------------------------------------------
Fix debug command for talking to towners,
---------------------------------------------------------------------------------------
etlegacy.mk 194ed37c310042bacbc64aed03c84c03937fffdf # Version: Commits on Mar 10, 2025
---------------------------------------------------------------------------------------
app: Add KeyBinding Manager,
-------------------------------------------------------------------------------------
openjk.mk 5878f620f6dabb6573595470627ab2e31cb46b67 # Version: Commits on Mar 10, 2025
-------------------------------------------------------------------------------------
[NPC behavior] reduce NPC_BSFlee random range (#1129)
* [NPC behavior] reduce NPC_BSFlee random range
Irand fails when the requested random range is not below QRAND_MAX,
which is 2**15 as it is right now. NPC_BSFlee calls irand (via Q_irand)
by requesting the random range within [10000, 50000] which is of course
below 2**15 and the game crashes.
Below is my stack trace in gdb:
4 0x00007ffff784a486 in __assert_fail () from /usr/lib/libc.so.6
5 0x00007fffd18e5b6c in irand (min=10000, max=50000) at /opt/games/git-openjk/shared/qcommon/q_math.c:252
6 0x00007fffd18e5bcc in Q_irand (value1=10000, value2=50000) at /opt/games/git-openjk/shared/qcommon/q_math.c:264
7 0x00007fffd177c34b in NPC_BSFlee () at /opt/games/git-openjk/code/game/NPC_behavior.cpp:1748
8 0x00007fffd1776525 in NPC_RunBehavior (team=2, bState=10) at /opt/games/git-openjk/code/game/NPC.cpp:2055
9 0x00007fffd1776837 in NPC_ExecuteBState (self=0x7fffd1a94ac8 <g_entities+94248>) at /opt/games/git-openjk/code/game/NPC.cpp:2185
10 0x00007fffd1777472 in NPC_Think (self=0x7fffd1a94ac8 <g_entities+94248>) at /opt/games/git-openjk/code/game/NPC.cpp:2494
11 0x00007fffd16d83ce in GEntity_ThinkFunc (self=0x7fffd1a94ac8 <g_entities+94248>) at /opt/games/git-openjk/code/game/g_functions.cpp:67
12 0x00007fffd16e5ac4 in G_RunThink (ent=0x7fffd1a94ac8 <g_entities+94248>) at /opt/games/git-openjk/code/game/g_main.cpp:1075
13 0x00007fffd16e84fa in G_RunFrame (levelTime=578050) at /opt/games/git-openjk/code/game/g_main.cpp:2055
14 0x00005555555d9d91 in SV_Frame (msec=11, fractionMsec=0) at /opt/games/git-openjk/code/server/sv_main.cpp:513
15 0x00005555555b0740 in Com_Frame () at /opt/games/git-openjk/code/qcommon/common.cpp:1418
16 0x000055555562a897 in main (argc=1, argv=0x7fffffffe2c8) at /opt/games/git-openjk/shared/sys/sys_main.cpp:812
(gdb) frame 5
5 0x00007fffd18e5b6c in irand (min=10000, max=50000) at /opt/games/git-openjk/shared/qcommon/q_math.c:252
252\t\tassert((max - min) < QRAND_MAX);
* keep the original timer value
---------
Co-authored-by: razor <[email protected]>,
----------------------------------------------------------------------------------
stk.mk 6fdf215549fef57a2530413a815b1693f994061f # Version: Commits on Mar 10, 2025
----------------------------------------------------------------------------------
Fix out-of-focus text box widget when alphabet characters are assigned as navigation,
---------------------------------------------------------------------------------------------
theforceengine.mk d2d6a35a5b63aa866e7336b33c8fcebc8a0e7eff # Version: Commits on Mar 09, 2025
---------------------------------------------------------------------------------------------
* Additional cleanup around ScriptCall string parameters.,
----------------------------------------------------------------------------------------------------
sdl2-gamecontrollerdb.mk 1275aac61f6be136648d0445dfb8c71191077af4 # Version: Commits on Mar 10, 2025
----------------------------------------------------------------------------------------------------
Add Mad Catz FightStick Alpha
thanks @madmalkav,
-------------------------------------------------------------------------------------------------
libretro-core-info.mk 7d18381b0e0fade81050315ce260a72307e55280 # Version: Commits on Mar 09, 2025
-------------------------------------------------------------------------------------------------
Merge pull request #72 from Apaczer/uae4all
Create uae4all_libretro.info,
----------------------------------------------------------------------------------------
retroarch.mk 9e64cce10fb4a3411a933fd1377dd32021288360 # Version: Commits on Mar 10, 2025
----------------------------------------------------------------------------------------
Merge pull request #17678 from warmenhoven/warmenhoven/cloud-ignore,
---------------------------------------------------------------------------------------------
vulkan-samples.mk bbb427f09147f811b1bab16fedb028517da9ed48 # Version: Commits on Mar 10, 2025
---------------------------------------------------------------------------------------------
update the actions/cache version for ios to v4 (#1292)
* update the actions/cache version for ios to v4
* update astc,
-------------------------------------------------------------------------------------
gzdoom.mk e2103d2508d6d784dc20ffa598a4a11ac993ae69 # Version: Commits on Mar 09, 2025
-------------------------------------------------------------------------------------
Fix building with GCC 15,
-----------------------------------------------------------------------------------------
sonic3-air.mk 9ae7f0b9a977dedc6247378de0f433dd06d652bd # Version: Commits on Mar 10, 2025
-----------------------------------------------------------------------------------------
Small fix for emulated AIZ music,
-----------------------------------------------------------------------------------
tr1x.mk ea6399fe993f268760ac53829c9a6413ad7344fb # Version: Commits on Mar 10, 2025
-----------------------------------------------------------------------------------
tr1/shell: add -l argument support,
-----------------------------------------------------------------------------------
tr2x.mk ea6399fe993f268760ac53829c9a6413ad7344fb # Version: Commits on Mar 10, 2025
-----------------------------------------------------------------------------------
tr1/shell: add -l argument support,
---------------------------------------------------------------------------------------------
libretro-fbneo.mk 0f7810eaa6dd0bfb67106128e6179380a460412b # Version: Commits on Mar 10, 2025
---------------------------------------------------------------------------------------------
(libretro) update files,
-----------------------------------------------------------------------------------------------
libretro-scummvm.mk 2c0c1ca4a6d1a30cdbb8d738d76d34ea7a918e19 # Version: Commits on Mar 09, 2025
-----------------------------------------------------------------------------------------------
CREDITS: Rebrand rootfather to felsqualle,
|
The failure of the assertion about the size on x86_32 (i686) still blocks updating Ruffle in the Android app: |
AvmStringnow directly holds aGc<AvmStringRepr>, which shrinks Value structs on 64-bit from 24 to 16 bytes. getlocal, setlocal, and getslot run 5-10% faster; Chess Demons starts up about 5% faster.