[squeak-dev] The Inbox: Kernel-ul.593.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 7 20:55:27 UTC 2011


A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ul.593.mcz

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

Name: Kernel-ul.593
Author: ul
Time: 7 June 2011, 10:04:12.998 pm
UUID: 531bf643-4166-a040-82f2-47ecd9fef43b
Ancestors: Kernel-wiz.592

- CompiledMethod >> #valueWithReceiver:arguments: evaluates the method without sending any messages to the receiver. This is done by CompiledMethod class >> #receiver:withArguments:executeMethod: which uses primitive 188 with three arguments (already implemented by CogVMs). If the primitive fails the fallback mechanism tries to use primitive 188 with two arguments (supported by all VMs)
- updated ContextPart >> #doPrimitive:method:receiver:args: to support both two and three arguments variants of primitive 188 and added support for primitive 189, so it won't "escape from the debugger" anymore.

=============== Diff against Kernel-wiz.592 ===============

Item was added:
+ ----- Method: CompiledMethod class>>receiver:withArguments:executeMethod: (in category 'evaluating') -----
+ receiver: receiver withArguments: argArray executeMethod: compiledMethod
+ 	"Execute compiledMethod against the receiver and the arguments in argArray"
+ 
+ 	<primitive: 188>
+ 	^receiver withArgs: argArray executeMethod: compiledMethod!

Item was changed:
  ----- Method: CompiledMethod>>valueWithReceiver:arguments: (in category 'evaluating') -----
  valueWithReceiver: aReceiver arguments: anArray 
  
+ 	^self class receiver: aReceiver withArguments: anArray executeMethod: self!
- 	^ aReceiver withArgs: anArray executeMethod: self!

Item was changed:
  ----- Method: ContextPart>>doPrimitive:method:receiver:args: (in category 'private') -----
  doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments 
  	"Simulate a primitive method whose index is primitiveIndex.  The
  	 simulated receiver and arguments are given as arguments to this message.
  	 Any primitive which provikes execution needs to be intercepted and simulated
  	 to avoid execution running away."
  
  	| value |
  	<primitive: 19> "Simulation guard"
  	"If successful, push result and return resuming context,
  		else ^ PrimitiveFailToken"
  	(primitiveIndex = 19) ifTrue:
  		[ToolSet 
  			debugContext: self
  			label:'Code simulation error'
  			contents: nil].
  
  	"ContextPart>>blockCopy:; simulated to get startpc right"
  	(primitiveIndex = 80 and: [receiver isKindOf: ContextPart]) 
  		ifTrue: [^self push: ((BlockContext newForMethod: receiver method)
  						home: receiver home
  						startpc: pc + 2
  						nargs: (arguments at: 1))].
  	(primitiveIndex = 81 and: [receiver isMemberOf: BlockContext]) "BlockContext>>value[:value:...]"
  		ifTrue: [^receiver pushArgs: arguments from: self].
  	(primitiveIndex = 82 and: [receiver isMemberOf: BlockContext]) "BlockContext>>valueWithArguments:"
  		ifTrue: [^receiver pushArgs: arguments first from: self].
  	primitiveIndex = 83 "afr 9/11/1998 19:50" "Object>>perform:[with:...]"
  		ifTrue: [^self send: arguments first to: receiver
  					with: arguments allButFirst
  					super: false].
  	primitiveIndex = 84 "afr 9/11/1998 19:50" "Object>>perform:withArguments:"
  		ifTrue: [^self send: arguments first to: receiver
  					with: (arguments at: 2)
  					super: false].
+ 	primitiveIndex = 188 ifTrue: [
+ 		arguments size = 2 ifTrue: [ "eem 5/27/2008 11:10 Object>>withArgs:executeMethod:"
+ 			^MethodContext
+ 				sender: self
+ 				receiver: receiver
+ 				method: (arguments at: 2)
+ 				arguments: (arguments at: 1) ].
+ 		arguments size = 3 ifTrue: [ "CompiledMethod class >> #receiver:withArguments:executeMethod:"
+ 			^MethodContext
+ 				sender: self
+ 				receiver: (arguments at: 1)
+ 				method: (arguments at: 3)
+ 				arguments: (arguments at: 2) ] ].
+ 	primitiveIndex = 189 ifTrue: [ "Object >> (#with:)*executeMethod"
+ 		^MethodContext
- 	primitiveIndex = 188 ifTrue: "eem 5/27/2008 11:10 Object>>withArgs:executeMethod:"
- 		[^MethodContext
  			sender: self
  			receiver: receiver
+ 			method: arguments last
+ 			arguments: arguments allButLast ].
- 			method: (arguments at: 2)
- 			arguments: (arguments at: 1)].
  
  	"Closure primitives"
  	(primitiveIndex = 200 and: [receiver == self]) ifTrue:
  		"ContextPart>>closureCopy:copiedValues:; simulated to get startpc right"
  		[^self push: (BlockClosure
  						outerContext: receiver
  						startpc: pc + 2
  						numArgs: arguments first
  						copiedValues: arguments last)].
  	((primitiveIndex between: 201 and: 205)			 "BlockClosure>>value[:value:...]"
  	or: [primitiveIndex between: 221 and: 222]) ifTrue: "BlockClosure>>valueNoContextSwitch[:]"
  		[^receiver simulateValueWithArguments: arguments caller: self].
  	primitiveIndex = 206 ifTrue:						"BlockClosure>>valueWithArguments:"
  		[^receiver simulateValueWithArguments: arguments first caller: self].
  
  	primitiveIndex = 120 ifTrue:[ "FFI method"
  		value := meth literals first tryInvokeWithArguments: arguments.
  	] ifFalse:[
  		arguments size > 6 ifTrue: [^PrimitiveFailToken].
  		value := primitiveIndex = 117 "named primitives"
  				ifTrue:[self tryNamedPrimitiveIn: meth for: receiver withArgs: arguments]
  				ifFalse:[receiver tryPrimitive: primitiveIndex withArgs: arguments].
  	].
  	^value == PrimitiveFailToken
  		ifTrue: [PrimitiveFailToken]
  		ifFalse: [self push: value]!




More information about the Squeak-dev mailing list