Fix CLOS, MAKE-LOAD-FORM, and TYPE-OF ANSI test failures#742
Closed
blakemcbride wants to merge 2 commits intoarmedbear:masterfrom
Closed
Fix CLOS, MAKE-LOAD-FORM, and TYPE-OF ANSI test failures#742blakemcbride wants to merge 2 commits intoarmedbear:masterfrom
blakemcbride wants to merge 2 commits intoarmedbear:masterfrom
Conversation
Author
|
Duplicated in pull request 743 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix CLOS, MAKE-LOAD-FORM, and TYPE-OF ANSI test failures
Summary
Resolves 32 ANSI test failures across eight areas of ABCL's CLOS,
type system, and file-compiler behavior. All originally-targeted
tests pass, with no regressions against the baseline test suite.
Builds on (and cherry-picks) the MAKE-LOAD-FORM data-flow ordering
commit, and adds seven further fixes.
Changes
1. MAKE-LOAD-FORM data-flow ordering (ORDER.3–14)
Cherry-picked from the
make-load-formbranch. The file compiler nowemits creation and initialization forms through a per-fasl instance
vector
sys::*fasl-instances*, with a two-phase dependency walker thathonors CLHS's "creation before any reference" and "init ASAP after
creation" rules.
*FASL-VERSION*is bumped 43 → 44. See themake-load-formPR description for full detail on this portion.2. DEFINE-METHOD-COMBINATION long form (
clos.lisp)Three independent bugs in the long-form
define-method-combinationexpansion:
:order/:requiredevaluated as forms, not quoted symbols.canonicalize-method-group-specwas emitting:order ',orderand:required ',required-p, so a group spec like((method-list * :order order))substituted the literal symbolorderrather than the value of the lexical variable. CLHSspecifies these are forms to be evaluated at call site.
optional count were bound to NIL instead of their initforms.
Rewrote the optional-parameter handling in
method-combination-type-lambda-with-args-emfto emit aninitform binding for excess optionals, and to bind excess
supplied-p parameters to NIL.
supplied-pparameters leaked themembertail. Thesame binding symbol was used for both the boolean supplied-p and the
(cadr …)accessor, so user code saw e.g.(:Z1 4)instead ofT.Split these via a private gensym for the
memberresult;supplied-pnow binds to(not (null …)).3.
CALL-NEXT-METHODapplicable-methods check (clos.lisp)AMOP requires that when CALL-NEXT-METHOD is passed an argument list,
those arguments must produce the same set of applicable methods as the
original call. ABCL previously silently re-dispatched on whatever
arguments it received.
Added
*call-next-method-gf*/*call-next-method-applicable-methods*specials bound by the slow-method-lookup path, plus a
cnm-check-applicable-methodshelper invoked from theflet-call-next-methodexpansion when explicit CNM args are given. Theemfun is wrapped so the binding survives effective-method caching.
4. DEFCLASS top-level compile-time recognition (
clos.lisp)FIND-CLASS.24 requires that a
(defclass test-class …)appearing attop level in a compiled file be visible to macros invoked later in the
same compilation (via
(find-class 'test-class nil env)). The defclassmacro now:
:compile-toplevel, registers a placeholderforward-referenced-classso later compile-timefind-classcallssucceed;
:load-toplevel, clears that placeholder only when it has nodirect subclasses (i.e. it really is our own placeholder, not a
legitimate forward reference from a previously-defined subclass),
so
ensure-classthen goes through the primitive path and avoidsa MOP superclass-validity assertion that built-in classes like
STREAMfail;:execute, does not touch existing forward-references(fixes the
DEFCLASS.FORWARD-REF.*regression introduced by anearlier version of this fix).
5. TYPE-OF vs. TYPEP consistency (NilVector + SGF)
TYPE-OF.1/.4require that for every objectx,(type-of x)bea subtype of every built-in type that
xisTYPEP. Two specificinstances failed this invariant in ABCL:
(simple-array nil (*))reported(typep x 'base-string) → T, but(subtypep '(nil-vector n) 'base-string) → NIL, Tbecause theupgraded element types (
nilvscharacter) are disjoint per CLHS4.2.3.
NilVector.typepnow returns NIL forBASE-STRING/SIMPLE-BASE-STRING. (STRINGremains T —nilis a subtype ofcharacter, so a NIL-vector is legitimately a string.)STANDARD-GENERIC-FUNCTION↔COMPILED-FUNCTION.FuncallableStandardObject.typeppreviously returned T forCOMPILED-FUNCTIONwhen the installed dispatcher happened to becompiled; this is an implementation detail of the funcallable
instance, not a property of the object itself. Returning NIL
matches SBCL/CCL behavior. Because
jvm-compileused the old Tanswer as an early-return signal, it now explicitly skips
funcallable-standard-objectdefinitions (they have no LAMBDAexpression to work from).
subtypepbugfix in the string-array branch ofcsubtypep-array: when the second type was a bare symbol likenil-vector(no dimension spec), the size check compared(car i1)againstnilinstead of treating the missing dimensionas
*.(subtypep '(nil-vector 0) 'nil-vector)now returnsT, T.Files changed
Beyond the cherry-picked
make-load-formcommit:src/org/armedbear/lisp/clos.lispdefclassmacro: compile-time placeholder + guardedload-time clear.
canonicalize-method-group-spec: evaluate:order/:requiredat call site.method-combination-type-lambda-with-args-emf: excess-optionalinitform binding; split key supplied-p from
membertail.*call-next-method-gf*,*call-next-method-applicable-methods*,cnm-check-applicable-methods; slow-method-lookup emfun wrap.src/org/armedbear/lisp/defstruct.lispsrc/org/armedbear/lisp/compiler-pass2.lispjvm-compile: short-circuit onfuncallable-standard-object.src/org/armedbear/lisp/FuncallableStandardObject.javatypep: return NIL forCOMPILED-FUNCTION.src/org/armedbear/lisp/NilVector.javatypep: return NIL forBASE-STRING/SIMPLE-BASE-STRING.src/org/armedbear/lisp/subtypep.lispcsubtypep-arraystring-branch: treat missing dimensions as*.Test plan
(MAKE-LOAD-FORM.ORDER.3–14, DEFGENERIC.ERROR.1/2/3,
CALL-NEXT-METHOD.ERROR.1/2,
DEFINE-METHOD-COMBINATION-LONG.04.2/.11.2/.11.3,
DEFSTRUCT.ERROR.3/4, FIND-CLASS.24, MAKE-CONDITION.3/4,
TYPE-OF.1/4).
DEFCLASS.FORWARD-REF.1/2/3continue to pass (regression guardon the DEFCLASS compile-time change).
DEFINE-METHOD-COMBINATION-LONG.*tests pass.MAKE-LOAD-FORM.ORDER.*tests pass.cl-testsuite: 21932 tests, failure count drops from119 → 113. No new CLOS-related failures; remaining failures
are pre-existing and unrelated (pathname/file, FORMAT,
LOOP.1.40–43, etc.).
Compatibility
Fasl layout changed (MAKE-LOAD-FORM portion) —
*FASL-VERSION*wasalready bumped 43 → 44, and older
.abclfasls must be recompiled.No other public API changes; internal additions
(
*call-next-method-gf*,cnm-check-applicable-methods,%fasl-*helpers) are inSYSTEM/EXT.