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
Thomas Weber
4a93dab4fa
What if we compiled the blocks?
2020-06-08 17:59:23 -05:00
Karishma Chadha
c499106f85
Revert "Raise params to the next frame when pushing"
2019-07-22 12:59:48 -04:00
Michael "Z" Goddard
50b55a489b
fix stopThisScript inside procedures
2019-07-17 15:02:44 -04:00
Michael "Z" Goddard
e1254bd8c7
elevate stack block id and frame info into thread
...
- Add pointer member to thread. This is the current executing block.
- Add stackFrame member to thread. This is the current frame
information like procedure parameters.
This is a step potentially towards stack-less threads. With further
modifications we could have stack and stackFrames be null if a script
does not call a procedure.
2019-06-03 18:13:01 -04:00
Michael "Z" Goddard
20ff75b776
fix: initialize stack frame params for all procedures
...
A previous change fixed compatibility with Scratch 2 removing 3's
unintentional scope leaking. This furthers that change so that
procedures with no parameters will also not accidentally use values in
other procedure stacks.
2018-12-13 10:51:44 -05:00
Michael "Z" Goddard
fcafcbdd0a
return 0 from parameters outside of their procedure
2018-10-23 15:14:31 -04:00
Michael "Z" Goddard
d2c637a621
fix asynchronous block execution
...
Freeze promise waiting blocks into an array of reported values. Thaw
those reported values into parent values of matching blocks by id. If
the reporting block was waiting on a promise and reported a value
assign it to its parent value at that future time.
2018-07-13 00:04:49 -04:00
Michael "Z" Goddard
05291aa254
turn reporter tree into instruction sequence
...
Turn the reporter tree execute walks into a sequence of block
functions. After calling a block function store the reported value in
the arguments object its depending block will use.
- Set the reported value on the thread. There is only ever one "just"
reported value, which is read and stored elsewhere after being
reported.
2018-06-12 14:21:40 -04:00
Michael "Z" Goddard
0634e962a8
Add Thread.StackFrame class
...
Use a private StackFrame class to help internally manage use of Stack
Frame values and memory. Create params, reported, and executionContext
on demand.
2018-05-07 11:20:26 -04:00
Michael "Z" Goddard
02dd9a8c22
Unset justReported after reading its value
...
Avoid justReported values leaking to other argValues by setting back to the
default null value.
2018-04-24 19:05:20 -04:00