Commit Graph
100 Commits
Author SHA1 Message Date
GarboMuffin 20f25f252c interpreter: Do not re-evaluate procedure arguments after stop this script or return (#202)
"stop this script" and "return" would previously cause all the procedure
arguments to be re-evaluated and then discarded. In vanilla Scratch the
worst case is a performance penalty, but with our custom reporters it
can cause infinite loops.

Fixes https://github.com/TurboWarp/scratch-vm/issues/201
2024-03-30 17:53:13 -05:00
GarboMuffin ec1f7dea0c Add vm.exports.i_will_not_ask_for_help_when_these_break() (#181) 2024-01-28 16:30:48 -06:00
Muffin 81a0382e0f merge-upstream: initial merge of upstream/develop
installs & compiles but has test errors

aside from expected merge conflicts, notable changes from upstream:
 - removed husky, commitlint, etc.
 - removed semantic-release etc.
2023-12-22 17:25:21 -06:00
Muffin ff41d1dcf8 Fix compiler's hat implementation
Now supports edge-activated and predicate-based hats
2023-08-13 16:53:25 -05:00
GarboMuffin f033067b6f Non-warp recursion should yield in interpreter
Matches normal procedure blocks. Already worked in compiler.
2023-07-14 19:28:13 -05:00
GarboMuffin 40e053daf4 Export internal block being executed on StackFrame 2023-07-14 18:43:07 -05:00
GarboMuffin 6b8f443680 Implement procedure returns in interpreter 2023-07-10 21:46:15 -05:00
Thomas Weber 74bcfabad1 Remove thread.warp 2021-12-22 23:53:21 -06:00
Thomas Weber 1450d213ac Factory function should accept thread as only argument 2021-07-11 18:50:15 -05:00
Thomas Weber dbae5fe7d6 Implement addon blocks in interpreter 2021-07-07 00:10:04 -05:00
Thomas Weber bbe7bc035b Make startHats not O(n^2), attempt 2 2021-06-09 22:23:51 -05:00
Thomas Weber cdc962555f Revert "Make startHats not O(n^2)"
This reverts commit 5659a42b30.
2021-05-24 21:08:24 -05:00
Thomas Weber ec20b19f13 Add a few comments 2021-05-24 16:59:51 -05:00
Thomas Weber 5659a42b30 Make startHats not O(n^2)
For hats with restartExistingThreads=true, a map of target ID +
thread top block ID is maintained in addition to the thread list.
Then, startHats can do a simple lookup instead of iterating over
the entire thread list. Can improve performance in certain
projects that use way too many broadcasts and clones. These
lookups are probably O(1)-ish instead of O(n).

This is not possible for hats with restartExistingThreads=false
due to the extra .status === Thread.STATUS_DONE check.
2021-05-24 16:51:37 -05:00
Thomas Weber 75eb096abd js: Store timer for control.wait on thread 2021-03-03 12:49:19 -06:00
Thomas Weber 5eec998fc2 Fix flyout block glowing 2021-01-25 16:11:09 -06:00
Thomas Weber 4f027f3341 Allow flyout blocks to be cached 2021-01-25 15:09:06 -06:00
Thomas Weber d49f266f09 Do not cache flyout blocks 2021-01-18 12:50:54 -06:00
Thomas Weber dc52b58019 Implement thread glowing (#35) 2020-11-24 12:06:47 -06:00
Thomas Weber 3ec9f75bea Include target in COMPILE_ERROR 2020-11-18 16:24:43 -06:00
Thomas Weber ed162660f0 Add COMPILE_ERROR event 2020-11-18 16:22:28 -06:00
Thomas Weber 6a8adacb8d Refactor compilation result caching
Making it less archaic

I mean, giving Object, null, and undefined each different meaning was a bit... questionable
2020-10-16 18:50:22 -05:00
Thomas Weber 32d0c44666 Fix style issue 2020-10-14 10:27:34 -05:00
Thomas Weber 32df47f2e2 Compiler cleanup 2020-08-03 22:53:36 -05:00
Thomas Weber f63145b3bf Fix error in procedure compiling 2020-08-03 22:53:36 -05:00
Thomas Weber 235e2a00cd Fix some smaller bugs 2020-08-03 22:53:36 -05:00
Thomas Weber 921022f33f Nuke the old compiler. 2020-08-03 22:53:36 -05:00
Thomas Weber f9bc2137c5 Use thread blockContainer 2020-07-26 15:29:41 -05:00
Thomas Weber e97538110c Address some test failures 2020-07-26 11:57:30 -05:00
Thomas Weber 259f5f32fd Further refactoring 2020-07-14 17:21:37 -05:00
Thomas Weber 7dba04525d Fix restarted threads not being compiled 2020-07-14 01:44:30 -05:00
Thomas Weber e23f29c798 Improve the compiler compatibility layer 2020-07-13 18:04:38 -05:00
Thomas Weber a5536bfa3c Move script cache to Blocks 2020-07-07 11:05:46 -05:00
Thomas Weber d5546c6b05 dirty hack to fix some wrongful caching 2020-07-06 23:44:49 -05:00
Thomas Weber c6b9df757c Script factories 2020-07-06 23:18:16 -05:00
Thomas Weber f0d76864a4 minor cleanup 2020-07-06 23:16:51 -05:00
Thomas Weber 5c56ba025a transition more things to yielding 2020-07-06 20:42:16 -05:00
Thomas Weber bf32e2e468 Back to a yielding compiler 2020-07-06 19:34:38 -05:00
Thomas Weber fdad50f397 Get some more things to work in the compiler
- add event_broadcastandwait
- add looks_switchbackdropto
- add looks_backdrops
2020-06-26 12:45:06 -05:00
Thomas Weber 930fe68112 More updates to the compiler
- remove unused local variable tracking and utilities
- add some jsdoc to the compiler executor
- improve variable reference finding
- add data_listcontainsitem
- add event_broadcast
- add event_broadcast_menu
2020-06-26 00:14:42 -05:00
Thomas Weber ae5ce527b1 Some smaller bug fixes in the compiler
- throw if toString on asNumber, asString, asBoolean
- log compilation errors again
- add motion_setrotationstyle
- fix operator_divide NaN handling
- fix operator_mod second argument
2020-06-25 23:05:06 -05:00
Thomas Weber 3a8f0a11f5 Implement ScriptCache 2020-06-25 21:40:57 -05:00
Thomas Weber d8c095271f Improve some compiler internals
- fix procedures being compiled more than once
- remove Cast dependency from execute
2020-06-23 23:00:53 -05:00
Thomas Weber 417fe21215 Get quicksort to run
- add control_stop
- fix control_repeatuntil
- fix control_while
- add data_hidelist
- add data_showlist
- add data_deletealloflist
- add data_addtolist
- add data_replaceitemoflist
- add data_lengthoflist
- add data_itemoflist
- add motion_xposition
- add motion_yposition
- fix procedures_call
2020-06-23 18:57:37 -05:00
Thomas Weber 85d34f03ac Improve procedure support
Supports string arguments
Supports warp
2020-06-22 22:02:28 -05:00
Thomas Weber b93558f850 Basic procedure support 2020-06-22 21:34:47 -05:00
Thomas Weber 4a4ba718c6 pen, colors, thread state 2020-06-22 19:34:30 -05:00
Thomas Weber c10a631d2e get some more simple things to sortof work 2020-06-22 16:55:46 -05:00
Thomas Weber 99c570f459 New compiler/runtime model
Use continuations instead of generators
Lots of things taken quite directly from forkphorus/phosphorus
2020-06-14 20:53:09 -05:00
Thomas Weber 92da52e4fc This is progress
- if compilation errors, fallback to interpreter
- retire compiled threads once done
- add control_repeat
- add math_whole_number
2020-06-09 20:00:17 -05:00