Skip to content
Draft

Cross #1728

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
e24da91
get compile-file working again in cross-clasp
Bike Jul 2, 2025
94049e5
cross-clasp: use regular character-names rather than a new one
Bike Jul 3, 2025
0821011
cross-clasp: get *features* from executable
Bike Jul 3, 2025
886ca42
cross-clasp: initialize all cxx classes
Bike Jul 4, 2025
0ff0237
cross-clasp: use generated package exports
Bike Jul 4, 2025
c0a8bc8
cross-clasp: use generated predefined functions list
Bike Jul 4, 2025
c8997c2
cross-clasp: get package local nicknames working
Bike Jul 5, 2025
5ac565f
cross-clasp: generate package nicknames as well
Bike Jul 5, 2025
b7fdd50
cross-clasp: make process-lambda-list available
Bike Jul 5, 2025
094900a
cross-clasp: get runtime info
Bike Jul 5, 2025
0c68b84
clasp-cleavir: do less at compile time
Bike Jul 5, 2025
b83dc30
move global-inline-status to better spot
Bike Jul 5, 2025
43c23b0
cross-clasp: throw in with-memory-ramp
Bike Jul 5, 2025
3f585fe
clasp-cleavir: explicit :use for packages
Bike Jul 5, 2025
c3054f7
move *dbg-generate-dwarf* to debuginfo.lisp
Bike Jul 5, 2025
0937023
cross-clasp: fix apo functions
Bike Jul 6, 2025
940ea0b
Fix shadowing symbols for LLVM-SYS package
Bike Jul 6, 2025
9497495
define methods accessor for single dispatch GFs
Bike Jul 6, 2025
a954be6
cross-clasp: get runtime's shadowing symbols
Bike Jul 6, 2025
9ff27a5
cross-clasp: fix USE for cmp package
Bike Jul 6, 2025
b202398
cross-clasp: load clasp-cleavir
Bike Jul 6, 2025
8d5efd9
make float-infinity-string available primitively
Bike Jul 7, 2025
8495983
cross-clasp: note primitive variables & constants
Bike Jul 7, 2025
28a28fe
cross-clasp: throw in more native compiler code
Bike Jul 7, 2025
c84735a
cross-clasp: rest of the primitives
Bike Jul 7, 2025
5ea6839
cross-clasp: note primitive setf functions
Bike Jul 7, 2025
861c2a8
cross-clasp: fix use list of LITERAL pkg
Bike Jul 7, 2025
0f1a516
Add descriptions for some cross-clasp rules
Bike Jul 8, 2025
04519f2
cross-clasp: rearrange to compile correctly
Bike Jul 8, 2025
494ae4a
cross-clasp: better cst macrology
Bike Jul 8, 2025
0ff8a80
cross-clasp: more native compiler files
Bike Jul 8, 2025
a82caf3
cross-clasp: compile-file-parallel stuff
Bike Jul 8, 2025
59dd5b5
cross-clasp: more extensions
Bike Jul 8, 2025
913db52
cross-clasp: FLI
Bike Jul 9, 2025
38837c7
cross-clasp: compile w/o cleavir as necessary
Bike Jul 9, 2025
fa597f5
cross-clasp: fix effective accessors
Bike Jul 9, 2025
3d874d9
cross-clasp: rearrange enough to get clasp-cleavir working
Bike Jul 9, 2025
826f6b1
cross-clasp: get faso compile-file working
Bike Jul 9, 2025
360dc14
Remove unneeded reader conditionals
Bike Jul 10, 2025
d20179b
cross-clasp: define own versions of some common macros
Bike Jul 11, 2025
e951f7e
cross-clasp: auto compile
Bike Jul 11, 2025
d051593
cross-clasp: print style warnings, no thanks to SBCL
Bike Jul 11, 2025
38a5980
cross-clasp: fix global env for proxy
Bike Jul 11, 2025
522c5b9
cross-clasp: give method bodies their block
Bike Jul 14, 2025
5997bb7
cross-clasp: don't link when using code walker
Bike Jul 14, 2025
c8430a3
delete FLI alias types
Bike Jul 15, 2025
e2db6df
Fix small bits in compile-bytecode
Bike Jul 16, 2025
839aeba
cross-clasp: use cmpref for cmpltv
Bike Jul 18, 2025
f210588
Update Cleavir
Bike Jul 21, 2025
959cb65
cross-clasp: skip runtime class lookup in miss
Bike Jul 23, 2025
78d554d
cross-clasp: Put type expanders in build environment
Bike Jul 23, 2025
aec9b27
cross-clasp: get type header information
Bike Jul 24, 2025
3fc08f9
Allow :unspecific as pathname host
Bike Jul 24, 2025
9045ccd
cross-clasp: Compiler macros
Bike Jul 24, 2025
6b5bac0
cross-clasp: note class definitions for compiler macros
Bike Jul 24, 2025
a9d1c1f
cross-clasp: load ecclesia
Bike Jul 29, 2025
69310aa
wip
Bike Jul 31, 2025
52b57d0
Accept "" as a pathname host and treat it as equivalent to NIL
Bike Jul 31, 2025
ad3fb0e
Make cross-clasp the main build
Bike Jul 31, 2025
f4e5d95
cross-clasp: some source locations
Bike Aug 1, 2025
e22501f
cross-clasp: source locations for classes
Bike Aug 1, 2025
0de3001
cross-clasp: export gray symbols
Bike Aug 4, 2025
466f664
cross-clasp: external processes
Bike Aug 4, 2025
aa0a408
cross-clasp: fix atomic access to symbols
Bike Aug 4, 2025
e79ec19
cross-clasp: fix bit array functions
Bike Aug 4, 2025
4caa480
cross-clasp: fix method lambda lists
Bike Aug 4, 2025
934ca6d
cross-clasp: Fix argument ordering with format /
Bike Aug 4, 2025
0947d94
cross-clasp: DESCRIBE of operators prints lambda lists
Bike Aug 5, 2025
33e35ec
admit maclina SPI attribute
Bike Aug 5, 2025
269c12f
make tests work with cross-clasp
Bike Aug 5, 2025
d27edef
cross-clasp: fix source info
Bike Aug 5, 2025
b3536b4
cross-clasp: with-float-traps-masked
Bike Aug 5, 2025
9442086
cross-clasp: fix fixnums
Bike Aug 5, 2025
8ea3be9
cross-clasp: disassemble to asm/ir
Bike Aug 6, 2025
dd572b9
cross-clasp: Fix eclector readtable stuff
Bike Aug 6, 2025
55edbaf
Move encoding generation into koga
Bike Aug 6, 2025
e46e9eb
Regression test forms print standardly
Bike Aug 6, 2025
e259381
cross-clasp: remove extraneous thread bindings
Bike Aug 6, 2025
37fab8a
cross-clasp: generic function perf tracing
Bike Aug 6, 2025
d44d633
cross-clasp: backport debugger fix
Bike Aug 6, 2025
1ca0db0
cross-clasp: remove bootstrap psetq definition
Bike Aug 7, 2025
4a847c7
cross-clasp: centralize some exports
Bike Aug 7, 2025
57b5a3a
cross-clasp: xref
Bike Aug 7, 2025
88e49a2
cross-clasp: remove some now-unneeded setf indirections
Bike Aug 7, 2025
33571b5
cross-clasp: define lambda-list-keywords ourselves
Bike Aug 7, 2025
5e1bb42
cross-clasp: define catch+throw for cleavir
Bike Aug 7, 2025
a87ba35
Fix coercion to long float
Bike Aug 7, 2025
5d5b4cb
Fix typep with types like (foo)
Bike Aug 7, 2025
4839d76
cross-clasp: define (setf class-name)
Bike Aug 7, 2025
372a246
Actually use +standard-readtable+ for stuff
Bike Aug 7, 2025
8af01bd
Fix (setf readtable-case) on Eclector readtables
Bike Aug 7, 2025
4ca4d4e
cross-clasp: type error for copy-pprint-dispatch
Bike Aug 8, 2025
5f90b44
cross-clasp: make-instances-obsolete symbol method
Bike Aug 8, 2025
e7ec204
cross-clasp: shared-initialize checks some keyword validity
Bike Aug 8, 2025
ece6a58
Define floating point epsilons better
Bike Aug 8, 2025
7123c86
Slightly more comprehensible epsilon definitions
Bike Aug 8, 2025
7f9727f
cross-clasp: axe clasp-min and some other reader conditionals
Bike Aug 8, 2025
8bd3060
cross-clasp: print-object for structs
Bike Aug 8, 2025
7739c66
cross-clasp: install subclasses
Bike Aug 8, 2025
354a6a5
cross-clasp: static GFs
Bike Aug 9, 2025
2a7a12f
cross-clasp: link together individual fasls during build
Bike Aug 9, 2025
de6badf
cross-clasp: logical SYS:SRC paths for build source locations
Bike Aug 9, 2025
6026e9e
cross-clasp: SEQUENCE package exports
Bike Aug 10, 2025
2c3137f
in FASL loader, use only global package lookup
Bike Aug 10, 2025
3ea3158
cross-clasp: immutable systems
Bike Aug 10, 2025
c11e80c
cross-clasp: Fix GF invalidation performance
Bike Aug 10, 2025
4ebc043
cross-clasp: atomic slot-value
Bike Aug 11, 2025
ca97349
cross-clasp: make generic-function-call-history atomic
Bike Aug 11, 2025
1b49b63
cross-clasp: satiate properly
Bike Aug 11, 2025
90d463e
cross-clasp: compiled discriminating functions
Bike Aug 12, 2025
453d632
cross-clasp: user satiation
Bike Aug 13, 2025
05c47a8
silence dumb warning
Bike Aug 13, 2025
4a054a0
cross-clasp: add remaining files
Bike Aug 13, 2025
e4eb54a
backup xref source locations
Bike Aug 13, 2025
2b690a5
Update for cleavir-env system parameters
Bike Aug 14, 2025
32b3f9c
Remove cleavir-env package from runtime
Bike Aug 14, 2025
0c136ae
silence warning
Bike Aug 14, 2025
87fc9da
cross-clasp: working on native build
Bike Aug 14, 2025
68b0d48
Work towards the cross-clasp extensions build
Bike Aug 15, 2025
143c570
cross-clasp: fix CPL for derivable cxx object
Bike Aug 18, 2025
bc94d56
fix updates for non-instances
Bike Aug 18, 2025
9a09c52
cross-clasp: C++ iterators
Bike Aug 18, 2025
e0b0cf4
cross-clasp: fix CLOS for derivable cxx classes
Bike Aug 19, 2025
77aaa7d
Fix analyzer for cross-clasp
Bike Aug 19, 2025
f95ebd4
Don't put extension translations/immutables in pre-extension build
Bike Aug 19, 2025
c17ca2b
Define alignment methods for FFI
Bike Aug 20, 2025
06b11cd
cross-clasp: cando builds again
Bike Aug 20, 2025
fe6da34
Fully commit to cross-clasp - no more old files
Bike Aug 21, 2025
c517c28
Use cmpref package in new bytecode-machines again
Bike Aug 21, 2025
6cd6522
Delete unused dtree field
Bike Aug 21, 2025
694fd61
Move cmpref package to own file
Bike Aug 21, 2025
7bff452
Separate dtree ops into their own file
Bike Aug 21, 2025
c4d64af
Fix up bytecode-machines
Bike Aug 22, 2025
d1c6a63
Cleanup in aisle cmpliteral
Bike Aug 22, 2025
01874b7
Don't load virtualMachine.h codegen during build
Bike Aug 22, 2025
ef313d5
Pull compiled functions from literals instead of startup call
Bike Aug 22, 2025
29a164e
reorganize translate slightly
Bike Aug 23, 2025
1084fab
more cmpliteral cleanup
Bike Aug 26, 2025
baba757
Remove shady irbuilder in with-module
Bike Aug 26, 2025
e508868
test unwind-protect interrupt behavior
Bike Aug 27, 2025
b73b43d
Fix stepping
Bike Aug 27, 2025
1a438b3
Remove unneeded return value
Bike Aug 27, 2025
09c5e46
Don't bother with llvm.global_ctors for COMPILE
Bike Aug 27, 2025
006459f
fix missing package prefixes
Bike Aug 27, 2025
eccf053
more cmpliteral rearrangements
Bike Aug 27, 2025
7564f9f
Rearrange function generators
Bike Aug 27, 2025
fa52527
Resolve run-time function literals within compiler
Bike Aug 27, 2025
bbac9a7
Initialize JITted runtime code from Lisp
Bike Aug 27, 2025
ba44a3c
delete unused function
Bike Aug 28, 2025
0c110e8
make rtv ID a parameter
Bike Aug 28, 2025
04282c8
reduce use of cmpliteral for runtime compilation
Bike Aug 28, 2025
de2fb0c
Delete entry-point-reference struct
Bike Aug 28, 2025
ce00ff4
cleanup
Bike Aug 28, 2025
4a66142
delete old unused code
Bike Aug 29, 2025
2f48a9a
clasp-cleavir: Keep XEPs out of literals vector if unneeded
Bike Aug 29, 2025
4653f2c
replace aborts in FASO load with errors
Bike Aug 30, 2025
e8439ab
FASOs: move generators out-of-band
Bike Aug 30, 2025
021154e
in runtime compilation refer to core generators directly
Bike Aug 30, 2025
828202a
Move literals installation out of jit.lisp
Bike Sep 2, 2025
df3f887
Store CoreFunGenerator directly in the simple generator
Bike Sep 2, 2025
181f41c
auto-compile whole modules at once
Bike Sep 3, 2025
31704eb
supply module ID to with-rtv
Bike Sep 3, 2025
b8f988b
actually use module-mutable-ltv attribute in FASLs
Bike Sep 3, 2025
1c50675
Update FASL native loader
Bike Sep 8, 2025
aa5d2ec
delete unused struct
Bike Sep 10, 2025
2e27f61
move cmpliteral stuff out of cmpir
Bike Sep 11, 2025
11a873f
Move clasp-cleavir constant allocation
Bike Sep 12, 2025
9ebedee
clean up some cmp stuff
Bike Sep 15, 2025
caf36ff
clasp-cleavir: new literals system
Bike Sep 16, 2025
87c8cef
fix interrupt test typo
Bike Sep 18, 2025
4920959
Add native code in bytecode FASLs, experimentally
Bike Sep 18, 2025
083d634
native FASLs: use ENCLOSE for non-closures
Bike Sep 22, 2025
a4abad9
native FASL: Fix some uses of type checker functions
Bike Sep 23, 2025
dd13671
bytecode to BIR: fix optional parameter ordering
Bike Sep 23, 2025
49959fa
cross-clasp: fix constant definitions during build
Bike Sep 24, 2025
28cfdd5
Fix repos for cross build
Bike Oct 3, 2025
3170834
Update for Cleavir changes to compilation policy
Bike Oct 3, 2025
df017e8
cross-clasp: delete old cleavir code
Bike Oct 15, 2025
eb05bdf
Fix length of native function attribute
Bike Oct 15, 2025
04fb045
entirely disable FASO compilation
Bike Oct 15, 2025
3d58f44
bytecode-to-bir: fix handling of closures in compile-file
Bike Oct 15, 2025
84c3e58
bytecode-to-bir: break out translation code
Bike Oct 15, 2025
c998279
bytecode-to-bir: several fixes for compile-file
Bike Oct 15, 2025
6e6ed26
cross-clasp: have koga build a native fasl image
Bike Oct 15, 2025
0edd26d
btb: fix compile-file handling of keyword arguments
Bike Oct 16, 2025
3c81ef7
use cross extrinsicl for name changes
Bike Oct 23, 2025
e6fcd32
Some first-class global environment support
Bike Oct 24, 2025
de89422
cross-clasp: When self-hosting use the runtime's VM
Bike Oct 27, 2025
96c9ac2
cross clasp: fix self hosted build
Bike Oct 28, 2025
28879d1
Delete unused file
Bike Oct 31, 2025
c69fd31
Fix disassemble of bytecode functions with native functions
Bike Oct 31, 2025
7a08974
cross-clasp: accept package designators to find-package
Bike Nov 4, 2025
f31f278
Provisional deoptimization interface
Bike Nov 5, 2025
8810b95
remove redundant casts
Bike Nov 5, 2025
2c641a7
add missing ignore decls
Bike Nov 10, 2025
d468f83
avoid needless load time iteration in cmpintrinsics
Bike Nov 10, 2025
0019487
Make JIT errors into Lisp errors
Bike Nov 10, 2025
7e3d3ba
better error message when failing to load native module
Bike Nov 10, 2025
90a12ec
some fixes for b2b file compilation
Bike Nov 10, 2025
5825246
cross-clasp: trying native compilation again
Bike Nov 10, 2025
d58a675
cross-clasp: Update for Maclina find-package change
Bike Nov 12, 2025
4c007bf
Update for Maclina handling of package local nicknames
Bike Nov 14, 2025
4f9766e
cross-clasp: rename eql-specializer->compiler-eql-specializer
Bike Nov 14, 2025
fd00f77
cross-clasp: incremental builds, sorta
Bike Nov 15, 2025
84ddb51
fix predicate name
Bike Nov 17, 2025
a6b1d24
Fix package export problems
Bike Nov 17, 2025
ab94777
cross-clasp: fix native build in koga
Bike Nov 18, 2025
3eb4885
Fix fencepost error in b2b
Bike Nov 25, 2025
a41d993
b2b file compiler: finalize module before dumping
Bike Nov 26, 2025
1784dbc
Delete old file
Bike Nov 26, 2025
28746e2
cross-clasp: remove custom reader client
Bike Dec 1, 2025
6911a91
use static method
Bike Dec 1, 2025
c97a979
make snapshot tests fail earlier, sometimes
Bike Dec 1, 2025
38e4a8b
Revert "Make JIT errors into Lisp errors"
Bike Dec 1, 2025
6148b1e
First class environments for the bytecode compiler
Bike Dec 4, 2025
86c3f47
first class environments for compile-file
Bike Oct 21, 2025
12515a5
clean up alternate-environment PROGV
Bike Dec 4, 2025
317eab3
compile-file: Bind *package* etc. in provided environment
Bike Dec 4, 2025
a73a5c2
cmpltv: don't cons a new client every time
Bike Dec 5, 2025
f93b328
Fix COMPILE-FILE-PATHNAME
Bike Dec 10, 2025
44fa036
cross-clasp: Define stuff for the clasp host
Bike Dec 10, 2025
fb02af1
eclector client for alternate environments
Bike Dec 10, 2025
e0ee144
native FASLs: make compiler more resilient
Bike Dec 10, 2025
bd91bfa
cmpltv: Fix treatment of passed in global environment
Bike Dec 10, 2025
cc0580e
More avoidance of FASOs
Bike Dec 10, 2025
d846eb5
cross-clasp: For native build use clasp's own compiler
Bike Dec 10, 2025
3ae3ef1
Make use of THE in compiler macroexpansions more b2b-amenable
Bike Dec 11, 2025
8dd86b7
cross-clasp: simpler setf -> less compiling
Bike Dec 16, 2025
7894393
fix format args typo
Bike Dec 16, 2025
283fb06
compile-file-parallel for native FASLs
Bike Dec 22, 2025
efaa2e6
cross-clasp: fork build
Bike Jan 14, 2026
fe916d2
cross clasp: use ANSI control again
Bike Jan 14, 2026
e6be5b3
Fix typo in Trucler support
Bike Jan 16, 2026
0d47ddd
Fix trucler constants, sorta
Bike Jan 16, 2026
7e2246a
compile-file: replace :execution with :parallel
Bike Jan 16, 2026
8539e04
Fix THE-SINGLE
Bike Jan 26, 2026
6ab02a1
Merge branch 'main' into cross
Bike Jan 27, 2026
f795da7
Use Alexandria fork to fix its bug #49
Bike Feb 4, 2026
2a57cb2
Remove broken Lisp definitions of asin/acos
Bike Feb 4, 2026
6cc7771
Remove most code related to FASOs
Bike Feb 5, 2026
b822251
Delete old clasp builder and more FASO code
Bike Feb 5, 2026
2bfa698
delete init.lisp, no longer needed
Bike Feb 5, 2026
55c4d47
Expose native FASL compilation
Bike Feb 6, 2026
21ad518
Fix compile-file-parallel
Bike Feb 6, 2026
8257a71
remove obsolescent compile-file parameters
Bike Feb 6, 2026
f3bcd17
Define some FCGE functions in Clasp proper
Bike Feb 6, 2026
922f3ed
Fix some warnings during build
Bike Feb 6, 2026
32f2e6d
Extend IR disassembler to use b2b for bytecode functions
Bike Feb 6, 2026
ae87a6b
b2b: compile throw instructions
Bike Feb 6, 2026
1f1cb7c
downgrade b2b compiler failure warnings to notes
Bike Feb 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletions include/clasp/core/bytecode_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,36 +352,47 @@ class Lexenv_O : public General_O {
T_sp _funs;
List_sp _decls;
size_t frame_end;
T_sp _global;

public:
Lexenv_O(T_sp nvars, T_sp ntags, T_sp nblocks, T_sp nfuns, List_sp ndecls, size_t nframe_end)
: _vars(nvars), _tags(ntags), _blocks(nblocks), _funs(nfuns), _decls(ndecls), frame_end(nframe_end){};
Lexenv_O(T_sp nvars, T_sp ntags, T_sp nblocks, T_sp nfuns, List_sp ndecls, size_t nframe_end, T_sp global = nil<T_O>())
: _vars(nvars), _tags(ntags), _blocks(nblocks), _funs(nfuns), _decls(ndecls), frame_end(nframe_end), _global(global) {};
CL_LISPIFY_NAME(lexenv/make)
CL_LAMBDA(vars tags blocks funs decls frame_end &optional global)
CL_DEF_CLASS_METHOD
static Lexenv_sp make(T_sp vars, T_sp tags, T_sp blocks, T_sp funs, List_sp decls, size_t frame_end) {
return gctools::GC<Lexenv_O>::allocate<gctools::RuntimeStage>(vars, tags, blocks, funs, decls, frame_end);
static Lexenv_sp make(T_sp vars, T_sp tags, T_sp blocks, T_sp funs, List_sp decls, size_t frame_end, T_sp global) {
return gctools::GC<Lexenv_O>::allocate<gctools::RuntimeStage>(vars, tags, blocks, funs, decls, frame_end, global);
}
static Lexenv_sp make_top_level() {
return make(nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), 0);
static Lexenv_sp make_top_level(T_sp global = nil<T_O>()) {
return make(nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), nil<core::T_O>(), 0, global);
}
CL_DEFMETHOD List_sp vars() const { return this->_vars; }
CL_DEFMETHOD List_sp tags() const { return this->_tags; }
CL_DEFMETHOD List_sp blocks() const { return this->_blocks; }
CL_DEFMETHOD List_sp funs() const { return this->_funs; }
CL_DEFMETHOD List_sp decls() const { return this->_decls; }
CL_DEFMETHOD size_t frameEnd() const { return this->frame_end; }
CL_DEFMETHOD T_sp global() const { return this->_global; }

public:
inline Lexenv_sp sub_vars(List_sp vars, size_t frame_end) const {
return make(vars, tags(), blocks(), funs(), decls(), frame_end);
return make(vars, tags(), blocks(), funs(), decls(), frame_end, global());
}
inline Lexenv_sp sub_funs(List_sp funs) const {
return make(vars(), tags(), blocks(), funs, decls(), frameEnd(), global());
}
inline Lexenv_sp sub_funs(List_sp funs) const { return make(vars(), tags(), blocks(), funs, decls(), frameEnd()); }
inline Lexenv_sp sub_funs(List_sp funs, size_t frame_end) const {
return make(vars(), tags(), blocks(), funs, decls(), frame_end);
return make(vars(), tags(), blocks(), funs, decls(), frame_end, global());
}
inline Lexenv_sp sub_tags(List_sp tags) const {
return make(vars(), tags, blocks(), funs(), decls(), frameEnd() + 1, global());
}
inline Lexenv_sp sub_block(List_sp blocks) const {
return make(vars(), tags(), blocks, funs(), decls(), frameEnd() + 1, global());
}
inline Lexenv_sp sub_decls(List_sp decls) const {
return make(vars(), tags(), blocks(), funs(), decls, frameEnd(), global());
}
inline Lexenv_sp sub_tags(List_sp tags) const { return make(vars(), tags, blocks(), funs(), decls(), frameEnd() + 1); }
inline Lexenv_sp sub_block(List_sp blocks) const { return make(vars(), tags(), blocks, funs(), decls(), frameEnd() + 1); }
inline Lexenv_sp sub_decls(List_sp decls) const { return make(vars(), tags(), blocks(), funs(), decls, frameEnd()); }

public:
/* Bind each variable to a stack location, returning a new lexical
Expand Down Expand Up @@ -809,9 +820,9 @@ class LoadTimeValueInfo_O : public General_O {
CL_DEFMETHOD T_sp form() { return this->_form; }
CL_LISPIFY_NAME(LoadTimeValueInfo/ReadOnlyP)
CL_DEFMETHOD bool read_only_p() { return this->_read_only_p; }
// Evaluate the load time value form.
// Evaluate the load time value form in the given global environment.
CL_LISPIFY_NAME(LoadTimeValueInfo/eval)
CL_DEFMETHOD T_sp eval();
CL_DEFMETHOD T_sp eval(T_sp env);
};

// Wrapper for compiler constant literals. Having this is necessary to
Expand Down Expand Up @@ -940,7 +951,7 @@ class Module_O : public General_O {
CL_DEFMETHOD SimpleVector_sp create_debug_info();
// Link, then create actual run-time function objects and a bytecode module.
// Suitable for cl:compile.
CL_DEFMETHOD void link_load();
CL_DEFMETHOD void link_load(T_sp env);
};

class Cfunction_O : public General_O {
Expand Down Expand Up @@ -1043,15 +1054,15 @@ class Cfunction_O : public General_O {
public:
// Convenience method to link the module and return the new bytecode function
// corresponding to this cfunction. Good for cl:compile.
CL_DEFMETHOD Function_sp link_function();
CL_DEFMETHOD Function_sp link_function(T_sp env);
public:
// For use as a BytecodeDebugInfo.
T_sp start() const;
T_sp end() const;
};

// Main entry point
Function_sp bytecompile(T_sp, Lexenv_sp);
Function_sp bytecompile(T_sp, T_sp);
// main entry point for using the evaluator
T_mv cmp__bytecode_implicit_compile_form(T_sp, T_sp);
T_mv bytecode_toplevel_eval(T_sp, T_sp);
Expand Down
32 changes: 0 additions & 32 deletions include/clasp/core/cleavirEnvPackage.fwd.h

This file was deleted.

3 changes: 1 addition & 2 deletions include/clasp/core/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct Initializer {
};

size_t startup_functions_are_waiting();
core::T_O* startup_functions_invoke(T_O* literals_or_null);
void startup_functions_invoke(T_O* literals_or_null);

std::tuple<void*, string> do_dlopen(const string& str_path, const int n_mode);
std::tuple<int, string> do_dlclose(void* p_handle);
Expand Down Expand Up @@ -95,7 +95,6 @@ void expect_offset(T_sp key, T_sp alist, size_t expected);
};

namespace core {
void start_code_interpreter(gctools::GCRootsInModule* roots, char* bytecode, size_t nbytes, bool log);
void core__throw_function(T_sp tag, T_sp result_form);
void register_startup_function(const StartUp& startup);
void transfer_StartupInfo_to_my_thread();
Expand Down
2 changes: 0 additions & 2 deletions include/clasp/core/configure_clasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ THE SOFTWARE.

#define __EX(var) #var
#define CXX_MACRO_STRING(var) __EX(var)
#define CLASP_GCROOTS_IN_MODULE(NAME) __clasp_gcroots_in_module_##NAME
#define GCROOTS_IN_MODULE_NAME CXX_MACRO_STRING(CLASP_GCROOTS_IN_MODULE())
#define CLASP_LITERALS(NAME) __clasp_literals_##NAME
#define LITERALS_NAME CXX_MACRO_STRING(CLASP_LITERALS())
#define INTPTR_BITS 64
Expand Down
3 changes: 0 additions & 3 deletions include/clasp/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ typedef double long_float_t;
#define NOINLINE __attribute__((noinline))
#define MAYBE_INLINE __attribute__((noinline))

#define RUN_ALL_FUNCTION_NAME "RUN-ALL"
#define CLASP_CTOR_FUNCTION_NAME "CLASP-CTOR"

#ifdef CLASP_THREADS
#include <atomic>
#endif
Expand Down
33 changes: 15 additions & 18 deletions include/clasp/core/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,8 @@ namespace core {
extern char* global_dump_functions;

/* The following MUST MATCH %function-description% in cmpintrinsics.lisp
Each thread maintains a current GCRootsInModule structure that stores roots
used by the FunctionDescription objects. Every time a Function_O object is created
a FunctionDescription is allocated using 'new' and if the GCRootsInModule can still fit
all of the slots (two currently) indicated by the fields that end in 'Index' then that
GCRootsInModule* is written into the FunctionDescription and the indices into the
GCRootsInModule are written into the FunctionDescription. Then the function description
objects that need to be managed by the GC are written into the GCRootsInModule object.
A pointer to the new FunctionDescription object is then written into the instance
Every time a Function_O object is created
a FunctionDescription is allocated using 'new'. A pointer to the new FunctionDescription object is then written into the instance
of the Function_O subclass. A virtual function in the Function_O is used to
recover the pointer to the FunctionDescription object for the Function_O.
I used a virtual function because different subclasses store the FunctionDescription*
Expand Down Expand Up @@ -312,6 +306,7 @@ class CoreFunGenerator_O : public General_O {
CL_DEFMETHOD FunctionDescription_sp functionDescription() const {
return this->_FunctionDescription;
}
CoreFun_sp generate(void**) const;
};

// A SimpleCoreFun is a SimpleFun with an associated CoreFun.
Expand Down Expand Up @@ -397,15 +392,17 @@ class SimpleCoreFunGenerator_O : public General_O {
public:
FunctionDescription_sp _FunctionDescription;
T_sp _entry_point_indices;
size_t _localFunIndex;
CoreFunGenerator_sp _CoreFunGenerator;

public:
// Accessors
SimpleCoreFunGenerator_O(FunctionDescription_sp fdesc, T_sp entry_point_indices, size_t lepIndex)
: _FunctionDescription(fdesc), _entry_point_indices(entry_point_indices), _localFunIndex(lepIndex){};
SimpleCoreFunGenerator_O(FunctionDescription_sp fdesc, T_sp entry_point_indices, CoreFunGenerator_sp cfg)
: _FunctionDescription(fdesc), _entry_point_indices(entry_point_indices), _CoreFunGenerator(cfg){};
std::string __repr__() const;
size_t coreFunIndex() const;
CL_LISPIFY_NAME(SimpleCoreFunGenerator/CoreFunGenerator);
CL_DEFMETHOD CoreFunGenerator_sp coreFunGenerator() const { return this->_CoreFunGenerator; }
CL_DEFMETHOD FunctionDescription_sp functionDescription() const { return this->_FunctionDescription; };
SimpleCoreFun_sp generate(CoreFun_sp, void**) const;
};

FunctionDescription_sp makeFunctionDescription(T_sp functionName, T_sp lambda_list = unbound<T_O>(), T_sp docstring = nil<T_O>(),
Expand Down Expand Up @@ -442,9 +439,6 @@ BytecodeSimpleFun_sp core__makeBytecodeSimpleFun(FunctionDescription_sp fdesc, B
size_t localsFrameSize, size_t environmentSize, size_t pcIndex,
size_t bytecodeSize, Pointer_sp trampoline);

SimpleCoreFun_sp makeSimpleCoreFunFromGenerator(SimpleCoreFunGenerator_sp ep, gctools::GCRootsInModule* roots, void** fptrs);
CoreFun_sp makeCoreFunFromGenerator(CoreFunGenerator_sp ep, void** fptrs);

}; // namespace core

namespace core {
Expand Down Expand Up @@ -504,15 +498,18 @@ class FunctionCell_O : public Function_O {
static FunctionCell_sp make(T_sp name, Function_sp initial);
static FunctionCell_sp make(T_sp name); // unbound
public:
Function_sp real_function() const {
CL_LISPIFY_NAME(FunctionCell/function)
CL_DEFMETHOD Function_sp real_function() const {
// relaxed because nobody should be synchronizing on this,
// but in practice it's probably irrelevant what we do?
return this->_Function.load(std::memory_order_relaxed);
}
void real_function_set(Function_sp fun) { this->_Function.store(fun, std::memory_order_relaxed); }
static SimpleFun_sp cachedUnboundSimpleFun(T_sp name);
void fmakunbound(T_sp name);
bool fboundp() const;
CL_LISPIFY_NAME(FunctionCell/makunbound)
CL_DEFMETHOD void fmakunbound(T_sp name);
CL_LISPIFY_NAME(FunctionCell/boundp)
CL_DEFMETHOD bool fboundp() const;
// like real_function() but signals an error if we are un-fbound.
Function_sp fdefinition() const;

Expand Down
2 changes: 2 additions & 0 deletions include/clasp/core/lisp.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,13 @@ class Lisp {
private:
T_sp findPackage_no_lock(String_sp packageName) const;
T_sp findPackage_no_lock(const string& packageName) const;
T_sp findPackageGlobal_no_lock(String_sp packageName) const;

public:
bool recognizesPackage(const string& packageName) const;
T_sp findPackage(const string& packageName, bool errorp = false) const;
T_sp findPackage(String_sp packageName, bool errorp = false) const;
T_sp findPackageGlobal(String_sp packageName, bool errorp = false) const;
void inPackage(const string& packageName);
void selectPackage(Package_sp pack);
Package_sp getCurrentPackage() const;
Expand Down
16 changes: 13 additions & 3 deletions include/clasp/core/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class VariableCell_O : public General_O {
mutable std::atomic<uint32_t> _BindingIdx;
T_sp _Name; // used for error messages and printing only
public:
CL_LISPIFY_NAME(VariableCell/make)
CL_DEF_CLASS_METHOD
static VariableCell_sp make(T_sp name);

private:
Expand All @@ -115,6 +117,8 @@ class VariableCell_O : public General_O {
uint32_t ensureBindingIndex() const;

// Return the value, or UNBOUND if unbound.
CL_LISPIFY_NAME(VariableCell/ValueUnsafe)
CL_DEFMETHOD
T_sp valueUnsafe() const {
#ifdef CLASP_THREADS
uint32_t index = this->_BindingIdx.load(std::memory_order_relaxed);
Expand All @@ -135,10 +139,14 @@ class VariableCell_O : public General_O {
#endif
return globalValueUnsafeSeqCst();
}
inline bool boundP() const { return !(valueUnsafe().unboundp()); }
CL_LISPIFY_NAME(VariableCell/boundp)
CL_DEFMETHOD
bool boundP() const { return !(valueUnsafe().unboundp()); }

// Return the value or signal an error if unbound.
inline T_sp value() const {
CL_LISPIFY_NAME(VariableCell/value)
CL_DEFMETHOD
T_sp value() const {
T_sp val = valueUnsafe();
if (val.unboundp())
unboundError();
Expand All @@ -162,7 +170,9 @@ class VariableCell_O : public General_O {
else
return val;
}
inline void makunbound() { set_value(unbound<T_O>()); }
CL_LISPIFY_NAME(VariableCell/makunbound)
CL_DEFMETHOD
void makunbound() { set_value(unbound<T_O>()); }
inline T_sp valueSeqCst() const {
T_sp val = valueUnsafeSeqCst();
if (val.unboundp())
Expand Down
34 changes: 33 additions & 1 deletion include/clasp/core/unwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <clasp/core/object.h>
#include <clasp/core/symbol.h>
#include <clasp/core/arguments.h> // DynamicScopeManager
#include <clasp/core/evaluator.h> // eval::funcall

namespace core {

Expand Down Expand Up @@ -337,7 +338,7 @@ template <typename Catchf> T_mv call_with_catch(T_sp tag, Catchf&& cf) {
}
}

template <typename Boundf> __attribute__((optnone)) T_mv fprogv(List_sp symbols, List_sp values, Boundf&& bound) {
template <typename Boundf> T_mv fprogv(List_sp symbols, List_sp values, Boundf&& bound) {
if (symbols.consp()) {
Symbol_sp sym = CONS_CAR(symbols).as<Symbol_O>();
List_sp nsymbols = CONS_CDR(symbols);
Expand All @@ -353,4 +354,35 @@ template <typename Boundf> __attribute__((optnone)) T_mv fprogv(List_sp symbols,
}
}

template <typename Boundf> T_mv fprogv_env_aux(T_sp env,
List_sp symbols, List_sp values,
Boundf&& bound) {
// general case, look up cells
if (symbols.consp()) {
Symbol_sp sym = CONS_CAR(symbols).as<Symbol_O>();
T_sp rcell = eval::funcall(_sym_fcge_ensure_vcell, env, sym);
VariableCell_sp cell = rcell.as<VariableCell_O>();
List_sp nsymbols = CONS_CDR(symbols);
if (values.consp()) {
return call_with_cell_bound(cell, CONS_CAR(values),
[&]() { return fprogv_env_aux(env, nsymbols, CONS_CDR(values), bound); });
} else { // out of values - make unbound
return call_with_cell_bound(cell, unbound<T_O>(),
[&]() { return fprogv_env_aux(env, nsymbols, nil<T_O>(), bound); });
}
} else { // no symbols
return bound();
}
}

template <typename Boundf> T_mv fprogv_env(T_sp env, List_sp symbols, List_sp values,
Boundf&& bound) {
// special case: if env is nil (the usual main environment), use fprogv.
// This avoids calling fcge-ensure-vcell, so it's ok to do primitively.
if (env.nilp()) return fprogv(symbols, values, bound);
// more generally: look up cells in the environment
// (but don't bother to repeat this nilp check)
else return fprogv_env_aux(env, symbols, values, bound);
}

}; // namespace core
Loading
Loading