Compiler-Inlining.st 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. Smalltalk createPackage: 'Compiler-Inlining'!
  2. NodeVisitor subclass: #ASTPreInliner
  3. slots: {}
  4. package: 'Compiler-Inlining'!
  5. !ASTPreInliner methodsFor: 'visiting'!
  6. visitSendNode: aNode
  7. aNode superSend ifFalse: [
  8. (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [
  9. aNode shouldBeAliased: true.
  10. aNode receiver ifNotNil: [ :receiver |
  11. (IRSendInliner inlinedSelectorsNeedingIdempotentReceiver includes: aNode selector) ifTrue: [
  12. receiver shouldBeAliased: true ] ] ] ].
  13. ^ super visitSendNode: aNode
  14. ! !
  15. IRClosure subclass: #IRInlinedClosure
  16. slots: {}
  17. package: 'Compiler-Inlining'!
  18. !IRInlinedClosure commentStamp!
  19. I represent an inlined closure instruction.!
  20. !IRInlinedClosure methodsFor: 'testing'!
  21. isInlined
  22. ^ true
  23. ! !
  24. !IRInlinedClosure methodsFor: 'visiting'!
  25. acceptDagVisitor: aVisitor
  26. aVisitor visitIRInlinedClosure: self
  27. ! !
  28. IRSend subclass: #IRInlinedSend
  29. slots: {}
  30. package: 'Compiler-Inlining'!
  31. !IRInlinedSend commentStamp!
  32. I am the abstract super class of inlined message send instructions.!
  33. !IRInlinedSend methodsFor: 'accessing'!
  34. internalVariables
  35. "Answer a collection of internal variables required
  36. to perform the inlining"
  37. ^ #()
  38. ! !
  39. !IRInlinedSend methodsFor: 'testing'!
  40. isInlined
  41. ^ true
  42. ! !
  43. !IRInlinedSend methodsFor: 'visiting'!
  44. acceptDagVisitor: aVisitor
  45. aVisitor visitInlinedSend: self
  46. ! !
  47. IRInlinedSend subclass: #IRInlinedIfFalse
  48. slots: {}
  49. package: 'Compiler-Inlining'!
  50. !IRInlinedIfFalse commentStamp!
  51. I represent an inlined `#ifFalse:` message send instruction.!
  52. !IRInlinedIfFalse methodsFor: 'visiting'!
  53. acceptDagVisitor: aVisitor
  54. aVisitor visitIRInlinedIfFalse: self
  55. ! !
  56. IRInlinedSend subclass: #IRInlinedIfNilIfNotNil
  57. slots: {}
  58. package: 'Compiler-Inlining'!
  59. !IRInlinedIfNilIfNotNil commentStamp!
  60. I represent an inlined `#ifNil:ifNotNil:` message send instruction.!
  61. !IRInlinedIfNilIfNotNil methodsFor: 'visiting'!
  62. acceptDagVisitor: aVisitor
  63. aVisitor visitIRInlinedIfNilIfNotNil: self
  64. ! !
  65. IRInlinedSend subclass: #IRInlinedIfTrue
  66. slots: {}
  67. package: 'Compiler-Inlining'!
  68. !IRInlinedIfTrue commentStamp!
  69. I represent an inlined `#ifTrue:` message send instruction.!
  70. !IRInlinedIfTrue methodsFor: 'visiting'!
  71. acceptDagVisitor: aVisitor
  72. aVisitor visitIRInlinedIfTrue: self
  73. ! !
  74. IRInlinedSend subclass: #IRInlinedIfTrueIfFalse
  75. slots: {}
  76. package: 'Compiler-Inlining'!
  77. !IRInlinedIfTrueIfFalse commentStamp!
  78. I represent an inlined `#ifTrue:ifFalse:` message send instruction.!
  79. !IRInlinedIfTrueIfFalse methodsFor: 'visiting'!
  80. acceptDagVisitor: aVisitor
  81. aVisitor visitIRInlinedIfTrueIfFalse: self
  82. ! !
  83. IRBlockSequence subclass: #IRInlinedSequence
  84. slots: {}
  85. package: 'Compiler-Inlining'!
  86. !IRInlinedSequence commentStamp!
  87. I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).!
  88. !IRInlinedSequence methodsFor: 'testing'!
  89. isInlined
  90. ^ true
  91. ! !
  92. !IRInlinedSequence methodsFor: 'visiting'!
  93. acceptDagVisitor: aVisitor
  94. aVisitor visitIRInlinedSequence: self
  95. ! !
  96. IRVisitor subclass: #IRInliner
  97. slots: {}
  98. package: 'Compiler-Inlining'!
  99. !IRInliner commentStamp!
  100. I visit an IR tree, inlining message sends and block closures.
  101. Message selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`!
  102. !IRInliner methodsFor: 'factory'!
  103. assignmentInliner
  104. ^ IRAssignmentInliner new
  105. translator: self;
  106. yourself
  107. !
  108. nonLocalReturnInliner
  109. ^ IRNonLocalReturnInliner new
  110. translator: self;
  111. yourself
  112. !
  113. returnInliner
  114. ^ IRReturnInliner new
  115. translator: self;
  116. yourself
  117. !
  118. sendInliner
  119. ^ IRSendInliner new
  120. translator: self;
  121. yourself
  122. ! !
  123. !IRInliner methodsFor: 'testing'!
  124. shouldInlineAssignment: anIRAssignment
  125. ^ anIRAssignment isInlined not and: [
  126. anIRAssignment right isSend and: [
  127. self shouldInlineSend: anIRAssignment right ]]
  128. !
  129. shouldInlineReturn: anIRReturn
  130. ^ anIRReturn isInlined not and: [
  131. anIRReturn expression isSend and: [
  132. self shouldInlineSend: anIRReturn expression ]]
  133. !
  134. shouldInlineSend: anIRSend
  135. ^ anIRSend isInlined not and: [
  136. IRSendInliner shouldInline: anIRSend ]
  137. ! !
  138. !IRInliner methodsFor: 'visiting'!
  139. flattenedReturn: anIRNonLocalReturn
  140. | localReturn |
  141. localReturn := IRReturn new
  142. scope: anIRNonLocalReturn scope;
  143. yourself.
  144. anIRNonLocalReturn dagChildren do: [ :each | localReturn add: each ].
  145. ^ localReturn
  146. !
  147. visitIRAssignment: anIRAssignment
  148. ^ (self shouldInlineAssignment: anIRAssignment)
  149. ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]
  150. ifFalse: [ super visitIRAssignment: anIRAssignment ]
  151. !
  152. visitIRNonLocalReturn: anIRNonLocalReturn
  153. anIRNonLocalReturn scope canFlattenNonLocalReturns ifTrue: [
  154. | localReturn |
  155. anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.
  156. localReturn := self flattenedReturn: anIRNonLocalReturn.
  157. anIRNonLocalReturn replaceWith: localReturn.
  158. ^ self visitIRReturn: localReturn ].
  159. ^ (self shouldInlineReturn: anIRNonLocalReturn)
  160. ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]
  161. ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]
  162. !
  163. visitIRReturn: anIRReturn
  164. ^ (self shouldInlineReturn: anIRReturn)
  165. ifTrue: [ self returnInliner inlineReturn: anIRReturn ]
  166. ifFalse: [ super visitIRReturn: anIRReturn ]
  167. !
  168. visitIRSend: anIRSend
  169. ^ (self shouldInlineSend: anIRSend)
  170. ifTrue: [ self sendInliner inlineSend: anIRSend ]
  171. ifFalse: [ super visitIRSend: anIRSend ]
  172. ! !
  173. IRJSTranslator subclass: #IRInliningJSTranslator
  174. slots: {}
  175. package: 'Compiler-Inlining'!
  176. !IRInliningJSTranslator commentStamp!
  177. I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).!
  178. !IRInliningJSTranslator methodsFor: 'visiting'!
  179. visitIRInlinedClosure: anIRInlinedClosure
  180. self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |
  181. each name asVariableName ]).
  182. self visitAllChildren: anIRInlinedClosure
  183. !
  184. visitIRInlinedIfFalse: anIRInlinedIfFalse
  185. self stream nextPutIf: [
  186. self stream nextPutAll: '!!$core.assert('.
  187. self visit: anIRInlinedIfFalse dagChildren first.
  188. self stream nextPutAll: ')' ]
  189. then: [ self visit: anIRInlinedIfFalse dagChildren last ]
  190. !
  191. visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil
  192. self stream
  193. nextPutIf: [
  194. self visit: anIRInlinedIfNilIfNotNil dagChildren first.
  195. self stream nextPutAll: ' == null || '.
  196. self visit: anIRInlinedIfNilIfNotNil dagChildren first.
  197. self stream nextPutAll: '.a$nil' ]
  198. then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]
  199. else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]
  200. !
  201. visitIRInlinedIfTrue: anIRInlinedIfTrue
  202. self stream nextPutIf: [
  203. self stream nextPutAll: '$core.assert('.
  204. self visit: anIRInlinedIfTrue dagChildren first.
  205. self stream nextPutAll: ')' ]
  206. then: [ self visit: anIRInlinedIfTrue dagChildren last ]
  207. !
  208. visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse
  209. self stream
  210. nextPutIf: [
  211. self stream nextPutAll: '$core.assert('.
  212. self visit: anIRInlinedIfTrueIfFalse dagChildren first.
  213. self stream nextPutAll: ')' ]
  214. then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]
  215. else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]
  216. ! !
  217. Object subclass: #IRSendInliner
  218. slots: {#send. #translator}
  219. package: 'Compiler-Inlining'!
  220. !IRSendInliner commentStamp!
  221. I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.!
  222. !IRSendInliner methodsFor: 'accessing'!
  223. send
  224. ^ send
  225. !
  226. send: anIRSend
  227. send := anIRSend
  228. !
  229. translator
  230. ^ translator
  231. !
  232. translator: anASTTranslator
  233. translator := anASTTranslator
  234. ! !
  235. !IRSendInliner methodsFor: 'error handling'!
  236. inliningError: aString
  237. InliningError signal: aString
  238. ! !
  239. !IRSendInliner methodsFor: 'factory'!
  240. inlinedClosure
  241. ^ IRInlinedClosure new
  242. !
  243. inlinedSequence
  244. ^ IRInlinedSequence new
  245. ! !
  246. !IRSendInliner methodsFor: 'inlining'!
  247. and: anIRInstruction
  248. self mustBeNiladicClosure: anIRInstruction.
  249. ^ self
  250. inlinedSend: IRInlinedIfTrueIfFalse new
  251. withBlock: anIRInstruction
  252. withBlock: (IRClosure new
  253. scope: anIRInstruction scope copy;
  254. add: (IRBlockSequence new
  255. add: (IRValue new value: false; yourself);
  256. yourself);
  257. yourself)
  258. !
  259. ifFalse: anIRInstruction
  260. self mustBeNiladicClosure: anIRInstruction.
  261. ^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction
  262. !
  263. ifFalse: anIRInstruction ifTrue: anotherIRInstruction
  264. self mustBeNiladicClosure: anIRInstruction.
  265. self mustBeNiladicClosure: anotherIRInstruction.
  266. ^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anotherIRInstruction withBlock: anIRInstruction
  267. !
  268. ifNil: anIRInstruction
  269. self mustBeNiladicClosure: anIRInstruction.
  270. ^ self
  271. inlinedSend: IRInlinedIfNilIfNotNil new
  272. withBlock: anIRInstruction
  273. withBlock: (IRClosure new
  274. scope: anIRInstruction scope copy;
  275. add: (IRBlockSequence new
  276. add: self send receiver;
  277. yourself);
  278. yourself)
  279. !
  280. ifNil: anIRInstruction ifNotNil: anotherIRInstruction
  281. self mustBeNiladicClosure: anIRInstruction.
  282. self mustBeNiladicOrUnaryClosure: anotherIRInstruction.
  283. ^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction
  284. !
  285. ifNotNil: anIRInstruction
  286. self mustBeNiladicOrUnaryClosure: anIRInstruction.
  287. ^ self
  288. inlinedSend: IRInlinedIfNilIfNotNil new
  289. withBlock: (IRClosure new
  290. scope: anIRInstruction scope copy;
  291. add: (IRBlockSequence new
  292. add: self send receiver;
  293. yourself);
  294. yourself)
  295. withBlock: anIRInstruction
  296. !
  297. ifNotNil: anIRInstruction ifNil: anotherIRInstruction
  298. self mustBeNiladicOrUnaryClosure: anIRInstruction.
  299. self mustBeNiladicClosure: anotherIRInstruction.
  300. ^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction
  301. !
  302. ifTrue: anIRInstruction
  303. self mustBeNiladicClosure: anIRInstruction.
  304. ^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction
  305. !
  306. ifTrue: anIRInstruction ifFalse: anotherIRInstruction
  307. self mustBeNiladicClosure: anIRInstruction.
  308. self mustBeNiladicClosure: anotherIRInstruction.
  309. ^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction
  310. !
  311. inlineClosure: anIRClosure
  312. | inlinedClosure sequence statements |
  313. inlinedClosure := self inlinedClosure.
  314. inlinedClosure
  315. scope: anIRClosure scope;
  316. parent: anIRClosure parent.
  317. "Add the possible temp declarations"
  318. anIRClosure tempDeclarations do: [ :each |
  319. inlinedClosure add: each ].
  320. "Add a block sequence"
  321. sequence := self inlinedSequence.
  322. "Map the closure arguments to the receiver of the message send"
  323. anIRClosure arguments do: [ :each |
  324. inlinedClosure add: (IRTempDeclaration new name: each; yourself).
  325. sequence add: (IRAssignment new
  326. add: (IRVariable new variable: (ArgVar new scope: inlinedClosure scope; name: each; yourself));
  327. add: self send receiver;
  328. yourself) ].
  329. "To ensure the correct order of the closure instructions: first the temps then the sequence"
  330. inlinedClosure add: sequence.
  331. "Get all the statements"
  332. statements := anIRClosure sequence dagChildren.
  333. statements ifNotEmpty: [
  334. statements allButLast do: [ :each | sequence add: each ].
  335. "Inlined closures change local returns into result value itself"
  336. sequence add: statements last asInlinedBlockResult ].
  337. ^ inlinedClosure
  338. !
  339. inlineSend: anIRSend
  340. self send: anIRSend.
  341. ^ self
  342. perform: self send selector
  343. withArguments: self send arguments
  344. !
  345. inlinedClosure: closure wrapFinalValueIn: aBlock
  346. | sequence final |
  347. sequence := closure sequence.
  348. sequence dagChildren ifEmpty: [ sequence add: (IRVariable new
  349. variable: (closure scope pseudoVars at: 'nil');
  350. yourself) ].
  351. final := sequence dagChildren last.
  352. final yieldsValue ifTrue: [ sequence replace: final with: (aBlock value: final) ].
  353. ^ closure
  354. !
  355. or: anIRInstruction
  356. self mustBeNiladicClosure: anIRInstruction.
  357. ^ self
  358. inlinedSend: IRInlinedIfTrueIfFalse new
  359. withBlock: (IRClosure new
  360. scope: anIRInstruction scope copy;
  361. add: (IRBlockSequence new
  362. add: (IRValue new value: true; yourself);
  363. yourself);
  364. yourself)
  365. withBlock: anIRInstruction
  366. ! !
  367. !IRSendInliner methodsFor: 'private'!
  368. inlineSend: anIRSend andReplace: anIRInstruction
  369. anIRInstruction replaceWith: anIRSend.
  370. ^ self inlineSend: anIRSend
  371. !
  372. inlinedSend: inlinedSend withBlock: anIRInstruction
  373. | inlinedClosure |
  374. inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).
  375. inlinedSend
  376. add: self send receiver;
  377. add: inlinedClosure.
  378. self send replaceWith: inlinedSend.
  379. inlinedSend method internalVariables
  380. addAll: inlinedSend internalVariables.
  381. ^ inlinedSend
  382. !
  383. inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction
  384. | inlinedClosure1 inlinedClosure2 |
  385. inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).
  386. inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).
  387. inlinedSend
  388. add: self send receiver;
  389. add: inlinedClosure1;
  390. add: inlinedClosure2.
  391. self send replaceWith: inlinedSend.
  392. inlinedSend method internalVariables
  393. addAll: inlinedSend internalVariables.
  394. ^ inlinedSend
  395. ! !
  396. !IRSendInliner methodsFor: 'testing'!
  397. mustBeNiladicClosure: anIRInstruction
  398. anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].
  399. anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ]
  400. !
  401. mustBeNiladicOrUnaryClosure: anIRInstruction
  402. anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].
  403. anIRInstruction arguments size <= 1 ifFalse: [ self inliningError: 'Inlined block should have at most one argument' ]
  404. ! !
  405. !IRSendInliner class methodsFor: 'accessing'!
  406. inlinedSelectors
  407. ^ #(
  408. ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue:
  409. ifNil: ifNotNil: ifNil:ifNotNil: ifNotNil:ifNil:
  410. and: or:
  411. )
  412. !
  413. inlinedSelectorsNeedingIdempotentReceiver
  414. ^ #(
  415. ifNil: ifNotNil: ifNil:ifNotNil: ifNotNil:ifNil:
  416. )
  417. !
  418. shouldInline: anIRSend
  419. ^ (self inlinedSelectors includes: anIRSend selector) and: [
  420. anIRSend receiver isSuper not and: [
  421. anIRSend arguments allSatisfy: [ :each | each isClosure ] ] ]
  422. ! !
  423. IRSendInliner subclass: #IRAssignmentInliner
  424. slots: {#target}
  425. package: 'Compiler-Inlining'!
  426. !IRAssignmentInliner commentStamp!
  427. I inline message sends together with assignments by moving them around into the inline closure instructions.
  428. ##Example
  429. foo
  430. | a |
  431. a := true ifTrue: [ 1 ]
  432. Will produce:
  433. if($core.assert(true) {
  434. a = 1;
  435. };!
  436. !IRAssignmentInliner methodsFor: 'accessing'!
  437. target
  438. ^ target
  439. !
  440. target: anObject
  441. target := anObject
  442. ! !
  443. !IRAssignmentInliner methodsFor: 'inlining'!
  444. inlineAssignment: anIRAssignment
  445. self target: anIRAssignment left.
  446. ^ self inlineSend: anIRAssignment right andReplace: anIRAssignment
  447. !
  448. inlineClosure: anIRClosure
  449. ^ self
  450. inlinedClosure: (super inlineClosure: anIRClosure)
  451. wrapFinalValueIn: [ :final |
  452. IRAssignment new
  453. add: self target;
  454. add: final copy;
  455. yourself ]
  456. ! !
  457. IRSendInliner subclass: #IRNonLocalReturnInliner
  458. slots: {}
  459. package: 'Compiler-Inlining'!
  460. !IRNonLocalReturnInliner commentStamp!
  461. I inline message sends with inlined closure together with a return instruction.!
  462. !IRNonLocalReturnInliner methodsFor: 'inlining'!
  463. inlineClosure: anIRClosure
  464. ^ self
  465. inlinedClosure: (super inlineClosure: anIRClosure)
  466. wrapFinalValueIn: [ :final |
  467. IRNonLocalReturn new
  468. add: final copy;
  469. yourself ]
  470. !
  471. inlineReturn: anIRReturn
  472. ^ self inlineSend: anIRReturn expression andReplace: anIRReturn
  473. ! !
  474. IRSendInliner subclass: #IRReturnInliner
  475. slots: {}
  476. package: 'Compiler-Inlining'!
  477. !IRReturnInliner commentStamp!
  478. I inline message sends with inlined closure together with a return instruction.!
  479. !IRReturnInliner methodsFor: 'inlining'!
  480. inlineClosure: anIRClosure
  481. ^ self
  482. inlinedClosure: (super inlineClosure: anIRClosure)
  483. wrapFinalValueIn: [ :final |
  484. IRReturn new
  485. add: final copy;
  486. yourself ]
  487. !
  488. inlineReturn: anIRReturn
  489. ^ self inlineSend: anIRReturn expression andReplace: anIRReturn
  490. ! !
  491. CodeGenerator subclass: #InliningCodeGenerator
  492. slots: {}
  493. package: 'Compiler-Inlining'!
  494. !InliningCodeGenerator commentStamp!
  495. I am a specialized code generator that uses inlining to produce more optimized JavaScript output!
  496. !InliningCodeGenerator methodsFor: 'compiling'!
  497. inliner
  498. ^ IRInliner new
  499. !
  500. irTranslatorClass
  501. ^ IRInliningJSTranslator
  502. !
  503. preInliner
  504. ^ ASTPreInliner new
  505. !
  506. transformersDictionary
  507. ^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary
  508. at: '3000-inlinerTagging' put: self preInliner;
  509. at: '6000-inliner' put: self inliner;
  510. at: '8000-irToJs' put: self irTranslator;
  511. yourself ]
  512. ! !
  513. SemanticError subclass: #InliningError
  514. slots: {}
  515. package: 'Compiler-Inlining'!
  516. !InliningError commentStamp!
  517. Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.!
  518. Trait named: #TIRInlinedVisitor
  519. package: 'Compiler-Inlining'!
  520. !TIRInlinedVisitor methodsFor: 'visiting'!
  521. visitIRInlinedClosure: anIRInlinedClosure
  522. ^ self visitIRClosure: anIRInlinedClosure
  523. !
  524. visitIRInlinedSequence: anIRInlinedSequence
  525. ^ self visitIRSequence: anIRInlinedSequence
  526. ! !
  527. IRInliner setTraitComposition: {TIRInlinedVisitor} asTraitComposition!
  528. IRInliningJSTranslator setTraitComposition: {TIRInlinedVisitor} asTraitComposition!
  529. ! !
  530. !IRBlockReturn methodsFor: '*Compiler-Inlining'!
  531. asInlinedBlockResult
  532. ^ self expression
  533. ! !
  534. !IRInstruction methodsFor: '*Compiler-Inlining'!
  535. asInlinedBlockResult
  536. ^ self
  537. ! !