Verify "logical mode" properties hold #138
Comments
At 2017-09-14T23:46:31Z, fpizlo@apple.com wrote: Then you can do pointer erasure. Every time you see a use of a pointer, figure out where it points, and then you will emit code that directly talks to that variable. |
At 2017-09-14T23:57:45Z, fpizlo@apple.com wrote:
Actually, I think that the interpreter needs to do this as well - but only when the language is not in logical mode. I'm about to make the storage locations of temporary expressions slightly observable. Consider this:
Obviously, we'd want this to work in this case:
I think that the easiest way to get there is to say that every temporary storage location gets its own predetermined EBuffer, as opposed to allocating EBuffers dynamically during execution. This ensures that if you do this:
and then this:
or even this:
then at least you will get very well defined behavior:
I think that the places where storage locations are created are exactly those places where the interpreter currently calls snapshot(). |
At 2017-09-15T02:08:59Z, fpizlo@apple.com wrote:
|
At 2017-10-28T00:23:42Z, mmaxfield@apple.com wrote: thread T* operator&[](thread vec2* foo, uint index) |
At 2017-10-28T00:37:22Z, fpizlo@apple.com wrote:
vec2’s ander will be compiled as an intrinsic anyway. Therefore, I recommend just turning off logical validation in the stdlib. |
At 2017-10-28T00:46:45Z, mmaxfield@apple.com wrote:
I guess we could fix this by:
If we enforce these two rules, we can, in the compiler, special-case these resultant patterns, and make the DereferenceExpressions and the MakePtrExpressions cancel out. Or, maybe since we inline everything anyway, we could just punch through any FunctionLikeBlocks and cancel out any pairs of DereferenceExpressions and the MakePtrExpressions we find. |
At 2017-10-28T00:47:01Z, mmaxfield@apple.com wrote:
I think we're supporting anders for arbitrary user-defined structs, right? |
At 2017-10-28T01:37:47Z, mmaxfield@apple.com wrote: |
At 2017-10-28T02:37:35Z, mmaxfield@apple.com wrote:
We'd need to be able punch through:
|
At 2017-10-28T02:49:40Z, mmaxfield@apple.com wrote:
Presumably we'd also want to punch through nested function calls |
At 2017-10-28T02:57:29Z, mmaxfield@apple.com wrote:
Also things like *foo() = *bar() |
At 2017-10-28T04:09:15Z, mmaxfield@apple.com wrote: thread int** foo(thread int** x, thread int** y, ...) { thread int* bar(thread int* x, thread int* y, ...) { ... int x; |
At 2017-10-28T04:27:34Z, mmaxfield@apple.com wrote:
If you're allowed to put pointers inside structs, this would be something like StructA foo(StructB x, ...) { StructC bar(StructD y, ...) { ... bar(instanceOfStructD, ...).e = 5; |
At 2017-10-28T04:30:22Z, mmaxfield@apple.com wrote:
whoops, I meant *bar(instanceOfStructD, ...).e = 5; |
At 2017-10-28T04:36:17Z, mmaxfield@apple.com wrote:
I guess it could be (*(bar(instanceOfStructD, ...).e)).f = 5; |
At 2017-10-28T04:52:07Z, mmaxfield@apple.com wrote: The requirement of not being able to assign to a pointer, however, still stands. |
At 2017-10-28T05:10:19Z, mmaxfield@apple.com wrote:
I guess this is a little bit moot because right now we don't have object literals, so a pointer inside an object will always be null. However, we want to add object literals. https://bugs.webkit.org/show_bug.cgi?id=178978 This will be pretty powerful. For example, you can have a struct with a pointer inside it, pass that by reference to a function (by taking a pointer to it), then that function can return a pointer to a field inside the struct, and the caller can then assign to that field (as long as the field doesn't itself contain a pointer). |
At 2017-10-30T07:20:48Z, mmaxfield@apple.com wrote: |
At 2018-08-30T00:06:06Z, mmaxfield@apple.com wrote: |
At 2018-08-30T00:06:09Z, mmaxfield@apple.com wrote: |
At 2018-09-24T17:41:49Z, mmaxfield@apple.com wrote: |
Migrated from https://bugs.webkit.org/show_bug.cgi?id=176967:
At 2017-09-14T23:30:31Z, fpizlo@apple.com wrote:
In this mode:
thread references (thread T^ and thread T[]) no longer get exempted from the isPrimitive check. Currently it's OK to have a pointer to a pointer, if it's a thread pointer. So, thread T^^ is OK but device T^^ is not OK. But, neither of these things are OK in logical, since storing to a pointer to a pointer would break the no-Phi rule of the underlying pointer. It would be like an assignment.
bunch of control flow constraints on how pointers flow through the program.
The text was updated successfully, but these errors were encountered: