Added options to disable JIT compilation.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 22 May 2014 12:26:59 +0100
changeset 211 67b35d0a0ee3
parent 210 8f2d6f71958f
child 214 581bea1986f0
Added options to disable JIT compilation. --disable-jit disabled both Smalltalk and Java JIT. --disable-jit-smalltalk and --disable-jit-java disables selectivelt JIT for the language. Note, that --disable-jit-smalltalk disables JIT for all languages compiled to Smalltalk bytecodes such as JavaScript or Ruby.
s/stx/BenchmarkRunnerAdapterStX.st
--- a/s/stx/BenchmarkRunnerAdapterStX.st	Thu May 22 12:07:48 2014 +0100
+++ b/s/stx/BenchmarkRunnerAdapterStX.st	Thu May 22 12:26:59 2014 +0100
@@ -31,7 +31,7 @@
     "Modified: / 01-08-2013 / 18:42:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-initializeForPerformance
+setupForPerformance
     "Set's system for maximum performance"
 
     "Set stack size to 16MB"
@@ -40,14 +40,24 @@
 
     "Setup for performance"
     JavaNativeMethod cacheNativeImplementation: true.
+    ObjectMemory javaNativeCodeOptimization: true.
 
-    ObjectMemory justInTimeCompilation: true.
-    ObjectMemory javaNativeCodeOptimization: true.
-    ObjectMemory javaJustInTimeCompilation: true.
 
     "ObjectMemory newSpaceSize: ObjectMemory newSpaceSize * 5."
 
-    "Created: / 21-05-2014 / 13:08:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 22-05-2014 / 12:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupJITJava:aBoolean 
+    ObjectMemory javaJustInTimeCompilation:aBoolean.
+
+    "Created: / 22-05-2014 / 12:17:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupJITSmalltalk:aBoolean 
+    ObjectMemory justInTimeCompilation:aBoolean.
+
+    "Created: / 22-05-2014 / 12:17:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BenchmarkRunnerAdapterStX class methodsFor:'debugging'!
@@ -208,20 +218,25 @@
     Stderr nextPutLine: '                           (gdb) r -I -f "$DIR/benchmark-runner.st" ...'.
     Stderr nextPutLine: '  --callgrind ............ run benchmark under callgrind profiler. Requires'.
     Stderr nextPutLine: '                           stx:libprofiler package.'.
-    
+    Stderr nextPutLine: '  --disable-jit .......... disable JIT compilation for both, Smalltalk and'.
+    Stderr nextPutLine: '                           Java.'.
+    Stderr nextPutLine: '  --disable-jit-java ...., disable Java JIT only.'.    
+    Stderr nextPutLine: '  --disable-jit-smalltalk  disable Smalltalk JIT only.'.
+
     Stderr cr.
     BenchmarkRunner new options.
     Smalltalk exit: 0.
 
     "Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 22-05-2014 / 12:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-05-2014 / 12:21:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BenchmarkRunnerAdapterStX class methodsFor:'startup-to be redefined'!
 
 main:argv0
-    | argv i packages |    
+    | argv i packages enableSmalltalkJIT enableJavaJIT |    
 
+    enableSmalltalkJIT := enableJavaJIT := true.
     [
         packages := OrderedCollection new.
         argv := argv0 asOrderedCollection.
@@ -239,6 +254,15 @@
                     i := i - 1.
                 ]
             ].
+            arg = '--disable-jit' ifTrue:[ 
+                enableSmalltalkJIT := enableJavaJIT := false.
+            ].
+            arg = '--disable-jit-java' ifTrue:[ 
+                enableJavaJIT := false.
+            ]. 
+            arg = '--disable-jit-smalltalk' ifTrue:[ 
+                enableJavaJIT := false.
+            ]. 
             i := i + 1.
         ].
 
@@ -250,7 +274,9 @@
             ]
         ].
 
-        self initializeForPerformance.
+        self setupForPerformance.
+        self setupJITSmalltalk: (enableSmalltalkJIT).  
+        self setupJITJava: (enableJavaJIT).
         BenchmarkRunner new main: argv
 
     ] on: Error do:[:ex|
@@ -272,7 +298,7 @@
     Smalltalk exit: 0.
 
     "Created: / 06-06-2013 / 10:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-05-2014 / 13:08:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-05-2014 / 12:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BenchmarkRunnerAdapterStX class methodsFor:'documentation'!