forked from eholk/harlan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
harlan_jit.scm
47 lines (35 loc) · 1.32 KB
/
harlan_jit.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(define verbose-mode
(let ((mode (getenv "HARLAN_VERBOSE")))
(cond
[(not mode) 0]
[(equal? mode "") 0]
[(string->number mode) => (lambda (x) x)]
[else (error "invalid setting for HARLAN_VERBOSE: ~a" mode)])))
(define (vprintf lvl . args) (when (>= verbose-mode lvl) (apply printf args)))
(define (HarlanJit insig outsig name def)
(printf " *** JITing: ~a ~a ~a ~a (FINISH ME)\n" insig outsig name def)
999
)
(define HarlanJit-entry
(let ([x (foreign-callable HarlanJit (string string string string) int)])
(lock-object x)
(foreign-callable-entry-point x)))
(define (HarlanRun hndl insig outsig arrin arrout)
(printf " *** Running: ~a ~a (FINISH ME)\n" insig outsig)
)
(define HarlanRun-entry
(let ([x (foreign-callable HarlanRun (int string string void* void*) void)])
(lock-object x)
(foreign-callable-entry-point x)))
(vprintf 1 " <Harlan> Loading compiler, machine type ~a...\n" (machine-type))(flush-output-port)
(library-directories (cons (getenv "HARLAND") (library-directories)))
(import
(chezscheme)
(harlan compile-opts)
(harlan driver)
(elegant-weapons print-c)
(harlan compiler))
(vprintf 1 " <Harlan> Done loading compiler.\n")
;; Done loading and initializing, Now return control to the enclosing
;; C program in which we are embedded.
(exit 0)