Skip to content

Commit 2dcdd05

Browse files
committed
Remove all support for inlining
Signed-off-by: Stefan Marr <[email protected]>
1 parent b7acae5 commit 2dcdd05

20 files changed

+0
-2647
lines changed

src/som/compiler/ast/parser.py

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717
from som.interpreter.ast.nodes.return_non_local_node import ReturnNonLocalNode
1818
from som.interpreter.ast.nodes.sequence_node import SequenceNode
1919
from som.interpreter.ast.nodes.specialized.int_inc_node import IntIncrementNode
20-
from som.interpreter.ast.nodes.specialized.literal_and_or import (
21-
AndInlinedNode,
22-
OrInlinedNode,
23-
)
24-
from som.interpreter.ast.nodes.specialized.literal_if import (
25-
IfInlinedNode,
26-
IfElseInlinedNode,
27-
)
28-
from som.interpreter.ast.nodes.specialized.literal_while import WhileInlinedNode
2920
from som.vm.symbols import symbol_for
3021

3122
from som.vmobjects.array import Array
@@ -205,17 +196,6 @@ def _binary_message(self, mgenc, receiver):
205196

206197
source = self._get_source_section(coord)
207198

208-
if not is_super_send:
209-
sel = selector.get_embedded_string()
210-
if sel == "&&":
211-
inlined = self._try_inlining_and(receiver, arg_expr, source, mgenc)
212-
if inlined is not None:
213-
return inlined
214-
elif sel == "||":
215-
inlined = self._try_inlining_or(receiver, arg_expr, source, mgenc)
216-
if inlined is not None:
217-
return inlined
218-
219199
if is_super_send:
220200
return BinarySuper(
221201
selector, receiver, arg_expr, mgenc.holder.get_super_class(), source
@@ -239,58 +219,6 @@ def _binary_operand(self, mgenc):
239219

240220
return operand
241221

242-
@staticmethod
243-
def _try_inlining_if(if_true, receiver, arguments, source, mgenc):
244-
arg = arguments[0]
245-
if not isinstance(arg, BlockNode):
246-
return None
247-
248-
method = arg.get_method()
249-
body_expr = method.inline(mgenc)
250-
return IfInlinedNode(receiver, body_expr, if_true, source)
251-
252-
@staticmethod
253-
def _try_inlining_if_else(if_true, receiver, arguments, source, mgenc):
254-
arg1 = arguments[0]
255-
if not isinstance(arg1, BlockNode):
256-
return None
257-
258-
arg2 = arguments[1]
259-
if not isinstance(arg2, BlockNode):
260-
return None
261-
262-
true_expr = arg1.get_method().inline(mgenc)
263-
false_expr = arg2.get_method().inline(mgenc)
264-
return IfElseInlinedNode(receiver, true_expr, false_expr, if_true, source)
265-
266-
@staticmethod
267-
def _try_inlining_while(while_true, receiver, arguments, source, mgenc):
268-
if not isinstance(receiver, BlockNode):
269-
return None
270-
271-
if not isinstance(arguments[0], BlockNode):
272-
return None
273-
274-
cond_expr = receiver.get_method().inline(mgenc)
275-
body_expr = arguments[0].get_method().inline(mgenc)
276-
return WhileInlinedNode(cond_expr, body_expr, while_true, source)
277-
278-
@staticmethod
279-
def _try_inlining_and(receiver, arg_expr, source, mgenc):
280-
if not isinstance(arg_expr, BlockNode):
281-
return None
282-
283-
arg_body = arg_expr.get_method().inline(mgenc)
284-
return AndInlinedNode(receiver, arg_body, source)
285-
286-
@staticmethod
287-
def _try_inlining_or(receiver, arg_expr, source, mgenc):
288-
if not isinstance(arg_expr, BlockNode):
289-
return None
290-
291-
arg_body = arg_expr.get_method().inline(mgenc)
292-
return OrInlinedNode(receiver, arg_body, source)
293-
294222
def _keyword_message(self, mgenc, receiver):
295223
is_super_send = self._super_send
296224

@@ -303,61 +231,6 @@ def _keyword_message(self, mgenc, receiver):
303231
arguments.append(self._formula(mgenc))
304232

305233
keyword = "".join(keyword_parts)
306-
source = self._get_source_section(coord)
307-
308-
num_args = len(arguments)
309-
310-
if not is_super_send:
311-
if num_args == 1:
312-
if keyword == "ifTrue:":
313-
inlined = self._try_inlining_if(
314-
True, receiver, arguments, source, mgenc
315-
)
316-
if inlined is not None:
317-
return inlined
318-
elif keyword == "ifFalse:":
319-
inlined = self._try_inlining_if(
320-
False, receiver, arguments, source, mgenc
321-
)
322-
if inlined is not None:
323-
return inlined
324-
elif keyword == "whileTrue:":
325-
inlined = self._try_inlining_while(
326-
True, receiver, arguments, source, mgenc
327-
)
328-
if inlined is not None:
329-
return inlined
330-
elif keyword == "whileFalse:":
331-
inlined = self._try_inlining_while(
332-
False, receiver, arguments, source, mgenc
333-
)
334-
if inlined is not None:
335-
return inlined
336-
elif keyword == "and:":
337-
inlined = self._try_inlining_and(
338-
receiver, arguments[0], source, mgenc
339-
)
340-
if inlined is not None:
341-
return inlined
342-
elif keyword == "or:":
343-
inlined = self._try_inlining_or(
344-
receiver, arguments[0], source, mgenc
345-
)
346-
if inlined is not None:
347-
return inlined
348-
elif num_args == 2:
349-
if keyword == "ifTrue:ifFalse:":
350-
inlined = self._try_inlining_if_else(
351-
True, receiver, arguments, source, mgenc
352-
)
353-
if inlined is not None:
354-
return inlined
355-
elif keyword == "ifFalse:ifTrue:":
356-
inlined = self._try_inlining_if_else(
357-
False, receiver, arguments, source, mgenc
358-
)
359-
if inlined is not None:
360-
return inlined
361234

362235
selector = symbol_for(keyword)
363236

src/som/compiler/ast/variable.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,10 @@ def get_initialized_read_node(self, context_level, source_section):
144144
return LocalFrameVarReadNode(FRAME_AND_INNER_RCVR_IDX, source_section)
145145
return _Variable.get_initialized_read_node(self, context_level, source_section)
146146

147-
def copy_for_inlining(self, idx):
148-
if self._name == "$blockSelf":
149-
return None
150-
return Argument(self._name, idx, self.source)
151-
152147
def __str__(self):
153148
return "Argument(" + self._name + " idx: " + str(self.idx) + ")"
154149

155150

156151
class Local(_Variable):
157-
def copy_for_inlining(self, idx):
158-
return Local(self._name, idx, self.source)
159-
160152
def __str__(self):
161153
return "Local(" + self._name + " idx: " + str(self.idx) + ")"

0 commit comments

Comments
 (0)