From b7efe80e7dcf3103887ad302b615a2ddffa7ce92 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 12 Oct 2008 12:50:35 +0200 Subject: [PATCH] Functions compiled with (OPTIMIZE (SAFETY >= 2)) have an explicit stack overflow check. --- src/CHANGELOG | 3 +++ src/cmp/cmpenv.lsp | 4 ++++ src/cmp/cmptop.lsp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/CHANGELOG b/src/CHANGELOG index 45a16548d..99fcb4d6f 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -77,6 +77,9 @@ ECL 8.9.0: - ECL builds using thread local storage when configured with --with-__thread and the feature works on that platform. + - Functions compiled with (OPTIMIZE (SAFETY >= 2)) have an explicit stack + overflow check. + * Embedding: - ECL now implements a more transparent interface for setting and querying diff --git a/src/cmp/cmpenv.lsp b/src/cmp/cmpenv.lsp index 8a08588a2..166afc739 100644 --- a/src/cmp/cmpenv.lsp +++ b/src/cmp/cmpenv.lsp @@ -613,6 +613,10 @@ (space (third x)) (speed (fourth x))))) +(defun policy-check-stack-overflow (&optional (env *cmp-env*)) + "Do we add a stack check to every function?" + (>= (cmp-env-optimization 'safety env) 2)) + (defun policy-inline-slot-access-p (&optional (env *cmp-env*)) "Do we inline access to structures and sealed classes?" (or (< (cmp-env-optimization 'safety env) 2) diff --git a/src/cmp/cmptop.lsp b/src/cmp/cmptop.lsp index cd58039c5..cc6a7ad64 100644 --- a/src/cmp/cmptop.lsp +++ b/src/cmp/cmptop.lsp @@ -587,6 +587,8 @@ (wt-nl *volatile* "cl_object value0;") (when (>= (fun-debug fun) 2) (wt-nl "struct ihs_frame ihs;")) + (when (policy-check-stack-overflow) + (wt-nl "ecl_cs_check(value0);")) (when (eq (fun-closure fun) 'CLOSURE) (let ((clv-used (remove-if #'(lambda (x)