Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Henry Massalin's Synthesis kernel

Name: Anonymous 2008-08-03 1:46

Anyone know where i can get a copy of Alexia/Henry Massalin's Synthesis kernel?

Name: Anonymous 2008-08-19 5:11

Some of the optimization techniques he talks about implemented in PHP: (I seriously need to learn a different language...)

<?php
// Executable queues and PHP quaject emulation.

$PID = array();

class Thread
{
    public static $num = 0;
    public $parent;
    public $id;
    public $SIG = array('HUP' => 'destroy');
   
    function __construct()
    {
        $this->id = self::$num++;
        global $PID;
        $PID[$this->id] = $this;
    }
    function exec()
    {
        echo "Running " . get_class($this) . "[" . $this->id . "]\n";
        // Emulates timer interrupt by returning =P
        return true;
    }
    function destroy()
    {
        $this->parent->reap();
    }
}
class KThread extends Thread // Kernel thread
{
    function exec()
    {
        static $first = true;
        if ($first) {
            $first = false;
            // Insert a few threads.
            $this->parent->insert(new Thread);
            $this->parent->insert(new Thread);
            $this->parent->insert(new Thread);
        }
        parent::exec();
        sleep(1); // No need to crash at once, let some time pass.
        return true;
    }
}

class PQueue // Emulates a executable data structure.
{
    public $next; // Location in memory the next quaject's go function is...
                   // Currently only the next PQueue.
    public $prev;
    public $proc; // The process
   
    public function start($proc, $prev = null)
    {
        if ($prev !== null) {
            $this->prev = $prev->prev; // Insert us behind it.
            $this->next = $prev;
            $prev->prev->next = $this; // STFU E_STRICT.
            $prev->prev = $this;
        }
        $this->proc = $proc;
        $this->proc->parent = $this;
    }
    public function insert($proc)
    {
        $n = new PQueue;
        $n->start($proc, $this);
    }
    public function go()
    {    // Restore registers here
        $this->proc->exec();
        // Save registers here.
        $this->next->go(); // This will of course be a jump.
    }
    public function reap()
    {
        global $PID;
        unset($PID[$this->proc->id]);
        unset($this->proc);
       
        $this->prev->next = $this->next;
        $this->next->prev = $this->prev; // And we don't exist any more.
        // In the kernel, we would have do decrement the reference pointer here,
        // and then let the KThread free us, but PHP does this automagically.
    }
}
// Kickstart this shit.

$f = new PQueue;

$f->start(new KThread, $f);

$f->go();
echo "This will never be printed.";

// Quaject emulation in PHP:
abstract class Quaject // Currently unused, but interesting.
{
    protected $callout = array();    // func => array($obj, func);
    protected $callback = array(); // func => array($obj, func);
    protected $callentry = array(); // func => \x00lambda_1
    protected $state = array(); // To simulate properties, this can be passed by
     // reference to all call{out,back,entrie}s
    public function __construct() {
        $this->__call('__construct', func_get_args());
    }
    public function __call($m, $args) {
        $args = array_merge($this->state, $args);
        foreach (array('out', 'back', 'entry') as $w) {
            if (isset($this->{'call' . $w}[$m])) {
                call_user_func_array($this->{'call' . $w}[$m], $args);
            }
        }
    }
    public function __clone() {
        // Make all callentries callbacks and clear state.
    }
    public function makeCall($type, $name, $func) {
        $this->{$type}[$name] = $func;
    }
    public function __destruct() {
        $this->__call('__destruct', array());
    }
}
class LolWhut extends Quaject
{
    public function __construct()
    {
        $this->makeCall('callentry', '__construct',
                                        // For PHP >= 5.3, s/EOD/'EOD'/
                        create_function('&$state', <<<EOD
                            echo "Lol, whut?! Function as payload you say?!\n";
EOD
                        )
        );
        parent::__construct(func_get_args());
    }
}

?>


I best be joking? Yes, I best be.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List