Giter Club home page Giter Club logo

Comments (4)

Dante-Broggi avatar Dante-Broggi commented on May 30, 2024

Considered relevant during sync: https://stackoverflow.com/questions/9116951/what-is-the-meaning-of-restrict-in-pthread-create

from ponyc.

jemc avatar jemc commented on May 30, 2024

I think I was convinced over the duration of the sync call that this is indeed a spec violation (but I may still be under-informed on the issue, so I could be wrong). That is, I was convinced that some future version of clang could add an optimization that leverages the restrict qualifier in a way that breaks our usage of pthread_create.

The violation seems to be that our first arg and final arg to pthread_create are overlapping in memory, because the pony_thread_id_t struct reference we pass as the first arg is embedded within the scheduler_t reference which we pass as the final arg. Because they address an overlapping memory region, certain optimizations allowed by the restrict qualifier could cause a copy operation to clobber the view as seen by one or the other.

One way to avoid this would be to not embed the pony_thread_id_t - we could, for example, pool-allocate it instead. Or keep it in a separate struct array perhaps.

from ponyc.

SeanTAllen avatar SeanTAllen commented on May 30, 2024

I'm not convinced this is an issue. We should discuss together at some point @jemc. I agree it is a violation of the quoted posix spec but I'm not sure that matters, what matters is whether that spec is implemented by our target platforms.

from ponyc.

SeanTAllen avatar SeanTAllen commented on May 30, 2024

Joe and I discussed at sync today. We both agree this could be an issue.

I'm more worried that someone fixing this issue is likely to introduce bugs than clang and other compilers will start to follow this portion of the spec. I'm fine with someone fixing the issue herein so long as there is a test plan to make sure no bugs are introduced with the change to address the spec violation.

from ponyc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.