Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.307.mcz ==================== Summary ==================== Name: Compiler-eem.307 Author: eem Time: 25 August 2015, 4:08:43.685 pm UUID: 01d3dbd8-8e6e-49b4-9a85-abdfdb847729 Ancestors: Compiler-ul.306 Make the literal limit in the compiler a funciton of both the bytecode set and CompiledMethod's implementation limit. =============== Diff against Compiler-ul.306 =============== Item was changed: ----- Method: Encoder>>allLiterals (in category 'results') ----- allLiterals addedSelectorAndMethodClassLiterals ifFalse: [addedSelectorAndMethodClassLiterals := true. "Put the optimized selectors in literals so as to browse senders more easily" optimizedSelectors := optimizedSelectors reject: [:e| literalStream originalContents hasLiteral: e]. optimizedSelectors isEmpty ifFalse: [ "Use one entry per literal if enough room, else make anArray" + literalStream position + optimizedSelectors size + 2 >= self maxNumLiterals - literalStream position + optimizedSelectors size + 2 > 255 ifTrue: [self litIndex: optimizedSelectors asArray] ifFalse: [optimizedSelectors do: [:e | self litIndex: e]]]. "Add a slot for selector or MethodProperties" self litIndex: nil. self litIndex: self associationForClass]. ^literalStream contents! Item was changed: ----- Method: Encoder>>litIndex: (in category 'encoding') ----- litIndex: literal | p | p := literalStream position. + p = self maxNumLiterals ifTrue: + [self notify: 'More than ', self maxNumLiterals printString, ' literals referenced.\You must split or otherwise simplify this method.\The ' withCRs, (self maxNumLiterals + 1) printString, 'th literal is: ', literal printString. ^nil]. + "Would like to show where it is in the source code, + but that info is hard to get." - p = 256 ifTrue: - [self notify: 'More than 256 literals referenced. - You must split or otherwise simplify this method. - The 257th literal is: ', literal printString. ^nil]. - "Would like to show where it is in the source code, - but that info is hard to get." literalStream nextPut: literal. + ^p! - ^ p! Item was added: + ----- Method: Encoder>>maxIndexableLiterals (in category 'accessing') ----- + maxIndexableLiterals + "Answer the maximum number of literals supported by the receiver's + bytecode set. This is a nominal value based on the Blue Book bytecode + set; subclasses answer a more accurate value." + ^63! Item was added: + ----- Method: Encoder>>maxNumLiterals (in category 'accessing') ----- + maxNumLiterals + ^CompiledMethod maxNumLiterals min: self maxIndexableLiterals! Item was added: + ----- Method: EncoderForV3>>maxIndexableLiterals (in category 'bytecode generation') ----- + maxIndexableLiterals + "This bytecode set can index up to 256 literals." + ^256! |
Free forum by Nabble | Edit this page |