ObjectMemory: added #optimizeContext: and #fullSingleStep: to m-compile restartable contexts jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 23 Apr 2011 11:55:48 +0100
branchjv
changeset 17835 67648e9f2814
parent 17834 04ff72c5039a
child 17836 525ed10af75a
ObjectMemory: added #optimizeContext: and #fullSingleStep: to m-compile restartable contexts NamespaceAwareLookup: ifNil -> isNil ifTrue (should be faster) Method: remove calls annotatesMethod:
Method.st
NamespaceAwareLookup.st
ObjectMemory.st
--- a/Method.st	Sat Apr 09 18:19:04 2011 +0100
+++ b/Method.st	Sat Apr 23 11:55:48 2011 +0100
@@ -329,7 +329,7 @@
                                 ifNotNil:[annotations copyWith:annotation]]
         ifNotNil:
             [annotations at: index put: annotation].
-    annotation annotatesMethod: self.
+"/    annotation annotatesMethod: self.
 
     "
         (Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious').  
@@ -373,10 +373,10 @@
     "set the annotations"
 
     self setAnnotations: anObject.
-    "iterate over annotations just to invoke
-     annotationAtIndex: which lazyliyinitialize annotations
-     and send #annotatesMethod:"
-    self annotationsDo:[:annotation|]
+"/    "iterate over annotations just to invoke
+"/     annotationAtIndex: which lazyliyinitialize annotations
+"/     and send #annotatesMethod:"
+"/    self annotationsDo:[:annotation|]
 
     "Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -1824,7 +1824,7 @@
                         arguments: args.
         annotation isUnknown ifFalse:[
             annotations at: index put: annotation.
-            annotation annotatesMethod: self
+"/            annotation annotatesMethod: self
         ].
     ].
     ^annotation
@@ -3393,7 +3393,7 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Method.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: Method.st 10633 2011-04-23 10:55:48Z vranyj1 $'
 !
 
 version_CVS
@@ -3401,7 +3401,7 @@
 !
 
 version_SVN
-    ^ '$Id: Method.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: Method.st 10633 2011-04-23 10:55:48Z vranyj1 $'
 ! !
 
 Method initialize!
--- a/NamespaceAwareLookup.st	Sat Apr 09 18:19:04 2011 +0100
+++ b/NamespaceAwareLookup.st	Sat Apr 23 11:55:48 2011 +0100
@@ -88,7 +88,7 @@
     "Invoked by the VM to ask me for a method to fire.
      For details, see comment inLookup>>lookupMethodForSelector:directedTo:for:withArguments:from:"
 
-    | sendingNs sendingMthd queue seen namespaces  methods |
+    | sendingNs sendingMthd queue seen namespaces  methods imports |
 
     "JV @ 2010-07-24
      Following C code is just a performance optimization.
@@ -107,9 +107,9 @@
 %}.
     "If you remove C code above, uncomment the line below."
     "sendingMthd := sendingContext method."
-    sendingNs := sendingMthd 
-            ifNil:[nil]                
-            ifNotNil:[sendingMthd nameSpace].
+    sendingNs := sendingMthd isNil
+            ifTrue:[nil]                
+            ifFalse:[sendingMthd nameSpace].
 	sendingNs := sendingNs.
 
 	"Second chance to speed up things (in case sending method
@@ -126,13 +126,13 @@
             show: ' method=', sendingMthd printString; cr.
 	"
        
-    sendingNs ifNotNil:[
+    sendingNs notNil ifTrue: [
 
     seen := Set new.
 	namespaces := Array with: sendingNs.
 
     [namespaces notEmpty] whileTrue: 
-        [| imports |
+        [
         methods := self 
                     lookupMethodsForSelector: selector 
                     directedTo: initialSearchClass
@@ -147,7 +147,7 @@
         imports := Set new.
         namespaces do:
             [:namespace|
-            namespace ifNotNil:
+            namespace notNil ifTrue:
                 [namespace imports do:
                     [:import|
 					(seen includes: import) ifFalse:
@@ -351,7 +351,7 @@
 !NamespaceAwareLookup class methodsFor:'documentation'!
 
 version_SVN
-    ^ '$Id: NamespaceAwareLookup.st 10570 2010-08-26 10:12:57Z vranyj1 $'
+    ^ '$Id: NamespaceAwareLookup.st 10633 2011-04-23 10:55:48Z vranyj1 $'
 ! !
 
 NamespaceAwareLookup initialize!
--- a/ObjectMemory.st	Sat Apr 09 18:19:04 2011 +0100
+++ b/ObjectMemory.st	Sat Apr 23 11:55:48 2011 +0100
@@ -3748,6 +3748,43 @@
 
 !
 
+optimizeContexts
+    "return the setting of the optimize contexts flag"
+
+%{  /* NOCONTEXT */
+    extern int __optimizeContexts();
+
+    RETURN (__optimizeContexts(-1) ? true : false);
+%}
+    "
+     ObjectMemory optimizeContexts
+    "
+
+!
+
+optimizeContexts:aBoolean
+    "enable/disable restartable contexts for the just-in-time-compiled code.
+     If off, contexts that does not contain blocks are not restartable.
+     Execution is a bit slower if enabled."
+
+%{  /* NOCONTEXT */
+    extern int __optimizeContexts();
+    int prev;
+
+    prev = __optimizeContexts(aBoolean == true
+				   ? 1
+				   : (aBoolean == false)
+					? 0
+					: -1);
+    RETURN (prev ? true : false);
+%}
+    "
+     ObjectMemory optimizeContexts:true
+     ObjectMemory optimizeContexts:false
+    "
+
+!
+
 getCompiledCodeLimit
     "get the codeLimit from the VM"
 
@@ -5404,7 +5441,7 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version
-    ^ '$Id: ObjectMemory.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: ObjectMemory.st 10633 2011-04-23 10:55:48Z vranyj1 $'
 !
 
 version_CVS
@@ -5412,7 +5449,7 @@
 !
 
 version_SVN
-    ^ '$Id: ObjectMemory.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: ObjectMemory.st 10633 2011-04-23 10:55:48Z vranyj1 $'
 ! !
 
 ObjectMemory initialize!