-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
673 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#lang racket | ||
(provide assert-integer assert-char assert-byte assert-codepoint) | ||
(require a86/ast) | ||
(require "types.rkt") | ||
|
||
(define r9 'r9) | ||
|
||
;; Register -> Asm | ||
(define (assert-integer r) | ||
(seq (Mov r9 r) | ||
(And r9 mask-int) | ||
(Cmp r9 type-int) | ||
(Jne 'err))) | ||
|
||
;; Register -> Asm | ||
(define (assert-char r) | ||
(seq (Mov r9 r) | ||
(And r9 mask-char) | ||
(Cmp r9 type-char) | ||
(Jne 'err))) | ||
|
||
;; Register -> Asm | ||
(define (assert-codepoint r) | ||
(let ((ok (gensym))) | ||
(seq (assert-integer r) | ||
(Cmp r (value->bits 0)) | ||
(Jl 'err) | ||
(Cmp r (value->bits 1114111)) | ||
(Jg 'err) | ||
(Cmp r (value->bits 55295)) | ||
(Jl ok) | ||
(Cmp r (value->bits 57344)) | ||
(Jg ok) | ||
(Jmp 'err) | ||
(Label ok)))) | ||
|
||
;; Register -> Asm | ||
(define (assert-byte r) | ||
(seq (assert-integer r) | ||
(Cmp r (value->bits 0)) | ||
(Jl 'err) | ||
(Cmp r (value->bits 255)) | ||
(Jg 'err))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#lang racket | ||
(provide assert-integer assert-char assert-byte assert-codepoint) | ||
(require a86/ast) | ||
(require "types.rkt") | ||
|
||
(define r9 'r9) | ||
|
||
;; Register -> Asm | ||
(define (assert-integer r) | ||
(seq (Mov r9 r) | ||
(And r9 mask-int) | ||
(Cmp r9 type-int) | ||
(Jne 'err))) | ||
|
||
;; Register -> Asm | ||
(define (assert-char r) | ||
(seq (Mov r9 r) | ||
(And r9 mask-char) | ||
(Cmp r9 type-char) | ||
(Jne 'err))) | ||
|
||
;; Register -> Asm | ||
(define (assert-codepoint r) | ||
(let ((ok (gensym))) | ||
(seq (assert-integer r) | ||
(Cmp r (value->bits 0)) | ||
(Jl 'err) | ||
(Cmp r (value->bits 1114111)) | ||
(Jg 'err) | ||
(Cmp r (value->bits 55295)) | ||
(Jl ok) | ||
(Cmp r (value->bits 57344)) | ||
(Jg ok) | ||
(Jmp 'err) | ||
(Label ok)))) | ||
|
||
;; Register -> Asm | ||
(define (assert-byte r) | ||
(seq (assert-integer r) | ||
(Cmp r (value->bits 0)) | ||
(Jl 'err) | ||
(Cmp r (value->bits 255)) | ||
(Jg 'err))) | ||
|
Oops, something went wrong.