mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Use import DB to compile globals
This commit is contained in:
parent
03416a31f9
commit
6d9ebb1a7c
1 changed files with 9 additions and 7 deletions
|
@ -1080,12 +1080,12 @@
|
||||||
program?
|
program?
|
||||||
lib-name
|
lib-name
|
||||||
lib-exports
|
lib-exports
|
||||||
imported-globals
|
import-db
|
||||||
globals
|
globals
|
||||||
c-headers
|
c-headers
|
||||||
required-libs
|
required-libs
|
||||||
src-file)
|
src-file)
|
||||||
(set! *global-syms* (append globals (lib:idb:ids imported-globals)))
|
(set! *global-syms* (append globals (lib:idb:ids import-db)))
|
||||||
(set! cgen:mangle-global
|
(set! cgen:mangle-global
|
||||||
(lambda (ident)
|
(lambda (ident)
|
||||||
(cond
|
(cond
|
||||||
|
@ -1100,13 +1100,15 @@
|
||||||
(string-append prefix suffix)))
|
(string-append prefix suffix)))
|
||||||
;; Identifier exported by another library
|
;; Identifier exported by another library
|
||||||
(else
|
(else
|
||||||
(let ((import (lib:idb:id->import imported-globals ident)))
|
(let ((idb-entry (lib:idb:lookup import-db ident)))
|
||||||
(cond
|
(cond
|
||||||
((not import)
|
((not idb-entry)
|
||||||
(error `(Unable to find a library importing ,ident)))
|
(error `(Unable to find a library importing ,ident)))
|
||||||
(else
|
(else
|
||||||
(let ((suffix (import->string import))
|
(let ((suffix (import->string
|
||||||
(prefix (mangle-global ident)))
|
(lib:idb:entry->library-name idb-entry)))
|
||||||
|
(prefix (mangle-global
|
||||||
|
(lib:idb:entry->library-id idb-entry))))
|
||||||
(string-append prefix suffix)))))))))
|
(string-append prefix suffix)))))))))
|
||||||
|
|
||||||
(let ((compiled-program-lst '())
|
(let ((compiled-program-lst '())
|
||||||
|
@ -1149,7 +1151,7 @@
|
||||||
(emits "extern object ")
|
(emits "extern object ")
|
||||||
(emits (cgen:mangle-global global))
|
(emits (cgen:mangle-global global))
|
||||||
(emits ";\n"))
|
(emits ";\n"))
|
||||||
(lib:idb:ids imported-globals))
|
(lib:idb:ids import-db))
|
||||||
(emit "#include \"cyclone/runtime.h\"")
|
(emit "#include \"cyclone/runtime.h\"")
|
||||||
|
|
||||||
(if program?
|
(if program?
|
||||||
|
|
Loading…
Add table
Reference in a new issue