Changeset 804bf677 for tests/collections


Ignore:
Timestamp:
Oct 13, 2021, 9:52:02 PM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
7b0e8b7
Parents:
4b3b352
Message:

String hybrid: Basic cases of solo alloc now working

Location:
tests/collections
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/collections/.expect/string-ctx-manage.txt

    r4b3b352 r804bf677  
    33hi
    44bye
     5hi
    56done
  • tests/collections/string-ctx-manage.cfa

    r4b3b352 r804bf677  
    2424    sout | y; // hi
    2525
    26     x = "bye";                                                     //.... Bookmark 9/30 shallow:  surprisingly this step failed
     26    x = "bye";
    2727    y = x; // y was already in different context => eager copy
    2828    assert( y.inner->Handle.s != x.inner->Handle.s);
     
    3030}
    3131
    32 void failSoloAlloc() {
     32void soloAlloc() {
    3333    string x = "hi";
    3434    string_sharectx c = { NO_SHARING };
     35   
     36    string y = x; // y allocates into private pad, implying eager copy
     37    assert( y.inner->Handle.s != x.inner->Handle.s);
     38    sout | y; // hi
    3539
    36     // want: allocation into private pad, with forced eager copy into it
    37     // got: assertion failure, "Need to implement private contexts"
    38     string y = x;
     40    // -- following hits "need to implement actual growth"
     41    //    and it passes if I modify string_res.cfa to oversize the owned heaps
     42
     43    // x = "bye";
     44    // y = x; // into private y => eager copy
     45    // assert( y.inner->Handle.s != x.inner->Handle.s);
     46    // sout | y; // bye
    3947}
    4048
    41 volatile bool showFail = false;
    4249
    4350int main() {
    4451    baseline();
    4552    eagerCopy();
    46     if (showFail) {
    47         failSoloAlloc();
    48     }
     53    soloAlloc();
    4954    printf("done\n");
    5055}
Note: See TracChangeset for help on using the changeset viewer.