Skip to content

Commit 3da613d

Browse files
committed
student files added for review
1 parent aad72c7 commit 3da613d

File tree

6 files changed

+423
-26
lines changed

6 files changed

+423
-26
lines changed

interp.rkt

+6-6
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@
527527

528528
(define/override (interp-C env)
529529
(lambda (ast)
530-
(vomit "R2/interp-C" ast env)
531530
(match ast
532531
;; I should do better than make these noops - andre
533532
[`(initialize ,s ,h)
@@ -556,14 +555,15 @@
556555
(exact-nonnegative-integer? ((interp-C env) size)))
557556
(error 'interp-C "invalid argument(s) to collect in ~a" ast))
558557
env]
559-
;; Referece a global value (should I put these in the environment?)
560-
[`(global-value ,l) (fetch-global l)]
561-
;; TODO: Highly expiramental semantics
562-
[`(movq ,src ,dst) ((interp-x86 env) (list ast))]
563558
;; allocate a vector of length l and type t that is initialized.
564559
[`(allocate ,l ,t) (build-vector l (lambda a uninitialized))]
565560
;; Analysis information making introduce rootstack easier
566-
[`(call-live-roots (,xs ...) ,ss ...) ((send this seq-C env) ss)]
561+
[`(call-live-roots (,xs ...) ,ss ...)
562+
(for ([x (in-list xs)])
563+
(unless (vector? (lookup x env))
564+
(error 'interp-C
565+
"call-live-roots stores non-root ~a in ~a" x ast)))
566+
((send this seq-C env) ss)]
567567
[otherwise ((super interp-C env) ast)])))
568568

569569
(define/override (interp-x86-exp env)

run-tests.rkt

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
("reg_int_exp" #f ,reg-int-exp-passes (0))
2626
("conditionals" ,conditionals-typechecker ,conditionals-passes (0 1))
2727
("vectors" ,vectors-typechecker ,vectors-passes (0 1 2))
28-
("functions" ,functions-typechecker ,functions-passes (0 1 2 3))
29-
("lambda" ,lambda-typechecker ,lambda-passes (0 1 2 3 4))))
28+
;; Commenting out these two compilers until we update them -andre
29+
;;("functions" ,functions-typechecker ,functions-passes (0 1 2 3))
30+
;;("lambda" ,lambda-typechecker ,lambda-passes (0 1 2 3 4))
31+
))
3032

3133
(define compiler-table (make-immutable-hash compiler-list))
3234

runtime.c

+10-17
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
#include <stdio.h>
33
#include "runtime.h"
44
#define DEBUG_MODE 1
5-
/*
6-
// The next free memory location
7-
int64_t* free_ptr;
8-
9-
// The beginning and end of the working heap for the "mutator"
10-
// the program for which we are providing runtime services.
11-
int64_t* fromspace_begin;
12-
int64_t* fromspace_end;
13-
14-
// The rootset of the "mutator" organized in a stack. Each root
15-
// in the stack is a pointer into fromspace, while the "mutator"
16-
// is executing.
17-
int64_t** rootstack_begin;
18-
int64_t** rootstack_end;
19-
*/
205

216
// Often misunderstood static global variables in C are not
227
// accessible to code outside of the module.
@@ -28,8 +13,16 @@ static int64_t* tospace_end;
2813
// checked in order to ensure that initialization has occurred.
2914
static int initialized = 0;
3015

31-
// Vectors have a tag describing their contents in their first memory
32-
// location here are some helpers that can help with their manipulation.
16+
17+
/*
18+
Object Tag (64 bits)
19+
#b|- 7 bit unused -|- 50 bit field [50, 0] -| 6 bits lenght -| 1 bit isForwarding Pointer
20+
* If the bottom-most bit is zero, the tag is really a forwarding pointer.
21+
* Otherwise, its an object. In that case, the next
22+
6 bits give the length of the object (max of 50 64-bit words).
23+
The next 50 bits say where there are pointers.
24+
A '1' is a pointer, a '0' is not a pointer.
25+
*/
3326
static const int TAG_IS_NOT_FORWARD_MASK = 1;
3427
static const int TAG_LENGTH_MASK = 126;
3528
static const int TAG_LENGTH_RSHIFT = 1;

0 commit comments

Comments
 (0)