i broke something important in last commit - quickly reverting back :) jk_new_structure
authorhlopkmar
Wed, 09 Nov 2011 16:39:15 +0000
branchjk_new_structure
changeset 1102 df54d5b34c6b
parent 1101 6050636e16b4
child 1103 bf4c6f5bc68e
i broke something important in last commit - quickly reverting back :)
src/JavaContext.st
src/JavaProcess.st
src/JavaVM.st
src/stx_libjava.st
--- a/src/JavaContext.st	Wed Nov 09 16:17:19 2011 +0000
+++ b/src/JavaContext.st	Wed Nov 09 16:39:15 2011 +0000
@@ -364,10 +364,11 @@
 !
 
 acquiredMonitorsDo: aBlock 
-    acqrMonitors isNil ifTrue: [ acqrMonitors := Stack new ].
+    acqrMonitors isNil ifTrue: [ ^self ].
     acqrMonitors copy reverseDo: aBlock.
 
     "Created: / 08-11-2011 / 15:03:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 08-11-2011 / 21:46:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 addMonitor: mon 
@@ -435,43 +436,45 @@
 !JavaContext methodsFor:'non local control flow'!
 
 unwindAndRestartForJavaException
+
     "Called by JavaVM>>throwException: unwinds the stack
      up to this context and restarts it so an exception handler
      executes"
-    
-    | con  wasMarked |
-    self breakPoint:#mh.
+
+    | con wasMarked |
+
     "Each context that has a monitor acquired has
      and unwind action that release all monitors acquired.
      However, we DONT want my monitors to be released,
      so we temporarily unmark this context for unwind and
      then mark it again, eventually"
+
     wasMarked := self isUnwindContext.
-    wasMarked ifTrue: [ self unmarkForUnwind ].
-    self senderIsNil ifFalse: [
-        con := thisContext evaluateUnwindActionsUpTo: self.
+    wasMarked ifTrue:[self unmarkForUnwind].    
+    self senderIsNil ifFalse:[
+        con := thisContext evaluateUnwindActionsUpTo:self.
     ].
-    wasMarked ifTrue: [ self markForUnwind ].
-     "oops, if nil, I am not on the calling chain;
+    wasMarked ifTrue:[self markForUnwind].
+
+    "oops, if nil, I am not on the calling chain;
      (bad bad, unwind action have already been performed.
-     should we check for this situation first and NOT evaluate
-     the unwind actions in this case ?)
+      should we check for this situation first and NOT evaluate
+      the unwind actions in this case ?)
     "
-    con isNil ifTrue: [
+    con isNil ifTrue:[
         "
          tried to return to a context which is already dead
-         (i.e. the method/block has already executed a return)"
-        ^ self invalidReturnOrRestartError: #unwindAndRestart: with: nil
+         (i.e. the method/block has already executed a return)
+        "
+        ^ self invalidReturnOrRestartError:#'unwindAndRestart:' with:nil
     ].
-     "
+    "
      now, that all unwind-actions are done, I can use the
      low-level restart ...
     "
-    self breakPoint: #mh.
     ^ self restart
 
     "Created: / 08-11-2011 / 22:00:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 09-11-2011 / 16:56:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaContext methodsFor:'printing & storing'!
--- a/src/JavaProcess.st	Wed Nov 09 16:17:19 2011 +0000
+++ b/src/JavaProcess.st	Wed Nov 09 16:39:15 2011 +0000
@@ -185,68 +185,53 @@
 !JavaProcess::Helper methodsFor:'support'!
 
 value
-    | procName |
+    |procName|
+
     Object abortSignal 
-        handle: [
-            :ex | 
+        handle:[:ex | 
             procName := javaProcess name.
-            (procName startsWith: 'JAVA-AWT-EventQueue') ifTrue: [
-                Logger 
-                    log: ('thread ' , procName , ' aborted - restarting process.')
-                    severity: #info
-                    facility: 'JVM'.
+            (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
+                Logger log: ('thread ' , procName , ' aborted - restarting process.') severity: #info facility: 'JVM'.
                 ex restart.
-            ] ifFalse: [
-                (javaProcess == (Smalltalk at: #'JavaVM:JavaScreenUpdaterThread') 
-                    or: [ javaProcess == (Smalltalk at: #'JavaVM:JavaEventQueueThread') ]) 
-                        ifTrue: [
-                            Logger 
-                                log: ('thread ' , procName , ' aborted - restarting process.')
-                                severity: #info
-                                facility: 'JVM'.
+            ] ifFalse:[
+                (javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') 
+                    or:[javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread')]) 
+                        ifTrue:[
+                            Logger log: ('thread ' , procName , ' aborted - restarting process.') severity: #info facility: 'JVM'.
                             ex restart
-                        ]
-                        ifFalse: [
-                            Logger 
-                                log: ('thread ' , procName , ' aborted.')
-                                severity: #info
-                                facility: 'JVM'.
+                        ] ifFalse:[
+                            Logger log:('thread ' , procName , ' aborted.') severity: #info facility: 'JVM'.
                         ]
             ].
         ]
-        do: [
+        do:[
             [
                 JavaVM javaExceptionSignal 
-                    handle: [
-                        :ex | 
-                        | exClass |
+                    handle:[:ex | 
+                        |exClass|
+
                         procName := javaProcess name.
                         exClass := ex parameter class.
-                        exClass == (Java at: 'java.lang.ThreadDeath') ifTrue: [
-                            Logger 
-                                log: ('thread ' , procName , ' terminated')
-                                severity: #info
-                                facility: 'JVM'.
-                        ] ifFalse: [
-                            Logger 
-                                log: ('JAVA: thread ''' , procName , ''' terminated with exception: ' 
-                                        , exClass name)
-                                severity: #info
-                                facility: 'JVM'.
+                        exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
+                            Logger log: ('thread ' , procName , ' terminated') severity: #info facility: 'JVM'.
+                        ] ifFalse:[
+                            Logger log:
+                                ('JAVA: thread ''' , procName , ''' terminated with exception: ' 
+                                        , exClass name) severity: #info facility: 'JVM'.
                         ].
                         ex return.
                     ]
-                    do: [
+                    do:[
                         Object messageNotUnderstoodSignal 
-                            handle: [
-                                :ex | 
-                                | 
+                            handle:[:ex | 
+                                |
                                 "/ remap doesNotUnderstand with nil-receiver to
                                 "/ a nullPointerException ...
-                                 con  m |
+                                 con m|
+
                                 con := ex suspendedContext.
-                                con receiver isNil ifTrue: [
-                                    ((m := con sender method) notNil and: [ m isJavaMethod ]) ifTrue: [
+                                con receiver isNil ifTrue:[
+                                    ((m := con sender method) notNil and:[m isJavaMethod]) ifTrue:[
                                         JavaVM throwNullPointerException.
                                         AbortSignal raise.
                                         
@@ -255,45 +240,38 @@
                                 ].
                                 ex reject.
                             ]
-                            do: [
+                            do:[
                                 "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
-                                javaThreadObject perform: #'run()V'.
-                                (Smalltalk at: #'JavaVM:ThreadTrace') == true ifTrue: [
-                                    Logger 
-                                        log: ('thread ' , javaProcess name , ' terminated')
-                                        severity: #info
-                                        facility: 'JVM'.
+                                javaThreadObject perform:#'run()V'.
+                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+                                    Logger log: ('thread ' , javaProcess name , ' terminated') severity: #info facility: 'JVM'.
                                 ].
-                                javaThreadObject perform: #'exit()V'.
-                                (Smalltalk at: #'JavaVM:ThreadTrace') == true ifTrue: [
-                                    Logger 
-                                        log: ('after exit of thread ' , javaProcess name)
-                                        severity: #info
-                                        facility: 'JVM'.
+                                javaThreadObject perform:#'exit()V'.
+                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+                                    Logger log: ('after exit of thread ' , javaProcess name) severity: #info facility: 'JVM'.
                                 ]
                             ]
                     ]
-            ] ensure: [
-                JavaVM releaseMonitorsOfProcess: javaProcess.                
-                (Smalltalk at: #'JavaVM:EnteredMonitorsPerProcess') removeKey: javaProcess.
-                javaProcess == (Smalltalk at: #'JavaVM:JavaScreenUpdaterThread') ifTrue: [
-                    Smalltalk at: #'JavaVM:JavaScreenUpdaterThread' put: nil.
+            ] ensure:[
+                JavaVM releaseMonitorsOfProcess: javaProcess.
+
+                (Smalltalk at:#'JavaVM:EnteredMonitorsPerProcess') removeKey:javaProcess.
+                javaProcess == (Smalltalk at:#'JavaVM:JavaScreenUpdaterThread') ifTrue:[
+                    Smalltalk at:#'JavaVM:JavaScreenUpdaterThread' put:nil.
                 ].
-                javaProcess == (Smalltalk at: #'JavaVM:JavaEventQueueThread') ifTrue: [
-                    Smalltalk at: #'JavaVM:JavaEventQueueThread' put: nil.
+                javaProcess == (Smalltalk at:#'JavaVM:JavaEventQueueThread') ifTrue:[
+                    Smalltalk at:#'JavaVM:JavaEventQueueThread' put:nil.
                 ].
-                
+                    
 "/                                    screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.    
 "/                                    screenUpdaterClass notNil ifTrue:[
 "/                                        screenUpdaterClass instVarNamed:'updater' put:nil.
 "/                                    ].
-                
-                Java threads removeKey: javaThreadObject ifAbsent: [].
+                Java threads removeKey:javaThreadObject ifAbsent:[].
             ]
         ]
 
     "Created: / 15-12-2010 / 11:06:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 09-11-2011 / 17:18:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaProcess class methodsFor:'documentation'!
--- a/src/JavaVM.st	Wed Nov 09 16:17:19 2011 +0000
+++ b/src/JavaVM.st	Wed Nov 09 16:39:15 2011 +0000
@@ -15693,18 +15693,14 @@
             objString := someObject class name , '@' 
                         , someObject identityHash printString.
         ].
-        Logger 
-            log: 'entering monitor for ' , objString , ' in ' , thisProcess name
-            severity: #info
-            facility: #JVM.
+        Logger log: 'entering monitor for ' , objString , ' in ' , thisProcess name 
+                        severity:#info facility:#JVM.
     ].
     mon enter.
     aJavaContext addMonitor: someObject.
     MonitorTrace ifTrue: [
-        Logger 
-            log: 'monitor entered in ' , thisProcess name
-            severity: #info
-            facility: #JVM.
+        Logger log: 'monitor entered in ' , thisProcess name 
+                        severity:#info facility:#JVM.
     ].
     (self enteredMonitorsOfProcess: thisProcess) add: someObject.
 
@@ -15731,7 +15727,9 @@
             log: 'leaving monitor for ' , objString , ' in ' , thisProcess name
             severity: #info
             facility: #JVM.
-    ].    
+    ].
+    mon exit.
+    aJavaContext removeMonitor: someObject.
     MonitorTrace ifTrue: [
         Logger 
             log: 'monitor left in ' , thisProcess name
@@ -15742,8 +15740,6 @@
     lastMon ~~ someObject ifTrue: [
         self halt: 'oops - monitor enter/exit nesting wrong'
     ].
-    mon exit.
-        aJavaContext removeMonitor: someObject.
     wasBlocked := OperatingSystem blockInterrupts.
      "mon count == 0 ifTrue: [ LeftMonitorObject := someObject ]."
     wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]
@@ -15950,7 +15946,7 @@
     
     enteredMonitors size > 0 ifTrue: [
         wasBlocked := OperatingSystem blockInterrupts.
-         "self syncMonitorCache."
+        "self syncMonitorCache."
         MonitorTrace ifTrue: [
             ('====> wait - reenter ' , enteredMonitors size printString 
                 , ' monitors in ' , Processor activeProcess name 
@@ -15977,7 +15973,7 @@
 
     "Created: / 30-12-1998 / 19:19:35 / cg"
     "Modified: / 08-01-1999 / 17:29:24 / cg"
-    "Modified: / 09-11-2011 / 16:23:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 09-11-2011 / 14:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'vm support'!
@@ -16020,15 +16016,18 @@
     "Modified: / 31-05-2011 / 10:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-_ATHROW: aJavaException 
+_ATHROW:aJavaException
+
     <resource: #skipInDebuggersWalkBack>
-    aJavaException isNil ifTrue: [ self halt: 'cannot happen' ].
-    self breakPoint:#mh.
-    self throwException: aJavaException.
+
+    aJavaException isNil ifTrue:[
+        self halt:'cannot happen'
+    ].
+    self throwException:aJavaException
 
     "Created: / 08-01-1999 / 14:15:36 / cg"
-    "Modified: / 04-03-2011 / 00:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 09-11-2011 / 16:36:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 08-11-2011 / 16:32:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 08-11-2011 / 22:16:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _CHECKCAST2: object _: aJavaClassRef 
--- a/src/stx_libjava.st	Wed Nov 09 16:17:19 2011 +0000
+++ b/src/stx_libjava.st	Wed Nov 09 16:39:15 2011 +0000
@@ -623,7 +623,7 @@
     "Return a SVN revision number of myself.
      This number is updated after a commit"
 
-    ^ "$SVN-Revision:"'1449'"$"
+    ^ "$SVN-Revision:"'1451M'"$"
 ! !
 
 !stx_libjava class methodsFor:'file generation'!