This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Leon Rische
committed
Jan 28, 2017
1 parent
f111f1d
commit d51e75a
Showing
5 changed files
with
46 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
(defn emit-string (var str) | ||
(let ((len (string-length str)) | ||
(tmp (generate-var))) | ||
(print (format " ~A = call i64 @internal_heap-current-pointer()" tmp)) | ||
(emit-call0 tmp "@internal_heap-current-pointer") | ||
(emit-string_ str 0 len) | ||
(print (format " call i64 @internal_heap-store-byte(i8 0)")) | ||
(print (format " call void @internal_heap-align-index()")) | ||
(print (format " ~A = or i64 ~A, 5" var tmp)))) | ||
(print " call i64 @internal_heap-store-byte(i8 0)") | ||
(print " call void @internal_heap-align-index()") | ||
(print (string-append* (list " " var " = or i64 " tmp ", 5"))))) | ||
|
||
(defn emit-string_ (str idx len) | ||
(if (< idx len) | ||
(begin | ||
(print (format " call i64 @internal_heap-store-byte(i8 ~A)" (char->integer (string-ref str idx)))) | ||
(print (string-append* (list " call i64 @internal_heap-store-byte(i8 " | ||
(fixnum->string (char->integer (string-ref str idx))) | ||
")"))) | ||
(emit-string_ str (add1 idx) len)))) |