freenode/#sicl - IRC Chatlog
Search
6:19:37
beach
Random ideas about register allocation. I have been pondering how to express the x86 constraint that for a typical operation, the first operand must be in the same register as the result. I think I can express that constraint by introducing anonymous registers with an identity. So if I have z <- op(x, y), I can express that as R <- x, R <- op(R, y), z <- R.
6:20:06
beach
Then the problem of register allocation is reduced to assigning anonymous registers to real ones.
6:20:56
beach
I would have a mix between anonymous and real registers in LIR because instructions such as the FUNCALL-INSTRUCTION require arguments to be assigned to specific registers.
6:29:41
beach
Also, it is not quite correct to say that a lexical variable is "assigned to a register", because at any program point, several registers can contain the value of that variable. Take my previous example. A valid solution might have x in some register R' /= R before the operation. Then R <- x will make both R and R' contain the value of x.
6:30:30
beach
I mention that because I think some published techniques for register allocation assume at most one register for each variable.
6:35:00
beach
Hmm. So I think I can make it such that lexical variables appear only as either input or output (but not both) of ASSIGNMENT-INSTRUCTIONs.
6:38:11
beach
Then I can determine a cost of the assignment instruction for different cases. Let's say we have an ASSIGNMENT-INSTRUCTION R <- v. Then if before that instruction v is already in R, then the cost is 0. If v is in a register other than R, the cost is (say) 1. Finally if v is in memory, the cost is higher, say 10.
6:39:33
beach
Not sure this information will help me find a complete technique for register allocation, but it might be a valuable observation.
15:09:27
alandipert
beach i hadn't thought about that observation before that you made, that variables may occupy > 1 registers. but it makes sense
16:19:53
beach
ebrasca: Most existing Common Lisp implementation were largely written before CLOS was part of the language.
16:20:58
beach
Why do you need a LAP. Is it because Mezzano has lots of "assembly code" written manually?
16:21:29
beach
Yes, but the implementation itself is often written in layers, starting with a subset of the language that does not contain CLOS.
16:27:34
beach
You will have a bigger problem, I think, in that you would have to retarget the compiler.
16:29:34
jackdaniel
I believe that clean design will enable some optimizations which would be too cumbersome to implement in sbcl
16:29:38
beach
I want SICL to be the basis for a safe operating system, and I won't allow a user to crash the entire system.
16:31:01
beach
That's the plan, but it won't be called that then. SICL is just a Common Lisp implementation. The multi-user operating system that it will be the basis for is CLOSOS.
16:36:29
jackdaniel
if you are trying to recruit beach I think that it will be hard (given how full is his plate)
16:39:26
beach
ebrasca: Let me try... I want CLOSOS to be a safe, multi-user operating system with universal persistence, using a combination of access-control lists (ACLs) and capabilities for protection. It will have first-class global environments to isolate users from each other, and to prevent ordinary users from creating unsafe code, say by manipulating the code generator of the compiler.
16:41:16
beach
ebrasca: There is no point in trying to compare projects on a single dimension like "best".
16:42:02
beach
Whether one project is "better" than the other has to do with how well it corresponds to your objectives.
16:43:54
beach
I am not the kind of person to denigrate a project just in order to push my own agenda. So I can honestly say that Mezzano, SBCL, ECL, etc. are all great projects, but they don't correspond to the goals I want with SICL and CLOSOS.
16:47:19
jackdaniel
ebrasca: think of it as whole operating system and userland implemented in the kernel
16:52:04
beach
That's why I ask you about definitions. If that is all the supervisor does, and it does it in a way that is not particular, then sure, CLOSOS and every OS has a supervisor.