diff options
| author | Andrea Corallo | 2021-04-25 20:06:22 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2021-04-25 20:06:22 +0200 |
| commit | 289000eee729689b0cf362a21baa40ac7f9506f6 (patch) | |
| tree | 04e59d0f2bd7111749d8d97f829a410d4602a247 /src/alloc.c | |
| parent | 8f63f0078a23421eada97b4da51b9308b82532ce (diff) | |
| parent | fa65c044f2ebe666467166075c1507a8d0e1347f (diff) | |
| download | emacs-289000eee729689b0cf362a21baa40ac7f9506f6.tar.gz emacs-289000eee729689b0cf362a21baa40ac7f9506f6.zip | |
Merge branch 'feature/native-comp' into into trunk
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c index 00c1fd3148e..76d8c7ddd11 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3152,6 +3152,26 @@ cleanup_vector (struct Lisp_Vector *vector) | |||
| 3152 | module_finalize_function (function); | 3152 | module_finalize_function (function); |
| 3153 | } | 3153 | } |
| 3154 | #endif | 3154 | #endif |
| 3155 | else if (NATIVE_COMP_FLAG | ||
| 3156 | && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_NATIVE_COMP_UNIT)) | ||
| 3157 | { | ||
| 3158 | struct Lisp_Native_Comp_Unit *cu = | ||
| 3159 | PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit); | ||
| 3160 | unload_comp_unit (cu); | ||
| 3161 | } | ||
| 3162 | else if (NATIVE_COMP_FLAG | ||
| 3163 | && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR)) | ||
| 3164 | { | ||
| 3165 | struct Lisp_Subr *subr = | ||
| 3166 | PSEUDOVEC_STRUCT (vector, Lisp_Subr); | ||
| 3167 | if (!NILP (subr->native_comp_u[0])) | ||
| 3168 | { | ||
| 3169 | /* FIXME Alternative and non invasive solution to this | ||
| 3170 | cast? */ | ||
| 3171 | xfree ((char *)subr->symbol_name); | ||
| 3172 | xfree (subr->native_c_name[0]); | ||
| 3173 | } | ||
| 3174 | } | ||
| 3155 | } | 3175 | } |
| 3156 | 3176 | ||
| 3157 | /* Reclaim space used by unmarked vectors. */ | 3177 | /* Reclaim space used by unmarked vectors. */ |
| @@ -6725,6 +6745,15 @@ mark_object (Lisp_Object arg) | |||
| 6725 | break; | 6745 | break; |
| 6726 | 6746 | ||
| 6727 | case PVEC_SUBR: | 6747 | case PVEC_SUBR: |
| 6748 | if (SUBR_NATIVE_COMPILEDP (obj)) | ||
| 6749 | { | ||
| 6750 | set_vector_marked (ptr); | ||
| 6751 | struct Lisp_Subr *subr = XSUBR (obj); | ||
| 6752 | mark_object (subr->native_intspec); | ||
| 6753 | mark_object (subr->native_comp_u[0]); | ||
| 6754 | mark_object (subr->lambda_list[0]); | ||
| 6755 | mark_object (subr->type[0]); | ||
| 6756 | } | ||
| 6728 | break; | 6757 | break; |
| 6729 | 6758 | ||
| 6730 | case PVEC_FREE: | 6759 | case PVEC_FREE: |
| @@ -6869,7 +6898,9 @@ survives_gc_p (Lisp_Object obj) | |||
| 6869 | break; | 6898 | break; |
| 6870 | 6899 | ||
| 6871 | case Lisp_Vectorlike: | 6900 | case Lisp_Vectorlike: |
| 6872 | survives_p = SUBRP (obj) || vector_marked_p (XVECTOR (obj)); | 6901 | survives_p = |
| 6902 | (SUBRP (obj) && !SUBR_NATIVE_COMPILEDP (obj)) || | ||
| 6903 | vector_marked_p (XVECTOR (obj)); | ||
| 6873 | break; | 6904 | break; |
| 6874 | 6905 | ||
| 6875 | case Lisp_Cons: | 6906 | case Lisp_Cons: |
| @@ -7629,14 +7660,14 @@ N should be nonnegative. */); | |||
| 7629 | static union Aligned_Lisp_Subr Swatch_gc_cons_threshold = | 7660 | static union Aligned_Lisp_Subr Swatch_gc_cons_threshold = |
| 7630 | {{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) }, | 7661 | {{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) }, |
| 7631 | { .a4 = watch_gc_cons_threshold }, | 7662 | { .a4 = watch_gc_cons_threshold }, |
| 7632 | 4, 4, "watch_gc_cons_threshold", 0, 0}}; | 7663 | 4, 4, "watch_gc_cons_threshold", {0}, 0}}; |
| 7633 | XSETSUBR (watcher, &Swatch_gc_cons_threshold.s); | 7664 | XSETSUBR (watcher, &Swatch_gc_cons_threshold.s); |
| 7634 | Fadd_variable_watcher (Qgc_cons_threshold, watcher); | 7665 | Fadd_variable_watcher (Qgc_cons_threshold, watcher); |
| 7635 | 7666 | ||
| 7636 | static union Aligned_Lisp_Subr Swatch_gc_cons_percentage = | 7667 | static union Aligned_Lisp_Subr Swatch_gc_cons_percentage = |
| 7637 | {{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) }, | 7668 | {{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) }, |
| 7638 | { .a4 = watch_gc_cons_percentage }, | 7669 | { .a4 = watch_gc_cons_percentage }, |
| 7639 | 4, 4, "watch_gc_cons_percentage", 0, 0}}; | 7670 | 4, 4, "watch_gc_cons_percentage", {0}, 0}}; |
| 7640 | XSETSUBR (watcher, &Swatch_gc_cons_percentage.s); | 7671 | XSETSUBR (watcher, &Swatch_gc_cons_percentage.s); |
| 7641 | Fadd_variable_watcher (Qgc_cons_percentage, watcher); | 7672 | Fadd_variable_watcher (Qgc_cons_percentage, watcher); |
| 7642 | } | 7673 | } |