ByteCodeCompiler.st
branchjv
changeset 4384 aee25576d864
parent 4275 e06f4b087e47
child 4385 16741aa9dc2e
--- a/ByteCodeCompiler.st	Tue Jul 10 15:59:31 2018 +0100
+++ b/ByteCodeCompiler.st	Sun Jul 15 18:18:34 2018 +0200
@@ -18,7 +18,7 @@
 	instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral
 		maxStackDepth relocList methodTempVars numTemp maxNumTemp
 		methodClass extraOP allLiterals allIdenticalLiterals
-		breakpointedLines currentLineNumber'
+		breakpointedLines currentLineNumber diinfo'
 	classVariableNames:'JumpToAbsJump ShareCode ListCompiledMethods NewCodeSet
 		NewPrimitives'
 	poolDictionaries:''
@@ -2467,7 +2467,8 @@
 
     |codeStream code thisStatement lastStatement|
 
-    litArray := nil.
+    diinfo := DIInfo new.
+    litArray := OrderedCollection with: diinfo.
     codeStream := WriteStream on:(OrderedCollection new:100).
 
     primitiveContextInfo notNil ifTrue:[
@@ -2516,10 +2517,12 @@
         ].
         codeStream nextPut:#retSelf
     ].
+    self genDbgInfo.
     ^ codeStream contents
 
     "Modified: / 15-08-1996 / 17:35:02 / stefan"
     "Modified: / 06-08-2006 / 15:03:14 / cg"
+    "Modified: / 24-07-2018 / 16:06:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 generateVariables:varCollection on:codeStream
@@ -3570,6 +3573,22 @@
     ].
 ! !
 
+!ByteCodeCompiler methodsFor:'debug info'!
+
+genDbgInfo
+    [
+        diinfo addSection: self methodNode dbgVariableTable.
+        litArray at: (litArray indexOf: diinfo) put: diinfo encoding.
+    ] on: AbortOperationRequest do:[:ex | 
+        ^ self
+    ] on: Error do:[:ex |  
+        ex pass.    
+    ]
+
+    "Created: / 14-07-2018 / 19:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-07-2018 / 16:08:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ByteCodeCompiler methodsFor:'error handling'!
 
 codeGeneratorError:aMessage