diff -r c45383095de4 -r b18b6cc7aabc compiler/PPCCompiler.st --- 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 " -! - call: anotherMethod currentMethod add: anotherMethod call. ! @@ -252,28 +246,46 @@ "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany " ! +codeProfileStart + self add: 'context methodInvoked: #', currentMethod methodName, '.' + + "Created: / 01-06-2015 / 21:17:19 / Jan Vrany " +! + +codeProfileStop + self add: 'context methodFinished: #', currentMethod methodName, '.' + + "Created: / 01-06-2015 / 21:19:11 / Jan Vrany " +! + 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 " - "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany " + "Created: / 23-04-2015 / 18:01:05 / Jan Vrany " + "Modified: / 01-06-2015 / 21:49:04 / Jan Vrany " ! 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 " - "Modified: / 23-04-2015 / 20:51:41 / Jan Vrany " + "Modified: / 01-06-2015 / 21:48:51 / Jan Vrany " ! 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 " + "Modified: / 01-06-2015 / 21:48:35 / Jan Vrany " ! 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 " + "Modified: / 01-06-2015 / 21:19:41 / Jan Vrany " ! stopInline - ^ self pop. - "Modified: / 23-04-2015 / 18:28:33 / Jan Vrany " + "Modified: / 01-06-2015 / 21:37:59 / Jan Vrany " ! 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 " + "Modified: / 01-06-2015 / 21:38:05 / Jan Vrany " ! top