JavaVMData.st
branchopenjdk7-support
changeset 2037 6b93bf17087a
parent 1966 8a26e8ccbd7f
child 2042 b6302ebec0b4
--- a/JavaVMData.st	Thu Feb 07 16:38:49 2013 +0100
+++ b/JavaVMData.st	Thu Feb 07 19:17:28 2013 +0100
@@ -32,7 +32,10 @@
 		ImageStretchCache LoadedNativeLibs JavaConsoleStream
 		JavaEventQueueThread PermittedDirectories
 		StdinReplacementFileQuerySignal JavaScreenUpdaterThread
-		ZipInflaters LoadedLibs EnteredMonitorsPerProcess'
+		ZipInflaters LoadedLibs EnteredMonitorsPerProcess
+		java_lang_String java_lang_String_valueID
+		java_lang_String_offsetID java_lang_String_countID
+		java_lang_String_hashID java_lang_Class'
 	poolDictionaries:''
 	category:'Languages-Java-Support'
 !
@@ -68,6 +71,14 @@
     A shared pool containing some VM data accessed by different
     parties.
 
+    Among other things, it keeps references to various classes
+    such as java.lang.String or java.lang.Class (for instance 
+    var java_lang_String) and indices of fields in those classes 
+    (for instance java_lang_String_offsetID). When adding new,
+    please follow the naming convention. 
+
+    See #vmClasses how the values are initialize.d
+
     Historical note: all values here used to be in JavaVM.
 
     [author:]
@@ -78,13 +89,39 @@
     [class variables:]
 
     [see also:]
+        #vmClasses
 
 "
 ! !
 
+!JavaVMData class methodsFor:'accessing'!
+
+vmClasses
+    "Returns a list of class names that VM must know of, like
+     java.lang.String or java.lang.Class. The list contains
+     internal (slashed) names.
+
+     Here, instead of listing them manually, a reflection is used to
+     collect them. So to add a class, you only have to add it to a class 
+     instance variables. However, you have to follow naming convetion - the
+     name of the variable must be the full java name (/ replaced by _)."
+
+
+    ^self classVarNames 
+        select:[:each|(each startsWith: 'java_') or:[(each startsWith: 'java_')]]
+        thenCollect:[:each|each copyReplaceAll:$_ with:$/].
+
+    "
+        JavaVMData vmClasses
+    "
+
+    "Created: / 07-02-2013 / 17:33:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !JavaVMData class methodsFor:'documentation'!
 
 version_HG
 
     ^ '$Changeset: <not expanded> $'
 ! !
+