fix cross-module function inlining and argument use-count tracking

Order mismatch between tracking an use could cause a multiply-used
argument to be treated after inlining as a single-use argument.

Closes PR 14717
This commit is contained in:
Matthew Flatt 2014-09-01 10:56:28 +02:00
parent 854e9a997a
commit b0f4a32049
4 changed files with 34 additions and 5 deletions

View File

@ -12,7 +12,7 @@
(define collection 'multi)
(define version "6.1.0.4")
(define version "6.1.0.6")
(define deps `("racket-lib"
["racket" #:version ,version]))

View File

@ -4158,6 +4158,33 @@
(lambda (tasks)
(report-answer-all 8)))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that cross-module inlining decmopiles a function
;; with correct use counts on arguments (specifically: B is used
;; twice, so the argument expression can't be inlined for two uses)
(module module-with-cross-module-inlining racket/base
(require racket/function)
(module bad racket
(provide evil-func)
(define (evil-func A B)
(A B)
B))
(require (submod "." bad))
(define n 0)
(define (bar) (set! n (add1 n)) (void))
(evil-func (curry void) (bar))
(provide n))
(test 1 dynamic-require ''module-with-cross-module-inlining 'n)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -3172,13 +3172,15 @@ static int unresolve_stack_push(Unresolve_Info *ui, int n, int r_only)
static int *unresolve_stack_pop(Unresolve_Info *ui, int pos, int n)
{
int *f;
int *f, i;
ui->stack_pos = pos;
if (n) {
f = (int *)scheme_malloc_atomic(sizeof(int) * n);
memcpy(f, ui->flags + pos, n * sizeof(int));
for (i = 0; i < n; i++) {
f[i] = ui->flags[pos + (n - i -i)];
}
ui->depth -= n;
} else
f = NULL;

View File

@ -13,12 +13,12 @@
consistently.)
*/
#define MZSCHEME_VERSION "6.1.0.5"
#define MZSCHEME_VERSION "6.1.0.6"
#define MZSCHEME_VERSION_X 6
#define MZSCHEME_VERSION_Y 1
#define MZSCHEME_VERSION_Z 0
#define MZSCHEME_VERSION_W 5
#define MZSCHEME_VERSION_W 6
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)