# HG changeset patch # User vranyj1 # Date 1350336385 0 # Node ID 0d275432230d43914da2d087f459a32d116fe90d # Parent c23e0b74bc1ca0584b699f3d8d22047e5ad76827 - JavaRef2 added: #preResolve #preresolve - JavaClassReader changed: #readConstantPool - JavaMethodRef2 class definition added: #preResolve #preresolve - JavaNameAndType2 added: #preresolve - JavaMethod added: #r_double #r_long #r_void - extensions ... diff -r c23e0b74bc1c -r 0d275432230d src/JavaClassReader.st --- a/src/JavaClassReader.st Mon Oct 15 19:59:35 2012 +0000 +++ b/src/JavaClassReader.st Mon Oct 15 21:26:25 2012 +0000 @@ -1331,19 +1331,20 @@ ifTrue: [ constSlot := constSlot + 2. ] ifFalse: [ constSlot := constSlot + 1. ]]. constSlot := -1. - - 1 to: constantPoolSize - 1 - do: - [:i | - | const value | - - const := constants at: i. - const ifNotNil: - [ "/ kludge for 2-slot constants (which only take 1 slot in ST/X) - (const isKindOf: JavaUnresolvedConstant) - ifTrue: - [ value := const preResolve. - value ~~ const ifTrue: [ constants at: i put: value. ] ] ] ]. + + constants do:[:ref|ref isJavaRef ifTrue:[ref preResolve]]. +"/ 1 to: constantPoolSize - 1 +"/ do: +"/ [:i | +"/ | const value | +"/ +"/ const := constants at: i. +"/ const notNil ifTrue: +"/ [ "/ kludge for 2-slot constants (which only take 1 slot in ST/X) +"/ (const isKindOf: JavaUnresolvedConstant) +"/ ifTrue: +"/ [ value := const preResolve. +"/ value ~~ const ifTrue: [ constants at: i put: value. ] ] ] ]. " JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' @@ -1351,6 +1352,7 @@ "Modified: / 07-05-1998 / 11:44:06 / cg" "Created: / 13-05-2011 / 16:52:54 / Marcel Hlopko " + "Modified: / 15-10-2012 / 23:15:42 / Jan Vrany " ! readConstant_Asciz @@ -1952,7 +1954,7 @@ readCodeAttributeFor:aJavaMethod |attribute_length max_stack max_locals code_length code - exception_table_length exception_table unknown1 unknown2| + exception_table_length exception_table unknown1 unknown2 | attribute_length := inStream nextUnsignedLongMSB:msb. @@ -1966,11 +1968,12 @@ "/ Remember max context size so far, will be used to "/ optimize context size as alloca() won't work. MaxContextSize := MaxContextSize max: (max_stack + max_locals + 4"safe area"). +" MaxContextSize > MaxContextSizeLimit ifTrue:[ self error:'method''s stack depth overflows VM limit'. ^false ]. - +" "/ unknown1 := inStream nextByte. "/ max_stack := inStream nextByte. @@ -2021,6 +2024,10 @@ aJavaMethod setExceptionHandlerTable:exception_table. ]. + (max_stack + max_locals + 4) > MaxContextSizeLimit ifTrue:[ + code := nil + ]. + aJavaMethod setCode:code maxStack:max_stack diff -r c23e0b74bc1c -r 0d275432230d src/JavaMethod.st --- a/src/JavaMethod.st Mon Oct 15 19:59:35 2012 +0000 +++ b/src/JavaMethod.st Mon Oct 15 21:26:25 2012 +0000 @@ -158,6 +158,24 @@ "Created: / 27.1.1998 / 21:50:05 / cg" ! +r_double + ^R_DOUBLE + + "Created: / 15-10-2012 / 23:21:03 / Jan Vrany " +! + +r_long + ^R_LONG + + "Created: / 15-10-2012 / 23:20:50 / Jan Vrany " +! + +r_void + ^R_VOID + + "Created: / 15-10-2012 / 23:20:58 / Jan Vrany " +! + unresolvedClassSignal "return the signal raised when an unresolved class is referenced" diff -r c23e0b74bc1c -r 0d275432230d src/JavaMethodRef2.st --- a/src/JavaMethodRef2.st Mon Oct 15 19:59:35 2012 +0000 +++ b/src/JavaMethodRef2.st Mon Oct 15 21:26:25 2012 +0000 @@ -21,7 +21,7 @@ "{ Package: 'stx:libjava' }" JavaClassContentRef2 subclass:#JavaMethodRef2 - instanceVariableNames:'selectorCache' + instanceVariableNames:'selectorCache numArgSlotsCache returnTypeCache' classVariableNames:'' poolDictionaries:'' category:'Languages-Java-Reader-Support-new' @@ -103,6 +103,38 @@ "Created: / 11-04-2011 / 19:56:35 / Marcel Hlopko " ! ! +!JavaMethodRef2 methodsFor:'resolving'! + +preResolve + "Fill in selectorCache and numArgSlotsCache for these are used + by the JIT-compiler" + + | returnTypeChar | + + nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve. + nameAndTypeCache isNil ifTrue: [ self breakPoint: #mh ]. + selectorCache isNil ifTrue: [ + selectorCache := (nameAndTypeCache name , nameAndTypeCache descriptor) asSymbol + ]. + numArgSlotsCache := JavaMethod numArgsFromSignature: nameAndTypeCache descriptor. + returnTypeChar := nameAndTypeCache descriptor last. + returnTypeChar == $V ifTrue:[ + returnTypeCache := JavaMethod r_void. + ] ifFalse:[ + returnTypeChar == $L ifTrue:[ + returnTypeCache := JavaMethod r_long. + ] ifFalse:[ + returnTypeChar == $D ifTrue:[ + returnTypeCache := JavaMethod r_double. + ] ifFalse:[ + returnTypeCache := 0. + ] + ] + ] + + "Created: / 15-10-2012 / 23:13:45 / Jan Vrany " +! ! + !JavaMethodRef2 class methodsFor:'documentation'! version_SVN diff -r c23e0b74bc1c -r 0d275432230d src/JavaNameAndType2.st --- a/src/JavaNameAndType2.st Mon Oct 15 19:59:35 2012 +0000 +++ b/src/JavaNameAndType2.st Mon Oct 15 21:26:25 2012 +0000 @@ -213,6 +213,12 @@ !JavaNameAndType2 methodsFor:'resolving'! +preresolve + self resolve + + "Created: / 15-10-2012 / 23:09:46 / Jan Vrany " +! + resolve nameCache := constantPool at: nameIndex. descriptorCache := constantPool at: descriptorIndex. diff -r c23e0b74bc1c -r 0d275432230d src/JavaRef2.st --- a/src/JavaRef2.st Mon Oct 15 19:59:35 2012 +0000 +++ b/src/JavaRef2.st Mon Oct 15 21:26:25 2012 +0000 @@ -234,6 +234,26 @@ "Modified (comment): / 21-02-2012 / 10:20:46 / Jan Vrany " ! +preResolve + "Pre-resolve some caches. Called when the constant pool + is loaded. MUST NOT load new nor modify any existing class!!!!!! + Ask JV for what this is needed" + + "Nothing by default" + + "Created: / 15-10-2012 / 23:13:53 / Jan Vrany " +! + +preresolve + "Pre-resolve some caches. Called when the constant pool + is loaded. MUST NOT load new nor modify any existing class!!!!!! + Ask JV for what this is needed" + + "Nothing by default" + + "Created: / 15-10-2012 / 23:08:30 / Jan Vrany " +! + resolve " Do it all method - resolves current reference and returns expected element (JavaMethod, JavaField etc.) diff -r c23e0b74bc1c -r 0d275432230d src/libjava.rc --- a/src/libjava.rc Mon Oct 15 19:59:35 2012 +0000 +++ b/src/libjava.rc Mon Oct 15 21:26:25 2012 +0000 @@ -3,7 +3,7 @@ // automagically generated from the projectDefinition: stx_libjava. // VS_VERSION_INFO VERSIONINFO - FILEVERSION 6,2,2089,2089 + FILEVERSION 6,2,2098,2098 PRODUCTVERSION 6,2,3,1 #if (__BORLANDC__) FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE @@ -20,12 +20,12 @@ BEGIN VALUE "CompanyName", "eXept Software AG\0" VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0" - VALUE "FileVersion", "6.2.2089.2089\0" + VALUE "FileVersion", "6.2.2098.2098\0" VALUE "InternalName", "stx:libjava\0" VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\b SWING Research Group, Czech Technical University In Prague\0" VALUE "ProductName", "Smalltalk/X\0" VALUE "ProductVersion", "6.2.3.1\0" - VALUE "ProductDate", "Mon, 15 Oct 2012 13:35:56 GMT\0" + VALUE "ProductDate", "Mon, 15 Oct 2012 21:24:48 GMT\0" END END