Changeset 11695 in project


Ignore:
Timestamp:
08/22/08 02:55:53 (13 years ago)
Author:
Ivan Raikov
Message:

Some more updates to the node and front modules.

Location:
release/3/prescheme-compiler
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • release/3/prescheme-compiler/front/cps.scm

    r11110 r11695  
    2626; Record to hold information about arguments to calls.
    2727
    28 (define-record-type arg :arg
     28(define-record-type arg
    2929  (make-arg index rank value first last)
    3030  arg?
  • release/3/prescheme-compiler/front/jump.scm

    r11110 r11695  
    2525; Need a root node, so make one that points to all procs with unknown calls.
    2626
    27 (define-record-type node :node
     27(define-record-type node
    2828  (really-make-node proc cont successors join? merged?)
    2929  node?
  • release/3/prescheme-compiler/node/arch.scm

    r11270 r11695  
    11; Copyright (c) 1993-1999 by Richard Kelsey.  See file COPYING.
    2 
    3 (require-extension miscmacros)
    42
    53; These are all of the primitives that are known to the compiler.
  • release/3/prescheme-compiler/node/let-nodes.scm

    r11270 r11695  
    11; Copyright (c) 1993-1999 by Richard Kelsey.  See file COPYING.
    2 
    3 (require-extension syntax-case)
    4 (require-extension matchable)
    52
    63
  • release/3/prescheme-compiler/node/node.scm

    r11650 r11695  
    1 
    2 (require-extension srfi-69)
    3 (require-extension vector-lib)
    41
    52; Copyright (c) 1993-1999 by Richard Kelsey.  See file COPYING.
     
    147144  node?
    148145  ((parent node-parent set-node-parent!)  ; Parent node
     146   (variant node-variant set-node-variant!)
    149147   (index node-index set-node-index!)     ; Index of this node in parent
    150148   (simplified? node-simplified? set-node-simplified?!)    ; True if it has already been simplified.
     
    345343;-------------------------------------------------------------------------
    346344; Syntax for defining the different types of nodes.
     345
    347346#|
    348347(define-syntax define-node-type
     
    362361|#
    363362
     363(define-macro (define-node-type id slots)
     364  (let ((pred (concatenate-symbol id '- 'node?)))
     365    `(begin (define (,pred x)
     366              (eq? ',id (node-variant x)))
     367            . ,(do ((i 0 (+ i 1))
     368                    (s slots (cdr s))
     369                    (r '() (let ((n (concatenate-symbol id '- (car s)))
     370                                 (f (concatenate-symbol 'node-stuff- i)))
     371                             `((define-node-field ,n ,pred ,f)
     372                               . ,r))))
     373                   ((null? s) (reverse r))))))
     374 
     375
     376
    364377
    365378; These are used to rename the NODE-STUFF fields of particular node variants.
    366379
     380#|
    367381(define-syntax define-node-field
    368382  (lambda (form rename compare)
     
    377391            (enforce ,predicate node)
    378392            val))))))
     393|#
     394
     395(define-macro (define-node-field id predicate field)
     396  `(begin
     397     (define (,id node)
     398       (,field (enforce ,predicate node)))
     399     (define (,(concatenate-symbol 'set- id '!) node val)
     400       (,(concatenate-symbol 'set- field '!)
     401        (enforce ,predicate node)
     402        val))))
     403
    379404
    380405;-------------------------------------------------------------------------
     
    388413
    389414(define-record-type literal-reference
    390   ()
    391   ((list '())  ; list of literal nodes that refer to a particular value
    392    ))
     415  (literal-reference-maker list )
     416  literal-reference?
     417  (list literal-reference-list set-literal-reference-list!)) ; list of literal nodes that refer to a particular value
    393418
    394419(define make-literal-reference-list literal-reference-maker)
     
    476501  )          ; the other node types.)
    477502
    478 (define-subrecord lambda lambda-data lambda-data
     503(define-subrecord lambda lambda-data
    479504  ((name)          ; symbol          (for debugging only)
    480505   id              ; unique integer  (for debugging only)
    481506   (type))         ; PROC, KNOWN-PROC, CONT, or JUMP (maybe ESCAPE at some point)
    482   ((block #f)      ; either a basic-block (for flow analysis) or a code-block
    483                    ; (for code generation).
    484    (env #f)        ; a record containing lexical environment data
    485    (protocol #f)   ; calling protocol from the source language
    486    (prev #f)       ; previous node on *LAMBDAS* list
    487    (next #f)       ; next node on *LAMBDAS* list
     507  (lambda-data-maker name id type)
     508  lambda-data?
     509  ((block lambda-data-block set-lambda-data-block!)      ; either a basic-block (for flow analysis) or a code-block
     510                                        ; (for code generation).
     511   (env lambda-data-env set-lambda-data-env!)        ; a record containing lexical environment data
     512   (protocol lambda-data-protocol set-lambda-data-protocol!)   ; calling protocol from the source language
     513   (prev lambda-data-prev set-lambda-data-prev!)       ; previous node on *LAMBDAS* list
     514   (next lambda-data-next set-lambda-data-next!)       ; next node on *LAMBDAS* list
    488515   ))
    489516
  • release/3/prescheme-compiler/node/primop.scm

    r11270 r11695  
    33
    44;   The information about a primitive operation.
    5 
    6 (require-extension srfi-13)
    75
    86(define-record-type primop
     
    7674; procedure primops
    7775
    78 (define-subrecord primop primop-proc-data primop-proc-data
     76(define-subrecord primop primop-proc-data
    7977  (call-index              ; index of argument being called
    8078   )
    81   ())
     79  (primop-proc-data-maker index)
     80  primop-proc-data?
     81  (index primop-proc-data-index set-primop-proc-data-index!))
    8282
    8383(define (primop-procedure? primop)
     
    104104; conditional primops
    105105
    106 (define-subrecord primop primop-cond-data primop-cond-data
     106(define-subrecord primop primop-cond-data
    107107  (expand-to-conditional-proc     ; Expand this call to a conditional
    108108   simplify-conditional?-proc     ; Can this conditional be simplified
    109109   )
    110   ())
     110  (primop-cond-data-maker expand simplify?)
     111  primop-cond-data?
     112  (expand     primop-cond-data-expand)
     113  (simplify?  primop-cond-data-simplify?))
    111114
    112115(define-primop-method expand-to-conditional (call))
  • release/3/prescheme-compiler/node/vector.scm

    r11270 r11695  
    11; Copyright (c) 1993-1999 by Richard Kelsey.  See file COPYING.
    22
    3 
    43;----------------------------------------------------------------------------
    54; STORING NODE TREES IN VECTORS
     
    98
    109(define-record-type vec
    11  (vector    ; an expanding vector (NODE->VECTOR) or just a vector (VECTOR->NODE)
    12   (index)   ; the index of the next empty slot or the next thing to read
    13   locals    ; vector of local variables (VECTOR->NODE only)
    14   )
    15  ())
     10  (vec-maker vector index locals)
     11  vec?
     12  (vector vec-vector) ; an expanding vector (NODE->VECTOR) or just a vector (VECTOR->NODE)
     13  (index vec-index set-vec-index!) ; the index of the next empty slot or the next thing to read
     14  (locals vec-locals)) ; vector of local variables (VECTOR->NODE only)
    1615
    1716(define make-vec vec-maker)
     
    2019
    2120(define (add-datum vec value)
    22   (xvector-set! (vec-vector vec) (vec-index vec) value)
     21  (dynvector-set! (vec-vector vec) (vec-index vec) value)
    2322  (set-vec-index! vec (+ 1 (vec-index vec))))
    2423
     
    3433
    3534(define (node->vector node)
    36   (let ((vec (make-vec (make-xvector #f) 0 #f)))
     35  (let ((vec (make-vec (make-dynvector 32 #f) 0 #f)))
    3736    (real-node->vector node vec)
    38     (xvector->vector (vec-vector vec))))
     37    (list->vector (dynvector->list (vec-vector vec)))))
    3938 
    4039; The main dispatch
Note: See TracChangeset for help on using the changeset viewer.