Avoid passing around a literal stack length, when it's implicit
authorTony Garnock-Jones <tonygarnockjones@gmail.com>
Mon, 23 Jul 2018 20:38:31 +0100
changeset 415 3d1ae8f1b0d7
parent 414 5e5c61ed2e7d
child 416 9be895de88d6
Avoid passing around a literal stack length, when it's implicit
experiments/little-smalltalk/jit-SmallWorld-2015.rkt
--- a/experiments/little-smalltalk/jit-SmallWorld-2015.rkt	Mon Jul 23 18:51:54 2018 +0100
+++ b/experiments/little-smalltalk/jit-SmallWorld-2015.rkt	Mon Jul 23 20:38:31 2018 +0100
@@ -51,7 +51,7 @@
 
 (struct cached-method (class name-bytes [bytecode-method #:mutable] [proc #:mutable]))
 
-(define (build-jit-context vm previous-context args method ip stack-top temporaries stack)
+(define (build-jit-context vm previous-context args method ip temporaries stack)
   ;; TODO: build block contexts instead of just pretending everything is a method...
   (define max-stack (slotAt method 3))
   (mkobj (VM-Context vm)
@@ -61,7 +61,7 @@
          (obj (VM-Array vm) (vector-append stack (make-vector (- max-stack (vector-length stack))
                                                               (VM-nil vm))))
          ip
-         stack-top
+         (vector-length stack)
          previous-context))
 
 (define (selector-string-arity str)
@@ -155,7 +155,6 @@
                       (vector ,@(vector->list (compilation-argnames c)))
                       method
                       ,ip
-                      ,(length stack)
                       temporaries
                       (vector ,@(reverse stack))))