The Trunk: CollectionsTests-nice.258.mcz

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

The Trunk: CollectionsTests-nice.258.mcz

commits-2
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.258.mcz

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

Name: CollectionsTests-nice.258
Author: nice
Time: 11 November 2015, 2:13:17.734 am
UUID: ae069e82-965d-43ce-85ff-82cc44b73d48
Ancestors: CollectionsTests-ul.257

Use fresh new withoutPrimitive utility, and let one more test pass in Spur.

=============== Diff against CollectionsTests-ul.257 ===============

Item was changed:
  ----- Method: StringTest>>testFindSubstringInStartingAtMatchTable (in category 'tests - finding') -----
  testFindSubstringInStartingAtMatchTable
 
  | str tbl cm |
  str := 'hello '.
  tbl := String classPool at: #CaseSensitiveOrder.
  self assert: (str findSubstring: ' ' in: str startingAt: 1 matchTable: tbl) = 6.
  self assert: (str findSubstring: 'q' in: str startingAt: 1 matchTable: tbl) = 0.
  self assert: (str findSubstring: 'q' in: str startingAt: -1 matchTable: tbl) = 0.
  self assert: (str findSubstring: ' ' in: str startingAt: -1 matchTable: tbl) = 6.
 
 
  "The next test ensures that the fallback code works just as well"
+ cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) withoutPrimitive.
- cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) in: [:origMethod |
- "Adapted from CompiledMethod>>#newFrom: "
- | inst header|
- header := origMethod header bitAnd: 16r1FF bitInvert.
- "CompiledMethod newFrom: CompiledMethod class >> #newFrom:"
- inst := CompiledMethod
- newMethod: origMethod basicSize - origMethod initialPC + 1
- header: header.
- 1 to: origMethod numLiterals do: [:index| inst literalAt: index put: (origMethod literalAt: index)].
- origMethod initialPC to: origMethod size do: [:index | inst at: index put: (origMethod at: index)].
- inst postCopy].
  self assert: (cm valueWithReceiver: str arguments: {' '. str. 1. tbl}) = 6.
  self assert: (cm valueWithReceiver: str arguments: {'q'. str. 1. tbl}) = 0.
  self assert: (cm valueWithReceiver: str arguments: {'q'. str. -1. tbl}) = 0.
  self assert: (cm valueWithReceiver: str arguments: {' '. str. -1. tbl}) = 6.
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-nice.258.mcz

Nicolas Cellier
I think this was the first time I saw #in:
There are still a few senders, so someone else might discover the pattern despite this removal...
A good point of #in: usage here was to make it clear that we were kind of inlining a method per se.

2015-11-11 2:13 GMT+01:00 <[hidden email]>:
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.258.mcz

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

Name: CollectionsTests-nice.258
Author: nice
Time: 11 November 2015, 2:13:17.734 am
UUID: ae069e82-965d-43ce-85ff-82cc44b73d48
Ancestors: CollectionsTests-ul.257

Use fresh new withoutPrimitive utility, and let one more test pass in Spur.

=============== Diff against CollectionsTests-ul.257 ===============

Item was changed:
  ----- Method: StringTest>>testFindSubstringInStartingAtMatchTable (in category 'tests - finding') -----
  testFindSubstringInStartingAtMatchTable

        | str tbl cm |
        str := 'hello '.
        tbl := String classPool at: #CaseSensitiveOrder.
        self assert: (str findSubstring: ' ' in: str startingAt: 1 matchTable: tbl) = 6.
        self assert: (str findSubstring: 'q' in: str startingAt: 1 matchTable: tbl) = 0.
        self assert: (str findSubstring: 'q' in: str startingAt: -1 matchTable: tbl) = 0.
        self assert: (str findSubstring: ' ' in: str startingAt: -1 matchTable: tbl) = 6.


        "The next test ensures that the fallback code works just as well"
+       cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) withoutPrimitive.
-       cm := (ByteString >> #findSubstring:in:startingAt:matchTable:) in: [:origMethod |
-               "Adapted from CompiledMethod>>#newFrom: "
-               | inst header|
-               header := origMethod header bitAnd: 16r1FF bitInvert.
-               "CompiledMethod newFrom: CompiledMethod class >> #newFrom:"
-               inst := CompiledMethod
-                       newMethod: origMethod basicSize - origMethod initialPC + 1
-                       header: header.
-               1 to: origMethod numLiterals do: [:index| inst literalAt: index put: (origMethod literalAt: index)].
-               origMethod initialPC to: origMethod size do: [:index | inst at: index put: (origMethod at: index)].
-               inst postCopy].
        self assert: (cm valueWithReceiver: str arguments: {' '. str. 1. tbl}) = 6.
        self assert: (cm valueWithReceiver: str arguments: {'q'. str. 1. tbl}) = 0.
        self assert: (cm valueWithReceiver: str arguments: {'q'. str. -1. tbl}) = 0.
        self assert: (cm valueWithReceiver: str arguments: {' '. str. -1. tbl}) = 6.
  !





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: CollectionsTests-nice.258.mcz

Tobias Pape
In reply to this post by commits-2
Thank you!

Best regard
        -Tobias

On 11.11.2015, at 01:13, [hidden email] wrote:

> Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
> http://source.squeak.org/trunk/CollectionsTests-nice.258.mcz
>
> ==================== Summary ====================
>
> Name: CollectionsTests-nice.258
> Author: nice
> Time: 11 November 2015, 2:13:17.734 am
> UUID: ae069e82-965d-43ce-85ff-82cc44b73d48
> Ancestors: CollectionsTests-ul.257
>
> Use fresh new withoutPrimitive utility, and let one more test pass in Spur.
>
> =============== Diff against CollectionsTests-ul.257 ===============
>
> Item was changed: