VM Maker Inbox: VMMaker.oscog-eem.2537.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker Inbox: VMMaker.oscog-eem.2537.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker Inbox:
http://source.squeak.org/VMMakerInbox/VMMaker.oscog-eem.2537.mcz

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

Name: VMMaker.oscog-eem.2537
Author: eem
Time: 24 July 2019, 1:01:33.831274 pm
UUID: 0518f049-7c3c-4dfa-8e2d-04e2cf2eee40
Ancestors: VMMaker.oscog-eem.2536

Bite the bulklet and embrace methodReturnString:.
Better this is well implemented once in the interpreter than potentially badly implemented many times in plugins.  Check the C string argument for null to avoid passing null to strlen:, which can crash.

=============== Diff against VMMaker.oscog-eem.2536 ===============

Item was changed:
  ----- Method: InterpreterProxy>>methodReturnString: (in category 'stack access') -----
  methodReturnString: aCString
+ "Attempt to answer a ByteString for a given C string as the result of a primitive."
- "Sets the return value for a method."
- "THIS IS DUBIOUS!!  CONSIDER REMOVING IT!!  RIGHT NOW IT IS NOT SENT."
  <var: 'aCString' type: #'char *'>
+ aCString
+ ifNil: [primFailCode := PrimErrOperationFailed]
+ ifNotNil:
+ [(self stringForCString: aCString)
+ ifNil: [primFailCode := PrimErrNoMemory]
+ ifNotNil: [:result| self pop: argumentCount+1 thenPush: result]].
- (self stringForCString: aCString)
- ifNil: [primFailCode := PrimErrNoMemory]
- ifNotNil: [:result| self pop: argumentCount+1 thenPush: result].
  ^0!

Item was changed:
  ----- Method: StackInterpreter>>methodReturnString: (in category 'plugin primitive support') -----
  methodReturnString: aCString
+ "Attempt to answer a ByteString for a given C string as the result of a primitive."
- "Sets the return value for a method."
  <var: 'aCString' type: #'char *'>
+ aCString
+ ifNil: [primFailCode := PrimErrOperationFailed]
+ ifNotNil:
+ [(self stringForCString: aCString)
+ ifNil: [primFailCode := PrimErrNoMemory]
+ ifNotNil: [:result| self pop: argumentCount+1 thenPush: result]].
- self pop: argumentCount+1 thenPush: (objectMemory stringForCString: aCString).
  ^0!