- JavaClassReader jk_new_structure
authorvranyj1
Tue, 04 Sep 2012 10:58:53 +0000
branchjk_new_structure
changeset 1693 19fab8b4cd97
parent 1692 561d5ac3f2df
child 1694 c9c3667b4e55
- JavaClassReader class definition variable renamed in: #initialize changed: #readCodeAttributeFor:
src/JavaClassReader.st
--- a/src/JavaClassReader.st	Mon Sep 03 18:04:13 2012 +0000
+++ b/src/JavaClassReader.st	Tue Sep 04 10:58:53 2012 +0000
@@ -25,7 +25,7 @@
 		constSlot classBeingLoaded'
 	classVariableNames:'Verbose AnnotationsVerbose Silent AbsolutelySilent
 		LazyClassLoading InvalidClassFormatSignal ClassLoaderQuerySignal
-		JavaArchiveCache MaxStackDepth MaxStackDepthLimit'
+		JavaArchiveCache MaxContextSize MaxContextSizeLimit'
 	poolDictionaries:'JavaConstants'
 	category:'Languages-Java-Support'
 !
@@ -76,13 +76,13 @@
         JavaArchiveCache := CacheDictionary new: 8.
     ].
     AnnotationsVerbose := false.
-    MaxStackDepth := 0.
+    MaxContextSize := 0.
 
     "Maximum stack depth supported by the VM.
      if you change it, make sure it is equal (or lower)
      to CONSIZE in jinterpret.c (line 98 or so)
      Otherwise, VM may crash!!!!!!"
-    MaxStackDepthLimit := 64.
+    MaxContextSizeLimit := 64.
 
 
     "
@@ -92,7 +92,7 @@
     "Modified: / 17-12-2010 / 17:37:45 / Marcel Hlopko <hlopik@gmail.com>"
     "Modified: / 10-05-2011 / 23:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 14-08-2012 / 02:01:37 / jv"
-    "Modified: / 16-08-2012 / 20:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-09-2012 / 11:55:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaClassReader class methodsFor:'Signal constants'!
@@ -1900,15 +1900,16 @@
     ((minorVsn > 2) or:[majorVsn > 45]) ifTrue:[
         "/ should be:
         max_stack := inStream nextUnsignedShortMSB:msb.
-        "/ Remember max stack depth so far, will be used to
+        max_locals := inStream nextUnsignedShortMSB:msb.
+        code_length := inStream nextUnsignedLongMSB:msb.
+        "/ Remember max context size so far, will be used to
         "/ optimize context size as alloca() won't work.
-        MaxStackDepth := MaxStackDepth max: max_stack.
-        MaxStackDepth > MaxStackDepthLimit ifTrue:[
+        MaxContextSize := MaxContextSize max: (max_stack + max_locals + 4"safe area").
+        MaxContextSize > MaxContextSizeLimit ifTrue:[
             self error:'method''s stack depth overflows VM limit'.
             ^false
         ].
-        max_locals := inStream nextUnsignedShortMSB:msb.
-        code_length := inStream nextUnsignedLongMSB:msb.
+
 
 "/        unknown1 := inStream nextByte.
 "/        max_stack := inStream nextByte.
@@ -1976,7 +1977,7 @@
 
     "Created: / 15-04-1996 / 15:40:17 / cg"
     "Modified: / 16-05-1998 / 01:39:42 / cg"
-    "Modified: / 16-08-2012 / 19:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-09-2012 / 11:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 readExceptionsAttributeFor:aJavaMethod