This test was trying to assert that no slow TYPEP call existed. Since positive
assertions are generally better than negative ones, it instead asserted that
exactly one LAYOUT existed, which would be expected for %INSTANCE-TYPEP.
And it used to be meaningful because:
* MUTEX stored its owner as a THREAD instance, not a raw word, therefore
* MUTEX and THREAD were mutually referential types.
The compiler could not efficiently deal with a forward-referenced types in
whichever defstruct appeared first in the defining file. So either it couldn't
optimize TYPEP in (SETF OWNER) or (SETF THREAD-INTERRUPTIONS-LOCK) depending
on which defstruct appeared first. That defect was eventually rectified.
However, now the test is just bad, as neither of the above points hold.
The feature was checked-in without being completed and it's already
bitrotted. Wrapper is folded back into layout name-wise for the most
part now because that's how it's been effectively functioning. There
are still probably more cleanups to be done, related to this, but this
takes care of most of the dead code and unnecessary layers of
alternate names/indirection.
The rationale and mechanics of this change have been adequately hashed
out on sbcl-devel, so nothing further to add here other than that a few
renamings of local variables from LAYOUT to WRAPPER may be worthwhile
depending on how other maintainers feel about the current state.
There are no user-observable differences in the normal configuration.
Compare layouts by a stable ID instead of the address.
As can be seen from the "perf stat" results accompanying the design notes
in the doc directory, the time for self-build on x86-64 decreases somewhere
between 3% to 8% depending on the build phase.
Since this change is not specific to the compiler, but just type-checking
in general, the results suggest that users may similarly see anything in
that range of speedup for code making heavy use of defstructs.
Code compiled in 0 safety will see less speedup, because there are no type
assertions, while there may be type-based dispatch that is improved.
Additionally, core files tend to be slightly smaller due to having
fewer code header constants that reference layouts, and correspondingly
there are fewer boxed words to examine in GC.
Same idea as already existed, but instead of treating EQUALP-TESTS
as a domain-specific language driving the comparator loop,
actually compile it, unless policy of the destruct has SPACE = 3.
Pristine core size increase by about .7% which I think is worth it.
At any rate, I want people to get this by default, not opt in.
Also explicitly block compile the two files it was used for.
Block compilation accomplishes the same thing and handles more cases,
as top level ir1 converted lambdas can be delayed arbitrarily in a
file, unlike forms. All the type tests that should be open-coded,
are, (the build would warn otherwise), but the cross-typep ambiguity
stuff needs to be disabled during cross compile, since there is no way
to know a priori whether a forward referenced type will get resolved
later.
* Enable genesis to create any target plain-old-defstruct (which was
neither SB-XC:DEFSTRUCT nor DEF!STRUCT) whose %DEFSTRUCT was not yet
observed in a cold fasl but which is known by having compiled it.
* Put all thread structure definitions into 'thread.lisp'
* Replace DEF!STRUCT MUTEX with regular DEFSTRUCT
* Replace DEF!STRUCT AVLNODE with SB-XC:DEFSTRUCT
(because we need the SBCL-style metadata in first genesis)
* Remove read-time-eval of make-mutex, because the host lisp
should never create "our" MUTEX instances as host objects.
Essentially the problem this change had to solve was loss of almost all
compile-time effects of cross-compiling because genesis runs in its own
freshly started lisp. If :sb-after-xc-core is set, we have to die when
saving a core from the host, at least in SBCL.
(Maybe a simpler fix was to execute second genesis *before* dying?)
Change PURE-RUNNER to randomize the package if and only if the filename
does not contain "impure". This makes it feasible again to use on all files
regardless of the pure/impure dichotomy.
In pure tests, disallow certain defining macros which instate persistent
environment changes which can't be undone by DELETE-PACKAGE.
Rename the backq tests to '.pure' since they are side-effect free.
2019-03-22 21:01:52 -04:00
Renamed from tests/defstruct.pure-cload.lisp (Browse further)