-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which forms of extending loads and truncating stores do we want? #139
Comments
Seems reasonable, but wouldn't we still need opcodes for each legal permutation? If so I think we should still enumerate them. If this does impact opcode space I think we should limit the permutations further than you are suggesting, because for example |
FWIW, having module-local index spaces should allow the compiler to order ops so that all the hot ops take a single byte (assuming a variable-length encoding of opcodes)). This is what makes me less worried about bloating our opcode space. |
Yeah, and I'm not all that concerned about opcode space (probably shouldn't have mentioned it), but I'd still prefer we avoid adding ops which are completely useless. |
Definitely agreed about not having "dead" ops. |
On Wed, Jun 10, 2015 at 9:15 PM, Dan Gohman notifications@github.com
|
My expectation is that global variables would have (misnamed, perhaps) local types, not memory types. |
On Thu, Jun 11, 2015 at 8:21 AM, Luke Wagner notifications@github.com
|
Good point. For MVP, I expect we don't even really need globals; before dynamic loading (and thus the need for a GOT), the only advantage they have is that they can't be aliased by loads/stores, but I expect that's insignificant (LLVM will have already taken advantage of this). Once we have dynamic loading, the question is how to efficiently implement global data since you can't have modules just sticking their globals at fixed offsets in memory. The more I think about it, the more I think about variations from what is currently in AstSemantics.md (e.g., having globals just be aliased names for locations in the full heap that are auto-relocated and thus more efficient than what you could do otherwise) so I wonder if we should just take globals out of the MVP and make them part of the dynamic linking feature (or threads, which also hit upon the same issues via TLS and I hope have a symmetric solution). |
@lukewagner sgtm. I think TLS should be discussed separately from globals, though the solution may be similar. There are a bunch of different usecases for TLS, some of which we need to respect and some I hope to change. Could you file bugs for both, capturing your thoughts? |
With globals split off (hopefully removed, if #154 makes sense), then that just leaves @MikeHolman's point about explicitly enumerating the set of ops instead of specifying a Cartesian product where some of the tuples don't make sense. |
At some point we want to make room for SIMD memory accesses, right? So it For loads, nother option is to make implicit extension/truncation dependent Load[Int8] in a Int32 context => legal, implicit sign extension Since we already need to do verification when decoding, we could just allow On Fri, Jun 12, 2015 at 9:01 AM, Luke Wagner notifications@github.com
|
The SIMD loads won't have builtin conversions, so in the spec syntax we have at the moment, they'll look like int32x4.load[int32x4] and so on. It's possible that this will evolve further over time, but for now it looks like we have what we need. With #175, we have the operators we want. Deciding how to encode them will be a topic for another day. |
#135 adds a Load[Int64] and Store[Int64] which presumably load and store with a 64-bit memory location with no extension or truncation. If we do nothing else, we should clarify that this is the case, but we may also consider the following:
Split Load into Int32Load, Int64Load, Float32Load, Float64Load. They'd still support memory types (though the float versions would only support float memory types, and integer versions would only support integer types). This would:
And analogous changes for Store.
I imagine the main argument against this will be redundancy in functionality. Why have operations that can be built out of other operations and pattern-matched in implementations (since it's often a single instruction)? My answers are that these operators will be very commonly used, and so they will be appreciated by humans reading the code, and they'll be easier for very-simple implementations to emit good code for.
The text was updated successfully, but these errors were encountered: