Author: Patrick Rein <[email protected]>
Branch: stmgc-c7
Changeset: r836:9e020878c717
Date: 2014-05-22 13:07 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/9e020878c717/

Log:    added actual interpretation to forked stm process. changed
        stmprocess class in the image

diff --git a/images/Squeak4.5-12568.changes b/images/Squeak4.5-12568.changes
--- a/images/Squeak4.5-12568.changes
+++ b/images/Squeak4.5-12568.changes
@@ -440,4 +440,4 @@
                at: 14 at: 13 put: 1;
                at: 12 at: 14 put: 1.
                
        ((numberOfRows > 16) and: (numberOfColumns > 16)) ifTrue: [
                newField
                        at: 20 at: 3 put: 1;
                        at: 20 at: 4 put: 1;
                        at: 21 at: 2 put: 1;
                        at: 21 at: 5 put: 1;
                        at: 22 at: 3 put: 1;
                        at: 22 at: 4 put: 1;
                        
                        at: 20 at: 20 put: 1;
                        at: 20 at: 21 put: 1;
                        at: 20 at: 22 put: 1.           
        ].
                
-       ^ newField! !

----SNAPSHOT----{21 January 2014 . 2:05:40 pm} Squeak4.5-12568.image 
priorSource: 84405!

----STARTUP----{17 May 2014 . 11:47:50 pm} as 
/home/hub/hpi/stm/src/lang-smalltalk/images/Squeak4.5-12568.image!


FileStream stdout nextPutAll: 'release.st'; cr; flush.!

----SNAPSHOT----{17 May 2014 . 11:48:30 pm} Squeak4.5-12568.image priorSource: 
86737!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'hh 5/17/2014 23:49'!
stmBenchmarkTest
        FileStream stdout nextPutAll: 'starting stm process.'.
        "^ StmProcess new fork"! !

----QUIT----{17 May 2014 . 11:49:16 pm} Squeak4.5-12568.image priorSource: 
86999!

----STARTUP----{17 May 2014 . 11:50:46 pm} as 
/home/hub/hpi/stm/src/lang-smalltalk/images/Squeak4.5-12568.image!


Process subclass: #StmProcess
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-Processes'!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'hh 5/17/2014 23:53' prior: 
33641587!
stmBenchmarkTest
        FileStream stdout nextPutAll: 'starting stm process.'.
        ^ StmProcess new fork.! !
!StmProcess methodsFor: 'nil' stamp: 'hh 5/17/2014 23:54'!
fork    <primitive: 787>        FileStream stdout nextPutAll: 'Primitive 
stmFork failed'.       self primitiveFailed! !
!StmProcess methodsFor: 'as yet unclassified' stamp: 'hh 5/17/2014 23:55' 
prior: 33642264!
fork    
        <primitive: 787>        
        self primitiveFailed! !

----SNAPSHOT----{17 May 2014 . 11:55:14 pm} Squeak4.5-12568.image priorSource: 
87255!

----QUIT----{17 May 2014 . 11:55:30 pm} Squeak4.5-12568.image priorSource: 
88078!

----STARTUP----{22 May 2014 . 11:48:49 am} as 
D:\code\python\spy-vm\lang-smalltalk\images\Squeak4.5-12568.image!

!StmProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 11:49'!
wait    
        <primitive: 789>        
        self primitiveFailed! !
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'pre 5/22/2014 11:50' prior: 
33642105!
stmBenchmarkTest
        | p |
        FileStream stdout nextPutAll: 'starting stm process.'.
        p := StmProcess new fork.
        p join! !
!StmProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 11:50'!
join    
        <primitive: 789>        
        self primitiveFailed! !

StmProcess removeSelector: #wait!

----QUIT----{22 May 2014 . 11:50:32 am} Squeak4.5-12568.image priorSource: 
88165!
\ No newline at end of file
+       ^ newField! !

----SNAPSHOT----{21 January 2014 . 2:05:40 pm} Squeak4.5-12568.image 
priorSource: 84405!

----STARTUP----{17 May 2014 . 11:47:50 pm} as 
/home/hub/hpi/stm/src/lang-smalltalk/images/Squeak4.5-12568.image!


FileStream stdout nextPutAll: 'release.st'; cr; flush.!

----SNAPSHOT----{17 May 2014 . 11:48:30 pm} Squeak4.5-12568.image priorSource: 
86737!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'hh 5/17/2014 23:49'!
stmBenchmarkTest
        FileStream stdout nextPutAll: 'starting stm process.'.
        "^ StmProcess new fork"! !

----QUIT----{17 May 2014 . 11:49:16 pm} Squeak4.5-12568.image priorSource: 
86999!

----STARTUP----{17 May 2014 . 11:50:46 pm} as 
/home/hub/hpi/stm/src/lang-smalltalk/images/Squeak4.5-12568.image!


Process subclass: #StmProcess
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-Processes'!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'hh 5/17/2014 23:53' prior: 
33641587!
stmBenchmarkTest
        FileStream stdout nextPutAll: 'starting stm process.'.
        ^ StmProcess new fork.! !
!StmProcess methodsFor: 'nil' stamp: 'hh 5/17/2014 23:54'!
fork    <primitive: 787>        FileStream stdout nextPutAll: 'Primitive 
stmFork failed'.       self primitiveFailed! !
!StmProcess methodsFor: 'as yet unclassified' stamp: 'hh 5/17/2014 23:55' 
prior: 33642264!
fork    
        <primitive: 787>        
        self primitiveFailed! !

----SNAPSHOT----{17 May 2014 . 11:55:14 pm} Squeak4.5-12568.image priorSource: 
87255!

----QUIT----{17 May 2014 . 11:55:30 pm} Squeak4.5-12568.image priorSource: 
88078!

----STARTUP----{22 May 2014 . 11:48:49 am} as 
D:\code\python\spy-vm\lang-smalltalk\images\Squeak4.5-12568.image!

!StmProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 11:49'!
wait    
        <primitive: 789>        
        self primitiveFailed! !
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'pre 5/22/2014 11:50' prior: 
33642105!
stmBenchmarkTest
        | p |
        FileStream stdout nextPutAll: 'starting stm process.'.
        p := StmProcess new fork.
        p join! !
!StmProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 11:50'!
join    
        <primitive: 789>        
        self primitiveFailed! !

StmProcess removeSelector: #wait!

----QUIT----{22 May 2014 . 11:50:32 am} Squeak4.5-12568.image priorSource: 
88165!

----STARTUP----{22 May 2014 . 1:53:40 pm} as 
D:\code\python\spy-vm\lang-smalltalk\images\Squeak4.5-12568.image!

!BlockClosure methodsFor: 'STM' stamp: 'pre 5/22/2014 13:58'!
newStmProcess
        ^ StmProcess forContext: [self value] asContext priority: Processor 
activePriority! !
!BlockClosure methodsFor: 'STM' stamp: 'pre 5/22/2014 13:59' prior: 33568777!
parallelFork
        ^ (self newStmProcess) fork; yourself! !

BlockClosure removeSelector: #newStmProcess!
!BlockClosure methodsFor: 'STM' stamp: 'pre 5/22/2014 13:59' prior: 33643726!
parallelFork
        ^ (self newSTMProcess) fork; yourself! !
!STMProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 14:00' 
prior: 33556280!
primWait
        <primitive: 789>
        SPyVM print: ' Failed to wait for process!! '
        self primitiveFailed.! !
!STMProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 14:00' 
prior: 33644052!
primWait
        <primitive: 789>
        SPyVM print: ' Failed to wait for process!! '.
        self primitiveFailed.! !
!STMProcess methodsFor: 'as yet unclassified' stamp: 'pre 5/22/2014 14:00' 
prior: 42636506!
fork
        <primitive: 787>
        Transcript show: '* STM Process did not fork *' , Character cr.
        self primitiveFailed.
        self resume! !

STMProcess removeSelector: #initialize!

Process subclass: #STMProcess
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-STM'!

Process subclass: #STMProcess
        instanceVariableNames: 'lock'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-STM'!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'pre 5/22/2014 14:02' prior: 
33643008!
stmBenchmarkTest
        | p |
        FileStream stdout nextPutAll: 'starting stm process.'.
        p := STMProcess new fork.
        p join! !

Smalltalk removeClassNamed: #StmProcess!

Process subclass: #STMProcess
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-STM'!

Process subclass: #STMProcess
        instanceVariableNames: 'lock'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Kernel-STM'!
!Integer methodsFor: '*SPy-Benchmarks' stamp: 'pre 5/22/2014 14:03' prior: 
33644952!
stmBenchmarkTest
        | p |
        FileStream stdout nextPutAll: 'starting stm process.'.
        p := [ 1 + 1. ] parallelFork.
        p join! !

----SNAPSHOT----{22 May 2014 . 2:03:31 pm} Squeak4.5-12568.image priorSource: 
88855!

----QUIT----{22 May 2014 . 2:06:55 pm} Squeak4.5-12568.image priorSource: 91148!
\ No newline at end of file
diff --git a/images/Squeak4.5-12568.image b/images/Squeak4.5-12568.image
index 
afbdfb32577e6a5f8388a264d6ff6ee8e350c64b..aa8ba78091bb620da5e2b213eb8a616801bb8b73
GIT binary patch

[cut]

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -115,19 +115,12 @@
         print "Me is started", bootstrapper.num_threads
         bootstrapper.release()
 
-        # ...aaaaand go!
-        # wrapper.StmProcessWrapper(interp.space, w_stm_process).store_lock(1)
-
-        # interp.interpret_with_w_frame(w_frame, may_context_switch=False)
-        time.sleep(2.5)
-
-        s_stm_process = w_stm_process.as_special_get_shadow(interp.space, 
StmProcessShadow)
-        s_stm_process.lock.release()
-
-        # Signal waiting processes
-        #wrapper.StmProcessWrapper(interp.space, 
w_stm_process).signal('thread')
+        interp.interpret_with_w_frame(w_frame) #, may_context_switch=False
 
         # cleanup
+        s_stm_process = w_stm_process.as_special_get_shadow(interp.space, 
StmProcessShadow)
+        s_stm_process.signal()
+
         bootstrapper.num_threads -= 1
 
     bootstrap = staticmethod(bootstrap)
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -1139,4 +1139,7 @@
         lock_result = self.lock.acquire(blocking)
         if lock_result:
             self.lock.release()
-        return lock_result
\ No newline at end of file
+        return lock_result
+
+    def signal(self):
+        self.lock.release()
\ No newline at end of file
diff --git a/spyvm/wrapper.py b/spyvm/wrapper.py
--- a/spyvm/wrapper.py
+++ b/spyvm/wrapper.py
@@ -116,9 +116,6 @@
 
 class StmProcessWrapper(ProcessWrapper):
 
-    # Mis-using priority as lock, we don't need prios :P
-    lock, store_lock = make_int_getter_setter(2)
-
     def put_to_sleep(self):
         # Must not queue
         pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to