Reintroduced `Smalltalk class>>size`
...originaly introduced in `3f08e9d58571` but then
reverted due to a crash.
The crash was caused by using plain C `return` from a
primitive code that had a full Smalltalk context. Naturally,
the `return` did not cleaned up the context, therefore the crash.
This should fix issue #171.
https://swing.fit.cvut.cz/projects/stx-jv/ticket/171
--- a/Smalltalk.st Wed Jan 17 22:03:19 2018 +0000
+++ b/Smalltalk.st Wed Feb 28 19:33:15 2018 +0000
@@ -1200,7 +1200,7 @@
|keys|
- keys := IdentitySet new.
+ keys := IdentitySet new: self size.
self keysDo:[:k | keys add:k].
^ keys
!
@@ -1237,7 +1237,7 @@
|values|
- values := OrderedCollection new.
+ values := OrderedCollection new: self size.
self do:[:v | values add:v].
^ values
@@ -3638,6 +3638,17 @@
"Modified: / 14.6.1998 / 15:54:03 / cg"
!
+size
+ "Return the number of globals"
+
+%{ /* NOCONTEXT */
+ return ( __MKINT( __GLOBALS_SIZE() ) );
+%}.
+ self primitiveFailed.
+
+ "Created: / 03-07-2017 / 21:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
someImplementorOf:aSelector
"return any class, which implement the given selector. Nil if there is none.
(useful to search, if there is one at all)"