FFI: FFI-Tests-mt.33.mcz

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

FFI: FFI-Tests-mt.33.mcz

commits-2
Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.33.mcz

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

Name: FFI-Tests-mt.33
Author: mt
Time: 14 May 2021, 4:53:49.688417 pm
UUID: 9752680b-6c05-e345-84b1-56b5f5117194
Ancestors: FFI-Tests-mt.32

Fixes a broken #free in one test which crashed the VM.

=============== Diff against FFI-Tests-mt.32 ===============

Item was changed:
  ----- Method: FFIAllocateExternalTests>>test06ArrayOfPointers (in category 'tests - array') -----
  test06ArrayOfPointers
+ "Overwritten because in external memory, we can manage pointer indirections. Be sure to not log the inner allocation because the array's #free will recursively free the memory."
- "Overwritten because in external memory, we can manage pointer indirections."
 
  | array type string|
  type := self lookupType: 'char*'.
  array := self allocate: type size: 5.
  self assert: 5 * type byteSize equals: array byteSize.
 
+ string := array contentType asNonPointerType allocateExternal: 7.
- string := self allocate: array contentType asNonPointerType size: 7.
  string setSize: nil. "Not needed due to null-termination."
 
  string at: 1 put: $S.
  string at: 2 put: $Q.
  string at: 3 put: $U.
  string at: 4 put: $E.
  string at: 5 put: $A.
  string at: 6 put: $K.
  string at: 7 put: Character null. "Not needed here because memory was zero from the beginning."
  self assert: 'SQUEAK' equals: string fromCString.
 
  array at: 1 put: string.
  self assert: 'SQUEAK' equals: array first fromCString.!