From 6aaa725b63cda268573f8fe76f013bddfc5fc339 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Sat, 17 Jun 2023 18:41:58 -0700 Subject: [PATCH 1/2] system: Correct %file-exists? usage on Win32 * sources/system/file-system/win32-file-system.dylan (%resolve-locator): Add missing argument to %file-exists? call. (%file-exists?): Add a follow-links? parameter to match the Unix version. (%copy-file, %rename-file): Add missing argument to %file-exists? call. --- sources/system/file-system/win32-file-system.dylan | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sources/system/file-system/win32-file-system.dylan b/sources/system/file-system/win32-file-system.dylan index d81061a90a..e1fd01a1ed 100644 --- a/sources/system/file-system/win32-file-system.dylan +++ b/sources/system/file-system/win32-file-system.dylan @@ -89,7 +89,7 @@ define function %resolve-locator end elseif (path-length > $MAX_PATH) win32-file-system-error("resolve", "%s", locator) - elseif (~%file-exists?(locator)) + elseif (~%file-exists?(locator, #t)) win32-file-system-error("resolve", "%s", locator) else as(object-class(locator), copy-sequence(path-buffer, end: path-length)) @@ -99,7 +99,8 @@ end function; /// define function %file-exists? - (file :: ) => (exists? :: ) + (file :: , follow-links? :: ) + => (exists? :: ) let file = %expand-pathname(file); if (primitive-machine-word-not-equal? (%call-c-function ("GetFileAttributesA", c-modifiers: "__stdcall") @@ -179,7 +180,7 @@ define function %copy-file let destination = %expand-pathname(destination); // NOTE: Contrary to the documentation, CopyFile won't copy over // an existing read-only file so we need to delete it manually. - if (if-exists == #"replace" & %file-exists?(destination)) + if (if-exists == #"replace" & %file-exists?(destination, #f)) %delete-file(destination) end; unless (primitive-raw-as-boolean @@ -211,7 +212,7 @@ define function %rename-file // the move if the target exists because MoveFileEx isn't implemented // in Windows 95. (When this code was originally written, the // documentation for MoveFileEx failed to mention that fact. Sigh) - if (if-exists == #"replace" & %file-exists?(destination)) + if (if-exists == #"replace" & %file-exists?(destination, #f)) %delete-file(destination) end; unless (primitive-raw-as-boolean @@ -494,7 +495,7 @@ end function %delete-directory; ///---*** Is there an easier way? (Look into it ...) define function %directory-empty? (directory :: ) => (empty? :: ) - ~%file-exists?(directory) + ~%file-exists?(directory, #f) | block (return) %do-directory (method (directory :: , name :: , type :: ) From 8ae2597999b6891bfceef77d5a7a1ade616ec6e5 Mon Sep 17 00:00:00 2001 From: "Peter S. Housel" Date: Sat, 17 Jun 2023 18:47:50 -0700 Subject: [PATCH 2/2] run-time: Correct MVFF pool creation usage * sources/lib/run-time/collector.c (MISCMAXSIZE): Remove. * sources/lib/run-time/mps-collector.c (dylan_init_memory_manager): Pass arguments required by the MVFF pool class to mps_pool_create. --- sources/lib/run-time/collector.c | 1 - sources/lib/run-time/mps-collector.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/lib/run-time/collector.c b/sources/lib/run-time/collector.c index 2c5700cc01..8da5d47416 100644 --- a/sources/lib/run-time/collector.c +++ b/sources/lib/run-time/collector.c @@ -79,7 +79,6 @@ typedef intptr_t DSINT; #define MISCEXTENDBY ((size_t)16384) #define MISCAVGSIZE ((size_t)32) -#define MISCMAXSIZE ((size_t)65536) static void report_runtime_error (char* header, char* message); diff --git a/sources/lib/run-time/mps-collector.c b/sources/lib/run-time/mps-collector.c index e18c12dd48..bd4aad460d 100644 --- a/sources/lib/run-time/mps-collector.c +++ b/sources/lib/run-time/mps-collector.c @@ -1574,7 +1574,9 @@ MMError dylan_init_memory_manager(void) /* Create the MVFF pool for miscellaneous objects. */ /* This is also used for wrappers. */ res = mps_pool_create(&misc_pool, arena, mps_class_mvff(), - MISCEXTENDBY, MISCAVGSIZE, MISCMAXSIZE); + MISCEXTENDBY, MISCAVGSIZE, + (size_t) 16, + TRUE, TRUE, TRUE); if (res) { init_error("create misc pool"); return(res); } wrapper_pool = misc_pool;