ObjectMemory.st
changeset 15962 5ff4752179f0
parent 15643 8ca343d37d39
child 16323 98835889e906
--- a/ObjectMemory.st	Wed Feb 05 18:18:45 2014 +0100
+++ b/ObjectMemory.st	Wed Feb 05 18:18:58 2014 +0100
@@ -916,6 +916,52 @@
 %}
 ! !
 
+!ObjectMemory class methodsFor:'VM unwind protect support'!
+
+lookupMethodForSelectorUnwindHandlerFor: lookup
+
+    "
+    An unwind handler for external method lookup
+    (MOP). This method effectively called only
+    from handler block returned by
+    ObjectMemory>>unwindHandlerInContext:.
+
+    The VM also create an artifical context with
+    ObjectMemory as receiver and selector if this
+    method as selector and marks it for unwind.
+
+    See: ObjectMemory>>unwindHandlerInContext:
+    "
+
+    Processor activeProcess externalLookupPopIfEqual: lookup.
+
+    "Created: / 06-10-2011 / 16:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+unwindHandlerInContext:aContext
+
+    "
+    Return an unwind handler block for given context.
+    Selector of that context denotes which unwind handler
+    to use.
+
+    Occasionally, the VM needs to unwind-protect some C code.
+    If so, it creates and artificial context on the stack and
+    marks it for unwind, so stack unwinding logic finds it
+    and handles it. 
+
+    Now, only #lookupMethodForSelectorUnwindProtect is supported
+    (ensures the lookup is popped out from the lookupActications)
+    "
+    aContext selector == #lookupMethodForSelectorUnwindHandlerFor: ifTrue:[
+        ^[self lookupMethodForSelectorUnwindHandlerFor: (aContext argAt: 1)]
+    ].                                                
+
+    self internalError:'Unknown VM unwind protect action'
+
+    "Created: / 01-10-2011 / 19:15:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ObjectMemory class methodsFor:'access debugging'!
 
 debugPrivacyChecks:aBoolean
@@ -5506,7 +5552,7 @@
 !ObjectMemory class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.272 2013-08-19 10:02:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.273 2014-02-05 17:18:58 cg Exp $'
 !
 
 version_SVN