Do not try to inline PPCPluggableNode on Smalltalk/X
Sadly, on Smalltalk/X blocks cannot be inlined because
the VM does not provide enough information to map it back
to the source code. Very bad indeed!
--- a/compiler/PPCPluggableNode.st Thu Nov 06 01:41:10 2014 +0000
+++ b/compiler/PPCPluggableNode.st Thu Nov 06 02:22:56 2014 +0000
@@ -30,10 +30,20 @@
!
asInlined
- ^ PPCInlinePluggableNode new
- name: name;
- block: block;
- yourself
+ "Sadly, on Smalltalk/X blocks cannot be inlined because
+ the VM does not provide enough information to map
+ it back to source code. Very bad indeed!!"
+
+ ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[
+ ^ super asInlined
+ ] ifFalse:[
+ ^ PPCInlinePluggableNode new
+ name: name;
+ block: block;
+ yourself
+ ]
+
+ "Modified: / 06-11-2014 / 01:46:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compileWith: compiler effect: effect id: id
--- a/compiler/tests/PPCNodeCompilingTest.st Thu Nov 06 01:41:10 2014 +0000
+++ b/compiler/tests/PPCNodeCompilingTest.st Thu Nov 06 02:22:56 2014 +0000
@@ -498,15 +498,22 @@
!
testInlinePluggable
+ "Sadly, on Smalltalk/X blocks cannot be inlined because
+ the VM does not provide enough information to map
+ it back to source code. Very bad indeed!!"
+ ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[
+ self skipIf: true description: 'Blocks cannot be inlined due to a lack of proper VM support'.
+ ].
+
tree := PPCSequenceNode new
- children: { PPCInlinePluggableNode new block: [ :ctx | tree. ctx next ]. $a asParser asCompilerNode }.
+ children: { PPCInlinePluggableNode new block: [ :ctx | ctx next ]. $a asParser asCompilerNode }.
parser := self compileTree: tree.
self assert: parser class methodDictionary size = 3.
self assert: parser parse: 'ba' to: #($b $a).
- "Modified: / 06-11-2014 / 01:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-11-2014 / 01:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!PPCNodeCompilingTest class methodsFor:'documentation'!