Skip to content

Commit

Permalink
Fix alloc-imm seq & intraprocedural nan wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bsaleil committed Jul 11, 2018
1 parent 5152acd commit 985cb42
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 37 deletions.
6 changes: 1 addition & 5 deletions ast.scm
Expand Up @@ -1700,11 +1700,7 @@
(gen (primitive-codegen prim))
(fs (ctx-fs ctx))
(ffs (ctx-ffs ctx))
;; TODO NOTE
(gc-desc
(if (not (ctx-fn-num ctx))
0
(ctx->gc-map-desc ctx)))
(gc-desc (ctx->gc-map-desc ctx))
(nargs (primitive-nbargs prim))
(r (build-list
nargs
Expand Down
10 changes: 7 additions & 3 deletions core.scm
Expand Up @@ -418,7 +418,8 @@
(block_gc 5)
(write_lc_stack_ptr usp)
(write_lc_stack_usedesc 1)
(if (= (tagging-encoding-obj (get-u48 (- psp 16))) 1)
(if (or (not opt-entry-points)
(= (tagging-encoding-obj (get-u48 (- psp 16))) 1))
;; TODO: move in ctx
(let* ((nargs (encoding-obj (get-i64 (+ usp (reg-sp-offset-r (x86-rdi))))))
(fs (+ (max (- nargs nb-args-regs) 0) 1))
Expand Down Expand Up @@ -448,8 +449,11 @@

;; Closure is used as a Gambit procedure to keep an updated reference
(closure
#f)
;(encoding-obj (get-i64 (+ usp (reg-sp-offset-r (x86-rsi))))))
(and (not opt-entry-points)
(let ((u48 (get-u48 (+ usp (reg-sp-offset-r (x86-rsi))))))
(if (= (bitwise-and u48 #b11) TAG_MEMOBJ)
(##encoding->object u48)
#f))))

(callback-fn
(vector-ref (get-scmobj ret-addr) 0))
Expand Down
1 change: 0 additions & 1 deletion lazy-comp.template
Expand Up @@ -10,7 +10,6 @@ GDB=""
TRACE_HEAP="-:"
#TRACE_HEAP="-:d2,"
HEAP="m512000"
#HEAP="m10000"

for (( i=1; i<="$#"; i++ ))
do
Expand Down
4 changes: 3 additions & 1 deletion main.scm
Expand Up @@ -347,7 +347,9 @@
(set! asc-entry-load #f)
(set! ctime-entries #f)
(set! stub-freelist #f)
(u64vector-fill! ustack #xFFFE000000000000)
(if opt-nan-boxing
(u64vector-fill! ustack #xFFFE000000000000)
(u64vector-fill! ustack 0))
(if opt-nan-boxing
(u64vector-fill! globals-space #xFFFE000000000000)
(vector-fill! globals-space 0))
Expand Down
2 changes: 1 addition & 1 deletion mem.scm
Expand Up @@ -361,7 +361,7 @@ void lc_print_perm_string_nan(___U64 s)
(x86-mov cgc (x86-rax) (x86-imm-int (+ (* 5 8) block-addr)))
(x86-cmp cgc alloc-ptr (x86-mem 0 (x86-rax)) 64)

;(x86-jle cgc label-alloc-end)
(x86-jle cgc label-alloc-end)
;; else
(x86-mov cgc (x86-rax) (x86-imm-int gc-desc))
(x86-upush cgc (x86-rax))
Expand Down
26 changes: 0 additions & 26 deletions test.scm
@@ -1,26 +0,0 @@

(define (foo a b c . d)
(+ a b c (car d)))

(define (bar) '(1 2 3 4 5 6 7 8 9 10))

(apply foo (bar))

;832040
;832040
;832040
;832040
;832040


;
; (define (foo n)
; (+ n 1))
;
; (foo 100)
; (define ll '(1))
;
; (define (bar)
; '(1))
;
; (##apply foo (bar))

0 comments on commit 985cb42

Please sign in to comment.