Fix debug info w.r.t inlined blocks jv
authorJan Vrany <jan.vrany@labware.com>
Wed, 03 Feb 2021 11:50:00 +0000
branchjv
changeset 4659 6d7cc8f5c2d8
parent 4658 9f2d1e57bdd5
child 4660 ded36b294a2a
Fix debug info w.r.t inlined blocks It turned out that even if `BlockNode >> isInlinable` returns `true`, the block can still be full block (that is, NOT inlined). This lead to wrong debug info being generated, marking some variables as inlined even though they were not. To workaround this, introduce a new `BlockNode >> #isInlined` that returns true whether or not the block was inlined during compilation. This should be called (i.e., it is valid) only after code generation. The code to create debug info is then changed to use `#isInlined` instead of `#isInlinable`.
BlockNode.st
--- a/BlockNode.st	Thu Dec 17 12:32:31 2020 +0000
+++ b/BlockNode.st	Wed Feb 03 11:50:00 2021 +0000
@@ -1,7 +1,7 @@
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
  COPYRIGHT (c) 2015-2016 Jan Vrany
- COPYRIGHT (c) 2020 LabWare
+ COPYRIGHT (c) 2020-2021 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -32,7 +32,7 @@
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
  COPYRIGHT (c) 2015-2016 Jan Vrany
- COPYRIGHT (c) 2020 LabWare
+ COPYRIGHT (c) 2020-2021 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -462,6 +462,9 @@
 codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
     |thisStatement nextStatement tmpIndex firstTempIndex codeBlock subAccess|
 
+    "/ mark the node that is HAS been inlined:
+    inlined := true.  
+
     blockVars notNil ifTrue:[
         "/ have to move blockvars into surrounding context
 
@@ -567,7 +570,8 @@
         ].    
     ].
 
-    "Modified: 30.7.1997 / 12:21:07 / cg"
+    "Modified: / 30-07-1997 / 12:21:07 / cg"
+    "Modified: / 03-02-2021 / 08:51:32 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 codeOn:aStream inBlock:b for:aCompiler
@@ -591,6 +595,9 @@
         self codeSourcePosition: startPosition on: aStream for: aCompiler.
     ].
 
+    "/ mark the node that is has NOT been inlined:
+    inlined := false.
+
     pos := aStream position.
 
     aStream nextPut:#makeBlock.                                 "+0"
@@ -627,6 +634,7 @@
 
     "Modified: / 26-06-1997 / 10:48:56 / cg"
     "Modified: / 05-05-2016 / 00:13:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-02-2021 / 08:50:41 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !BlockNode methodsFor:'code generation helpers'!
@@ -664,13 +672,13 @@
     
     | base physical |
 
-    self isInlinable ifTrue:[
+    self isInlined ifTrue:[
         | h |
 
         base := self indexOfFirstTemp.
         h := self.
         [
-            h notNil and:[ h isInlinable ]
+            h notNil and:[ h isInlined ]
         ] whileTrue:[ h := h home ].
         h notNil ifTrue:[
             physical := h.
@@ -717,7 +725,7 @@
 
     "Created: / 15-07-2018 / 15:10:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 06-02-2019 / 22:28:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 09-06-2020 / 14:30:45 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 03-02-2021 / 08:52:03 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !BlockNode methodsFor:'enumerating'!
@@ -1126,6 +1134,15 @@
     "Modified: 2.7.1997 / 18:55:36 / cg"
 !
 
+isInlined
+    "Return `true`, if block has been inlined, `false` otherwise.
+     This valid only after #codeOn... has been called!!"
+
+    ^ inlined == true
+
+    "Created: / 03-02-2021 / 08:48:08 / Jan Vrany <jan.vrany@labware.com>"
+!
+
 numArgs
     "return the number of arguments the block represented by myself
      expects for evaluation.