diff --git a/OVERVIEW.txt b/OVERVIEW.txt index a0768923e2..4b88d052a0 100644 --- a/OVERVIEW.txt +++ b/OVERVIEW.txt @@ -94,8 +94,6 @@ sources jam - Jam script interpreter. parser-run-time - Support for parsers. source-records - Reads source files and tracks location. - stack-walker - Debugging on UNIX by walking the stack. Nowadays - directly in the run-time. walker - Build has-a tree. project-manager - Takes care about dependencies of projects and actual invocation of linker, etc. diff --git a/documentation/source/release-notes/2024.2.rst b/documentation/source/release-notes/2024.2.rst index 06ab1a171a..22daa6abb2 100644 --- a/documentation/source/release-notes/2024.2.rst +++ b/documentation/source/release-notes/2024.2.rst @@ -26,6 +26,19 @@ Compiler * The build rules for unified executables now properly depend on copying included run-time libraries such as libunwind. +* Optimizations that allow the type of ``if`` expressions to be more + accurately estimated have been improved. For example, in this + function: + + .. code-block:: + + define function if-example (arg :: false-or()) => (result :: ); + min(arg | 20, 30) + end; + + the comparison can now be properly inlined because the first + argument to :drm:`min` is known to be an :drm:``. + Tools ===== @@ -61,6 +74,11 @@ System :const:`$machine-architecture`. The old name will remain, for backward compatibility. +Other +----- + +* The obsolete (32-bit x86-only) ``stack-walker`` library was removed. + Contributors ============ diff --git a/sources/dfmc/optimization/assignment.dylan b/sources/dfmc/optimization/assignment.dylan index 254833bffb..af2b44503d 100644 --- a/sources/dfmc/optimization/assignment.dylan +++ b/sources/dfmc/optimization/assignment.dylan @@ -190,14 +190,20 @@ define method maybe-rename-temporaries-in-conditional (c.environment, , value: to-be-renamed, type: constraint); let then-f = c.consequent; + let merge-c :: = c.next-computation; let changed? = #f; rename-temporary!(to-be-renamed, tt-t); - for-computations(tc from then-f before c.next-computation) + for-computations(tc from then-f before merge-c) let now-changed? = rename-temporary-references!(tc, to-be-renamed, tt-t); changed? := (changed? | now-changed?); end; + // The left side of the merge is also part of the consequent + if (merge-c.merge-left-value == to-be-renamed) + merge-replace-left-value!(merge-c, to-be-renamed, tt-t); + changed? := #t; + end; if (changed?) - insert-computation-before!(then-f, tt-c); + insert-computation-before-reference!(then-f, tt-c, tt-t); else // It's not used in the consequent, so get rid of it. remove-user!(to-be-renamed, tt-c); end; diff --git a/sources/dfmc/optimization/calls.dylan b/sources/dfmc/optimization/calls.dylan index 3ad03bfd22..9f53b3910d 100644 --- a/sources/dfmc/optimization/calls.dylan +++ b/sources/dfmc/optimization/calls.dylan @@ -79,13 +79,19 @@ define method do-optimize-instance?-user(c :: , object, type) => (); = make-with-temporary(c.environment, , value: object, type: type); let then-f = c.consequent; + let merge-c :: = c.next-computation; let changed? = #f; - for-computations(tc from then-f before c.next-computation) + for-computations(tc from then-f before merge-c) let now-changed? = rename-temporary-references!(tc, object, tt-t); changed? := (changed? | now-changed?); end; + // The left side of the merge is also part of the consequent + if (merge-c.merge-left-value == object) + merge-replace-left-value!(merge-c, object, tt-t); + changed? := #t; + end; if (changed?) - insert-computation-before!(then-f, tt-c); + insert-computation-before-reference!(then-f, tt-c, tt-t); else // It's not used in the consequent, so get rid of it. remove-user!(object, tt-c); end diff --git a/sources/environment/dswank/library.dylan b/sources/environment/dswank/library.dylan index 20f5e8fcb7..73664829f8 100644 --- a/sources/environment/dswank/library.dylan +++ b/sources/environment/dswank/library.dylan @@ -19,7 +19,6 @@ define library dswank use file-source-records; use system; use registry-projects; - //use stack-walker; use release-info; use dfmc-back-end-implementations; end library; @@ -46,7 +45,6 @@ define module dswank use file-system; use locators; use registry-projects; - //use stack-walker; use release-info; use operating-system; end module; diff --git a/sources/lib/stack-walker/getebp.c b/sources/lib/stack-walker/getebp.c deleted file mode 100644 index 4d263d7fa6..0000000000 --- a/sources/lib/stack-walker/getebp.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#define __USE_GNU -#include - -int getebp () { - int ebp; - asm("mov (%%ebp), %0" - :"=r"(ebp)); - return ebp; -}; - -void walkstack() { - int ebp = getebp(); - int eip; - int rc; - Dl_info info; - - while(ebp) { - eip = *((int*)ebp + 1); - rc = dladdr((void*)eip, &info); - if (!rc||(!info.dli_sname && !info.dli_fname)) { - printf("0x%x (unknown)\n"); - } else { - if (!info.dli_sname) { - printf("0x%x (%s)\n", eip, info.dli_fname); - } else { - printf("%s+%i (%s)\n", - info.dli_sname, - eip - (int)info.dli_saddr, - info.dli_fname); - } - } - ebp = *((int*)ebp); - } -} diff --git a/sources/lib/stack-walker/library.dylan b/sources/lib/stack-walker/library.dylan deleted file mode 100644 index ca3b616a4f..0000000000 --- a/sources/lib/stack-walker/library.dylan +++ /dev/null @@ -1,19 +0,0 @@ -module: dylan-user -copyright: Original Code is Copyright (c) 2007 Dylan Hackers; - All rights reversed. -License: See License.txt in this distribution for details. -Warranty: Distributed WITHOUT WARRANTY OF ANY KIND - -define library stack-walker - use common-dylan; - use c-ffi; - - export stack-walker; -end; - -define module stack-walker - use common-dylan; - use c-ffi; - - export walk-stack; -end; diff --git a/sources/lib/stack-walker/stack-walker.dylan b/sources/lib/stack-walker/stack-walker.dylan deleted file mode 100644 index afcf18b9ef..0000000000 --- a/sources/lib/stack-walker/stack-walker.dylan +++ /dev/null @@ -1,9 +0,0 @@ -module: stack-walker -copyright: Original Code is Copyright (c) 2007 Dylan Hackers; - All rights reversed. -License: See License.txt in this distribution for details. -Warranty: Distributed WITHOUT WARRANTY OF ANY KIND - -define C-function walk-stack - c-name: "walkstack" -end; diff --git a/sources/lib/stack-walker/stack-walker.lid b/sources/lib/stack-walker/stack-walker.lid deleted file mode 100644 index 73c189ec52..0000000000 --- a/sources/lib/stack-walker/stack-walker.lid +++ /dev/null @@ -1,9 +0,0 @@ -library: stack-walker -c-source-files: getebp.c -files: library - stack-walker -Platforms: arm-linux - x86-freebsd - x86-linux - x86-netbsd - x86_64-linux diff --git a/sources/registry/aarch64-linux/stack-walker b/sources/registry/aarch64-linux/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/aarch64-linux/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/arm-linux/stack-walker b/sources/registry/arm-linux/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/arm-linux/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/riscv64-linux/stack-walker b/sources/registry/riscv64-linux/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/riscv64-linux/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/x86-freebsd/stack-walker b/sources/registry/x86-freebsd/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/x86-freebsd/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/x86-linux/stack-walker b/sources/registry/x86-linux/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/x86-linux/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/x86-netbsd/stack-walker b/sources/registry/x86-netbsd/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/x86-netbsd/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid diff --git a/sources/registry/x86_64-linux/stack-walker b/sources/registry/x86_64-linux/stack-walker deleted file mode 100644 index 262021218e..0000000000 --- a/sources/registry/x86_64-linux/stack-walker +++ /dev/null @@ -1 +0,0 @@ -abstract://dylan/lib/stack-walker/stack-walker.lid