Skip to content

Commit 27b8b34

Browse files
committed
Merge remote-tracking branch 'origin/main' into codex/split-epfn-into-two-functions
2 parents 50cbae1 + fc97a4b commit 27b8b34

File tree

9 files changed

+112
-343
lines changed

9 files changed

+112
-343
lines changed

eval/adjust.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
racket/match)
88

99
(provide backward-pass
10-
make-hint)
10+
make-hint
11+
drop-self-pointer)
1112

1213
; Hint is a vector with len(ivec) elements which
1314
; guides Rival on which instructions should not be executed

eval/run.rkt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
(require racket/match
44
racket/function
5-
racket/flonum)
5+
racket/flonum
6+
racket/performance-hint)
67

78
(require "machine.rkt"
89
"adjust.rkt"
@@ -13,29 +14,31 @@
1314
rival-machine-run
1415
rival-machine-return
1516
rival-machine-adjust
17+
rival-machine-record
1618
apply-instruction) ; for compile.rkt
1719

1820
(define (rival-machine-load machine args)
1921
(vector-copy! (rival-machine-registers machine) 0 args)
2022
(set-rival-machine-bumps! machine 0)
2123
(*bumps-activated* #f))
2224

23-
(define (rival-machine-record machine name number precision time memory iter)
24-
(define profile-ptr (rival-machine-profile-ptr machine))
25-
(define profile-instruction (rival-machine-profile-instruction machine))
26-
(when (< profile-ptr (vector-length profile-instruction))
27-
(define profile-number (rival-machine-profile-number machine))
28-
(define profile-time (rival-machine-profile-time machine))
29-
(define profile-memory (rival-machine-profile-memory machine))
30-
(define profile-precision (rival-machine-profile-precision machine))
31-
(define profile-iteration (rival-machine-profile-iteration machine))
32-
(vector-set! profile-instruction profile-ptr name)
33-
(vector-set! profile-number profile-ptr number)
34-
(vector-set! profile-memory profile-ptr memory)
35-
(vector-set! profile-precision profile-ptr precision)
36-
(vector-set! profile-iteration profile-ptr iter)
37-
(flvector-set! profile-time profile-ptr time)
38-
(set-rival-machine-profile-ptr! machine (add1 profile-ptr))))
25+
;; Inlining critical, otherwise `time` is heap-allocated (Chez boxes floats)
26+
(define-inline (rival-machine-record machine name number precision time memory iter)
27+
(define profile-ptr (rival-machine-profile-ptr machine))
28+
(define profile-instruction (rival-machine-profile-instruction machine))
29+
(when (< profile-ptr (vector-length profile-instruction))
30+
(define profile-number (rival-machine-profile-number machine))
31+
(define profile-time (rival-machine-profile-time machine))
32+
(define profile-memory (rival-machine-profile-memory machine))
33+
(define profile-precision (rival-machine-profile-precision machine))
34+
(define profile-iteration (rival-machine-profile-iteration machine))
35+
(vector-set! profile-instruction profile-ptr name)
36+
(vector-set! profile-number profile-ptr number)
37+
(vector-set! profile-memory profile-ptr memory)
38+
(vector-set! profile-precision profile-ptr precision)
39+
(vector-set! profile-iteration profile-ptr iter)
40+
(flvector-set! profile-time profile-ptr time)
41+
(set-rival-machine-profile-ptr! machine (add1 profile-ptr))))
3942

4043
(define (rival-machine-run machine vhint)
4144
(define ivec (rival-machine-instructions machine))

0 commit comments

Comments
 (0)