Skip to content

Commit

Permalink
[ fix ] Restore blodwen-force, which is used only for scheme evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Dec 21, 2022
1 parent 324c997 commit 726a419
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Compiler/Scheme/Common.idr
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ parameters (constants : SortedSet Name,
= schOp op !(schArgs i args)
schExp i (NmExtPrim fc p args)
= schExtPrim i (toPrim p) args
schExp i (NmForce fc lr t) = pure $ "(blodwen-force " ++ !(schExp i t) ++ ")"
schExp i (NmForce fc lr t) = pure $ "(blodwen-force-lazy " ++ !(schExp i t) ++ ")"
schExp i (NmDelay fc lr t) = pure $ "(blodwen-delay-lazy (lambda () " ++ !(schExp i t) ++ "))"
schExp i (NmConCase fc sc alts def)
= cond [(recordCase alts, schRecordCase i sc alts def),
Expand Down
7 changes: 5 additions & 2 deletions support/chez/support.ss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
(define (blodwen-delay-lazy f)
(weak-cons bwp f))

(define (blodwen-force e)
(define (blodwen-force-lazy e)
(let ((exval (car e)))
(if (bwp-object? exval)
(let ((val ((cdr e))))
Expand Down Expand Up @@ -435,7 +435,7 @@
(define (blodwen-make-future work)
(let ([future (make-future-internal #f #f (make-mutex) (make-condition))])
(fork-thread (lambda ()
(let ([result (blodwen-force work)])
(let ([result (blodwen-force-lazy work)])
(with-mutex (future-internal-mutex future)
(set-future-internal-result! future result)
(set-future-internal-ready! future #t)
Expand Down Expand Up @@ -589,6 +589,9 @@
(define (blodwen-apply obj arg)
(obj arg))

(define (blodwen-force obj)
(obj))

(define (blodwen-read-symbol sym)
(symbol->string sym))

Expand Down
2 changes: 1 addition & 1 deletion support/gambit/support.scm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(define (blodwen-delay-lazy f)
f)

(define (blodwen-force f)
(define (blodwen-force-lazy f)
(f))

(define (blodwen-toSignedInt x bits)
Expand Down
7 changes: 5 additions & 2 deletions support/racket/support.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(define (blodwen-delay-lazy f)
(mcons (make-weak-box bwp) f))

(define (blodwen-force e)
(define (blodwen-force-lazy e)
(let ((exval (weak-box-value (mcar e) bwp)))
(if (eq? exval bwp)
(let ((val ((mcdr e))))
Expand Down Expand Up @@ -455,7 +455,7 @@
; )


(define (blodwen-make-future work) (future (lambda () (blodwen-force work))))
(define (blodwen-make-future work) (future (lambda () (blodwen-force-lazy work))))
(define (blodwen-await-future ty future) (touch future))

;; NB: These should *ALWAYS* be used in multi-threaded programs since Racket
Expand Down Expand Up @@ -580,6 +580,9 @@
(define (blodwen-apply obj arg)
(obj arg))

(define (blodwen-force obj)
(obj))

(define (blodwen-read-symbol sym)
(symbol->string sym))

Expand Down

0 comments on commit 726a419

Please sign in to comment.