sonolus.py 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sonolus.py might be problematic. Click here for more details.
- sonolus/backend/finalize.py +18 -10
- sonolus/backend/interpret.py +7 -7
- sonolus/backend/ir.py +24 -0
- sonolus/backend/optimize/__init__.py +0 -0
- sonolus/backend/{allocate.py → optimize/allocate.py} +4 -3
- sonolus/backend/{constant_evaluation.py → optimize/constant_evaluation.py} +7 -7
- sonolus/backend/{coalesce.py → optimize/copy_coalesce.py} +3 -3
- sonolus/backend/optimize/dead_code.py +185 -0
- sonolus/backend/{dominance.py → optimize/dominance.py} +2 -17
- sonolus/backend/{flow.py → optimize/flow.py} +6 -5
- sonolus/backend/{inlining.py → optimize/inlining.py} +4 -17
- sonolus/backend/{liveness.py → optimize/liveness.py} +69 -65
- sonolus/backend/optimize/optimize.py +44 -0
- sonolus/backend/{passes.py → optimize/passes.py} +1 -1
- sonolus/backend/optimize/simplify.py +191 -0
- sonolus/backend/{ssa.py → optimize/ssa.py} +31 -18
- sonolus/backend/place.py +17 -25
- sonolus/backend/utils.py +10 -0
- sonolus/backend/visitor.py +360 -101
- sonolus/build/compile.py +8 -8
- sonolus/build/engine.py +10 -5
- sonolus/script/archetype.py +419 -137
- sonolus/script/array.py +25 -8
- sonolus/script/array_like.py +297 -0
- sonolus/script/bucket.py +73 -11
- sonolus/script/containers.py +234 -51
- sonolus/script/debug.py +8 -8
- sonolus/script/easing.py +147 -105
- sonolus/script/effect.py +60 -0
- sonolus/script/engine.py +71 -4
- sonolus/script/globals.py +66 -32
- sonolus/script/instruction.py +79 -25
- sonolus/script/internal/builtin_impls.py +138 -27
- sonolus/script/internal/constant.py +139 -0
- sonolus/script/internal/context.py +14 -5
- sonolus/script/internal/dict_impl.py +65 -0
- sonolus/script/internal/generic.py +6 -9
- sonolus/script/internal/impl.py +38 -13
- sonolus/script/internal/introspection.py +5 -2
- sonolus/script/{math.py → internal/math_impls.py} +28 -28
- sonolus/script/internal/native.py +3 -3
- sonolus/script/internal/random.py +67 -0
- sonolus/script/internal/range.py +81 -0
- sonolus/script/internal/transient.py +51 -0
- sonolus/script/internal/tuple_impl.py +113 -0
- sonolus/script/interval.py +234 -16
- sonolus/script/iterator.py +120 -167
- sonolus/script/level.py +24 -0
- sonolus/script/num.py +79 -47
- sonolus/script/options.py +78 -12
- sonolus/script/particle.py +37 -4
- sonolus/script/pointer.py +4 -4
- sonolus/script/print.py +22 -1
- sonolus/script/project.py +8 -0
- sonolus/script/{graphics.py → quad.py} +75 -12
- sonolus/script/record.py +44 -13
- sonolus/script/runtime.py +50 -1
- sonolus/script/sprite.py +197 -112
- sonolus/script/text.py +2 -0
- sonolus/script/timing.py +72 -0
- sonolus/script/transform.py +296 -66
- sonolus/script/ui.py +134 -78
- sonolus/script/values.py +6 -13
- sonolus/script/vec.py +118 -3
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/METADATA +1 -1
- sonolus_py-0.1.5.dist-info/RECORD +89 -0
- sonolus/backend/dead_code.py +0 -80
- sonolus/backend/optimize.py +0 -37
- sonolus/backend/simplify.py +0 -47
- sonolus/script/comptime.py +0 -160
- sonolus/script/random.py +0 -14
- sonolus/script/range.py +0 -58
- sonolus_py-0.1.4.dist-info/RECORD +0 -84
- /sonolus/script/{callbacks.py → internal/callbacks.py} +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/WHEEL +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/entry_points.txt +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/licenses/LICENSE +0 -0
sonolus/build/compile.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
|
|
3
3
|
from sonolus.backend.finalize import cfg_to_engine_node
|
|
4
|
-
from sonolus.backend.flow import BasicBlock
|
|
5
4
|
from sonolus.backend.ir import IRConst, IRInstr
|
|
6
5
|
from sonolus.backend.mode import Mode
|
|
7
6
|
from sonolus.backend.ops import Op
|
|
8
|
-
from sonolus.backend.optimize import
|
|
7
|
+
from sonolus.backend.optimize.flow import BasicBlock
|
|
8
|
+
from sonolus.backend.optimize.optimize import optimize_and_allocate
|
|
9
9
|
from sonolus.backend.visitor import compile_and_call
|
|
10
10
|
from sonolus.build.node import OutputNodeGenerator
|
|
11
|
-
from sonolus.script.archetype import
|
|
12
|
-
from sonolus.script.callbacks import CallbackInfo
|
|
11
|
+
from sonolus.script.archetype import _BaseArchetype
|
|
12
|
+
from sonolus.script.internal.callbacks import CallbackInfo
|
|
13
13
|
from sonolus.script.internal.context import (
|
|
14
14
|
CallbackContextState,
|
|
15
15
|
Context,
|
|
@@ -19,13 +19,13 @@ from sonolus.script.internal.context import (
|
|
|
19
19
|
ctx,
|
|
20
20
|
using_ctx,
|
|
21
21
|
)
|
|
22
|
-
from sonolus.script.num import
|
|
22
|
+
from sonolus.script.num import _is_num
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def compile_mode(
|
|
26
26
|
mode: Mode,
|
|
27
27
|
rom: ReadOnlyMemory,
|
|
28
|
-
archetypes: list[type[
|
|
28
|
+
archetypes: list[type[_BaseArchetype]] | None,
|
|
29
29
|
global_callbacks: list[tuple[CallbackInfo, Callable]] | None,
|
|
30
30
|
) -> dict:
|
|
31
31
|
global_state = GlobalContextState(
|
|
@@ -74,7 +74,7 @@ def compile_mode(
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
def callback_to_cfg(
|
|
77
|
-
global_state: GlobalContextState, callback: Callable, name: str, archetype: type[
|
|
77
|
+
global_state: GlobalContextState, callback: Callable, name: str, archetype: type[_BaseArchetype] | None = None
|
|
78
78
|
) -> BasicBlock:
|
|
79
79
|
callback_state = CallbackContextState(name)
|
|
80
80
|
context = Context(global_state, callback_state)
|
|
@@ -83,6 +83,6 @@ def callback_to_cfg(
|
|
|
83
83
|
result = compile_and_call(callback, archetype._for_compilation())
|
|
84
84
|
else:
|
|
85
85
|
result = compile_and_call(callback)
|
|
86
|
-
if
|
|
86
|
+
if _is_num(result):
|
|
87
87
|
ctx().add_statements(IRInstr(Op.Break, [IRConst(1), result.ir()]))
|
|
88
88
|
return context_to_cfg(context)
|
sonolus/build/engine.py
CHANGED
|
@@ -7,15 +7,20 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
from sonolus.backend.mode import Mode
|
|
9
9
|
from sonolus.build.compile import compile_mode
|
|
10
|
-
from sonolus.script.archetype import
|
|
10
|
+
from sonolus.script.archetype import _BaseArchetype
|
|
11
11
|
from sonolus.script.bucket import Buckets
|
|
12
|
-
from sonolus.script.callbacks import navigate_callback, preprocess_callback, update_callback, update_spawn_callback
|
|
13
12
|
from sonolus.script.effect import Effects
|
|
14
13
|
from sonolus.script.engine import EngineData
|
|
15
14
|
from sonolus.script.instruction import (
|
|
16
15
|
TutorialInstructionIcons,
|
|
17
16
|
TutorialInstructions,
|
|
18
17
|
)
|
|
18
|
+
from sonolus.script.internal.callbacks import (
|
|
19
|
+
navigate_callback,
|
|
20
|
+
preprocess_callback,
|
|
21
|
+
update_callback,
|
|
22
|
+
update_spawn_callback,
|
|
23
|
+
)
|
|
19
24
|
from sonolus.script.internal.context import ReadOnlyMemory
|
|
20
25
|
from sonolus.script.options import Options
|
|
21
26
|
from sonolus.script.particle import Particles
|
|
@@ -101,7 +106,7 @@ def build_engine_configuration(
|
|
|
101
106
|
|
|
102
107
|
|
|
103
108
|
def build_play_mode(
|
|
104
|
-
archetypes: list[type[
|
|
109
|
+
archetypes: list[type[_BaseArchetype]],
|
|
105
110
|
skin: Skin,
|
|
106
111
|
effects: Effects,
|
|
107
112
|
particles: Particles,
|
|
@@ -118,7 +123,7 @@ def build_play_mode(
|
|
|
118
123
|
|
|
119
124
|
|
|
120
125
|
def build_watch_mode(
|
|
121
|
-
archetypes: list[type[
|
|
126
|
+
archetypes: list[type[_BaseArchetype]],
|
|
122
127
|
skin: Skin,
|
|
123
128
|
effects: Effects,
|
|
124
129
|
particles: Particles,
|
|
@@ -138,7 +143,7 @@ def build_watch_mode(
|
|
|
138
143
|
|
|
139
144
|
|
|
140
145
|
def build_preview_mode(
|
|
141
|
-
archetypes: list[type[
|
|
146
|
+
archetypes: list[type[_BaseArchetype]],
|
|
142
147
|
skin: Skin,
|
|
143
148
|
rom: ReadOnlyMemory,
|
|
144
149
|
):
|