[Pkg] The Trunk: Kernel-eem.951.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 16 17:46:32 UTC 2015


Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.951.mcz

==================== Summary ====================

Name: Kernel-eem.951
Author: eem
Time: 16 September 2015, 10:46:01.276 am
UUID: 43df7732-200e-421c-9be0-2c6d33244069
Ancestors: Kernel-eem.950

Implement callPrimitive: in the simulator so that, for example, the debugger does not get into an infinite recursion when accepting a new version of a method that has a primitive.

Simplify skipCallPrimitive.

Fix classCommentBlank so that it always answers the blank, even when there's an existing comment (shurely shome mistake, hic, ed)..

=============== Diff against Kernel-eem.950 ===============

Item was changed:
  ----- Method: ClassDescription>>classCommentBlank (in category 'accessing comment') -----
  classCommentBlank
  
+ 	^String streamContents:
+ 		[:stream|
+ 		 stream
+ 			nextPutAll: 'A';
+ 			nextPutAll: (self name first isVowel ifTrue: ['n '] ifFalse: [' ']);
+ 			nextPutAll: self name;
+ 			nextPutAll: ' is xxxxxxxxx.';
+ 			cr; cr;
+ 			nextPutAll: 'Instance Variables'.
- 	| existingComment stream |
- 	existingComment := self theNonMetaClass organization classComment.
- 	existingComment isEmpty
- 		ifFalse: [^existingComment].
  
+ 		 self instVarNames asSortedCollection do: [:each |
+ 			stream
+ 				crtab; nextPutAll: each;
+ 				nextPut: $:;
+ 				tab: 2;
+ 				nextPutAll: '<Object>'].
+ 		  stream cr.
+ 		  self instVarNames asSortedCollection do: [:each |
+ 			stream
+ 				cr; nextPutAll: each;
+ 				crtab; nextPutAll: '- xxxxx'; cr]]!
- 	stream := WriteStream on: (String new: 100).
- 	stream
- 		nextPutAll: 'A';
- 		nextPutAll: (self name first isVowel ifTrue: ['n '] ifFalse: [' ']);
- 		nextPutAll: self name;
- 		nextPutAll: ' is xxxxxxxxx.';
- 		cr; cr;
- 		nextPutAll: 'Instance Variables'.
- 
- 	self instVarNames asSortedCollection do: [:each |
- 		stream
- 			cr; tab; nextPutAll: each;
- 			nextPut: $:;
- 			tab; tab;
- 			nextPutAll: '<Object>'].
- 
- 	stream cr.
- 	self instVarNames asSortedCollection do: [:each |
- 		stream
- 			cr; nextPutAll: each;
- 			cr; tab; nextPutAll: '- xxxxx'; cr].
- 
- 	^stream contents!

Item was changed:
  ----- Method: InstructionStream>>skipCallPrimitive (in category 'decoding') -----
  skipCallPrimitive
+ 	"If the receiver's method starts with a callPrimitive: bytecode, skip it."
+ 	| method encoderClass callPrimitiveCode |
+ 	method := self method.
+ 	encoderClass := method  encoderClass.
+ 	callPrimitiveCode := encoderClass callPrimitiveCode.
+ 	(method byteAt: pc) = callPrimitiveCode ifTrue:
+ 		[pc := pc + (encoderClass bytecodeSize: callPrimitiveCode)]!
- 	self method encoderClass callPrimitiveCode ifNotNil:
- 		[:callPrimitiveCode|
- 		(self method byteAt: pc) = callPrimitiveCode ifTrue:
- 			[pc := pc + (self method encoderClass bytecodeSize: callPrimitiveCode)]]!

Item was added:
+ ----- Method: MethodContext>>callPrimitive: (in category 'instruction decoding') -----
+ callPrimitive: primNumber
+ 	"Evaluate the primitive, either normal or inlined, and answer the new context resulting from that
+ 	 (either the sender if a successful non-inlined primitive, or the current context, if not)."
+ 	| maybePrimFailToken |
+ 	primNumber >= (1 << 15) ifTrue: "Inlined primitive, cannot fail"
+ 		[^self callInlinedPrimitive: primNumber].
+ 	maybePrimFailToken := self doPrimitive: primNumber
+ 								method: method
+ 								receiver: receiver
+ 								args: self arguments.
+ 	"Normal primitive. Always at the beginning of methods."
+ 	(self isPrimFailToken: maybePrimFailToken) ifFalse: "On success return the result"
+ 		[^self methodReturnTop].
+ 	"On failure, store the error code if appropriate and keep interpreting the method"
+ 	(method encoderClass isStoreAt: pc in: method) ifTrue:
+ 		[self at: stackp put: maybePrimFailToken last].
+ 	^self!



More information about the Packages mailing list