commit 0fc4989f34bdaf1bc443d05ece886ea91e7bc9cc (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Tue May 26 15:47:59 2020 -0700 Tweak GC performance if !USE_LSB_TAG Performance issue reported by Eli Zaretskii (Bug#41321#149). * src/alloc.c (GC_OBJECT_ALIGNMENT_MINIMUM): New constant. (maybe_lisp_pointer): Use it instead of GCALIGNMENT. diff --git a/src/alloc.c b/src/alloc.c index f8609398a3..e241b9933a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4687,16 +4687,33 @@ mark_maybe_objects (Lisp_Object const *array, ptrdiff_t nelts) mark_maybe_object (*array); } +/* A lower bound on the alignment of Lisp objects that need marking. + Although 1 is safe, higher values speed up mark_maybe_pointer. + If USE_LSB_TAG, this value is typically GCALIGNMENT; otherwise, + it's determined by the natural alignment of Lisp structs. + All vectorlike objects have alignment at least that of union + vectorlike_header and it's unlikely they all have alignment greater, + so use the union as a safe and likely-accurate standin for + vectorlike objects. */ + +enum { GC_OBJECT_ALIGNMENT_MINIMUM + = max (GCALIGNMENT, + min (alignof (union vectorlike_header), + min (min (alignof (struct Lisp_Cons), + alignof (struct Lisp_Float)), + min (alignof (struct Lisp_String), + alignof (struct Lisp_Symbol))))) }; + /* Return true if P might point to Lisp data that can be garbage collected, and false otherwise (i.e., false if it is easy to see that P cannot point to Lisp data that can be garbage collected). Symbols are implemented via offsets not pointers, but the offsets - are also multiples of GCALIGNMENT. */ + are also multiples of GC_OBJECT_ALIGNMENT_MINIMUM. */ static bool maybe_lisp_pointer (void *p) { - return (uintptr_t) p % GCALIGNMENT == 0; + return (uintptr_t) p % GC_OBJECT_ALIGNMENT_MINIMUM == 0; } /* If P points to Lisp data, mark that as live if it isn't already commit 5467aac131fb49ff2af57ca21d7ec9cba7c19c82 Author: Alan Mackenzie Date: Tue May 26 20:08:15 2020 +0000 Introduce some Objective-C 2.0 keywords. This fixes bug #5953 * lisp/progmodes/cc-langs.el (c-other-decl-kwds): New keywords @property, @dynamic, @synthesize, @compatibility_alias. (c-protection-kwds): New keywords @package, @required, @optional. (c-block-stmt-1-kwds): New keyword @autoreleasepool. (c-constant-kwds): New keywords IBAction, IBOutlet. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 2369cb0342..dcffc0d31b 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2416,7 +2416,8 @@ If any of these also are on `c-type-list-kwds', `c-ref-list-kwds', `c-<>-type-kwds', or `c-<>-arglist-kwds' then the associated clauses will be handled." t nil - objc '("@class" "@end" "@defs") + objc '("@class" "@defs" "@end" "@property" "@dynamic" "@synthesize" + "@compatibility_alias") java '("import" "package") pike '("import" "inherit")) @@ -2539,7 +2540,8 @@ one of `c-type-list-kwds', `c-ref-list-kwds', "Access protection label keywords in classes." t nil c++ '("private" "protected" "public") - objc '("@private" "@protected" "@public")) + objc '("@private" "@protected" "@package" "@public" + "@required" "@optional")) (c-lang-defconst c-protection-key ;; A regexp match an element of `c-protection-kwds' cleanly. @@ -2754,7 +2756,7 @@ identifiers that follows the type in a normal declaration." "Statement keywords followed directly by a substatement." t '("do" "else") c++ '("do" "else" "try") - objc '("do" "else" "@finally" "@try") + objc '("do" "else" "@finally" "@try" "@autoreleasepool") java '("do" "else" "finally" "try") idl nil) @@ -2897,7 +2899,8 @@ This construct is \" :\"." c++ (append '("nullptr") (c-lang-const c-constant-kwds c)) - objc '("nil" "Nil" "YES" "NO" "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER") + objc '("nil" "Nil" "YES" "NO" "IBAction" "IBOutlet" + "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER") idl '("TRUE" "FALSE") java '("true" "false" "null") ; technically "literals", not keywords pike '("UNDEFINED")) ;; Not a keyword, but practically works as one.