Hi, On 03/16/2015 12:43 PM, Peter Levart wrote: > On 03/16/2015 01:25 PM, Andrew Haley wrote: >> We need a flag which defaults to whatever is right for the platform >> (so it must be set in the back ends) but can be overridden by testing. >> What we have right now fits that requirement. I can see no way to do >> what I think you're asking for with the current option machinery. I >> certainly don't think this should be a product flag. > > I think the confusion is caused by UseUnalignedAccesses flag (part of a > public interface unless it is experimental - the command line options) > that is used internally to communicate the cpu default to the > implementation of Unsafe.unalignedAccess() method. What if: > > - you define an internal constant SUPPORTS_UNALIGNED_ACCESSES (I don't > know how to do that correctly) in per-cpu vm_version_cpu.hpp files.
It can not be a constant: on some platforms it's something that you read from a configuration register. But I can do something like that. > - rename UseUnalignedAccesses to EmulateUnalignedAccesses (reverse the > meaning, so that default can be false which must be for experimental > options) > > - implement Unsafe.unalignedAccess() to return: > SUPPORTS_UNALIGNED_ACCESSES && !EmulateUnalignedAccesses ... I'm not sure what EmulateUnalignedAccesses means; I guess it must mean that we don't generate code which does unaligned accesses. But is that what "emulate unaligned accesses" means to you? I'm going to go with DisableUnalignedAccesses, because I at least know what that means. :-) Thanks, Andrew.