compiler/PPCCompiler.st
changeset 477 b18b6cc7aabc
parent 476 c45383095de4
child 478 711c8bc1ec04
--- a/compiler/PPCCompiler.st	Fri May 29 07:25:31 2015 +0100
+++ b/compiler/PPCCompiler.st	Mon Jun 01 22:02:17 2015 +0100
@@ -133,12 +133,6 @@
     currentMethod addOnLine: string.
 !
 
-addVariable: name
-    ^ self currentNonInlineMethod addVariable: name
-
-    "Modified: / 23-04-2015 / 17:34:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 call: anotherMethod
     currentMethod add: anotherMethod call.
 !
@@ -252,28 +246,46 @@
     "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+codeProfileStart
+    self add: 'context methodInvoked: #', currentMethod methodName, '.'
+
+    "Created: / 01-06-2015 / 21:17:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeProfileStop
+    self add: 'context methodFinished: #', currentMethod methodName, '.'
+
+    "Created: / 01-06-2015 / 21:19:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 codeReturn
    currentMethod isInline ifTrue: [
-				"If inlined, the return variable already holds the value"
-		] ifFalse: [
-				self add: '^ ', currentMethod returnVariable  
-   ].
+        "If inlined, the return variable already holds the value"
+    ] ifFalse: [
+        arguments profile ifTrue:[ 
+            self codeProfileStop.
+        ]. 
+        self add: '^ ', currentMethod returnVariable  
+    ].
 
-	"Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-	"Modified: / 23-04-2015 / 20:51:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:49:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 codeReturn: code
     " - returns whatever is in code OR
       - assigns whatever is in code into the returnVariable"
-   currentMethod isInline ifTrue:[ 
+    currentMethod isInline ifTrue:[
         self codeEvaluateAndAssign: code to: currentMethod returnVariable. 
-   ] ifFalse: [ 
-        self add: '^ ', code 		
+    ] ifFalse: [ 
+        arguments profile ifTrue:[ 
+            self codeProfileStop.
+        ].   
+        self add: '^ ', code            
     ]
 
     "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:48:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 codeStoreValueOf: aBlock intoVariable: aString
@@ -427,12 +439,11 @@
     
     currentMethod := PPCInlinedMethod new.
     currentMethod id: id.   
-    currentMethod profile: arguments profile.
     currentMethod returnVariable: returnVariable.
     currentMethod indentationLevel: indentationLevel.
     self push.
 
-    "Modified: / 23-04-2015 / 18:28:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:48:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 startMethod: id
@@ -440,28 +451,29 @@
 
     currentMethod := PPCMethod new.
     currentMethod id: id.
-    currentMethod profile: arguments profile.    
+    arguments profile ifTrue:[ 
+        self codeProfileStart.
+    ].
     self push.      
                 
     self cache: id as: currentMethod.
 
-    "Modified: / 23-04-2015 / 18:36:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stopInline
-
     ^ self pop.
 
-    "Modified: / 23-04-2015 / 18:28:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:37:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stopMethod
-    self cache: currentMethod methodName as: currentMethod.
+   self cache: currentMethod methodName as: currentMethod.
     
     "arguments profile ifTrue: [ Transcript show: currentMethod code; cr. ]."
     ^ self pop.
 
-    "Modified: / 01-05-2015 / 14:18:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-06-2015 / 21:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 top