diff --git a/Block.pm6 b/Block.pm6 deleted file mode 100644 index 0d016f9c..00000000 --- a/Block.pm6 +++ /dev/null @@ -1,86 +0,0 @@ -use Niecza::Meta::Op; -use Niecza; -use System; -#| Class of blocks of code, which are transparent to control exceptions. -class Block; - -#| Base of the optree executed normally (outside any phasers) -has Op $.do; - -#| If this is a clone, who we were cloned from. -has Block $.prototype; - -#| Outer scope to interpret lexicals in. -has Niecza::FrameBase $.outer; - -#| While I'd love to make C<< postcircumfix:<( )> >> an ordinary operator, -#| this leads to infinite semantic regress. Instead, it is a reprmethod, and -#| our representation system treats L and subclasses specially; when -#| invoked, they pass control to $.clr-delegate, which must be a -#| Niecza.CallableDelegate object. If not defined, the codegen method will be -#| called. -has #`( Niecza::CallableDelegate ) $.clr-delegate; - -# This will need to be much more subtle after the optimizer and BEGIN time go -# in, in particular for specialization purposes. -method codegen() { - if ($.prototype) { - return $.prototype.codegen; - } - - # TODO all functions need to take an IPerl6Object for parameter parcel / - # return parcel - my $body = System::Reflection::DynamicMethod.new("__ANON__", - System::Void, [ Niecza::DynamicFrame, System::Int32 ], Block); - - $body.DefineParameter( 0, System::Reflection::ParameterAttributes.In, - "caller" ); - $body.DefineParameter( 1, System::Reflection::ParameterAttributes.In, - "resumepoint" ); - - my $*IL = $body.GetILGenerator; - my %*CONTLABELS; - - $.do.compile; - - # load current frame - $*IL.Emit(System::Reflection::Emit::OpCodes.Ldarg_0); - # load caller - $*IL.Emit(System::Reflection::Emit::OpCodes.Ldfld, - Niecza::FrameBase.GetField("caller")); - # load current frame - $*IL.Emit(System::Reflection::Emit::OpCodes.Ldarg_0); - # load resumepoint - $*IL.Emit(System::Reflection::Emit::OpCodes.Ldfld, - Niecza::FrameBase.GetField("resumePoint")); - $*IL.Emit(System::Reflection::Emit::OpCodes.Tailcall); - $*IL.Emit(System::Reflection::Emit::OpCodes.Callvirt, - Niecza::FrameBase.GetMethod("Continue")); - $*IL.Emit(System::Reflection::Emit::OpCodes.Ret); - - my $bd = $body.CreateDelegate(Niecza::DynBlockDelegate); - - my $starter = System::Reflection::DynamicMethod.new("__ANON__", - System::Void, [ Niecza::FrameBase, Niecza::FrameBase, System::Int32 ], - Block); - - $starter.DefineParameter( 0, System::Reflection::ParameterAttributes.In, - "outer" ); - $starter.DefineParameter( 1, System::Reflection::ParameterAttributes.In, - "caller" ); - $starter.DefineParameter( 2, System::Reflection::ParameterAttributes.In, - "returnPoint" ); - - my $sil = $starter.GetILGenerator; - - !!!; - - return $starter; -} - -#| Called internally; see L<#$.clr-delegate> -method create-delegate() { - $.code //= self.codegen; - - $.code.CreateDelegate(Niecza::CallableDelegate, $.outer); -} diff --git a/Niecza/CompilerP1.pm6 b/Niecza/CompilerP1.pm6 deleted file mode 100644 index bec6bba2..00000000 --- a/Niecza/CompilerP1.pm6 +++ /dev/null @@ -1,20 +0,0 @@ -#| The main driver for the P1 polymorph of VICIL. This is a static compiler -#| which ties knots by statically generating metaobject tree initializers. -class Niecza::CompilerP1; - -use Niecza::Meta::Op; - -method test() { - #1. Make a lexical alias of System::Console:from - #2. Define the Parcel type (which can't be defined using Perl 6 subs, since - # perl 6 subs need it to work. grr.) - #3. Define the Sub type (doesn't need any methods, since we're static- - # compiling the delegates) - #4. Define Str - #5. Set up a callout for string literals - #6. "Hello world".say - Block.new( - :do(Niecza::Meta::Op::FunCall.new( - :callee( Niecza::Meta::Op::Var.new(:name('&say')) ), - :arguments( Niecza::Meta::Op::StringLiteral.new( :text("Hello, world") ) )))).codegen; -} diff --git a/Niecza/Meta/Op.pm6 b/Niecza/Meta/Op.pm6 deleted file mode 100644 index cf708270..00000000 --- a/Niecza/Meta/Op.pm6 +++ /dev/null @@ -1,25 +0,0 @@ -#| Base class for sprixel op nodes. Op nodes represent Perl 6 in flight -#| between the compiler and the optimizer; they are somewhat lower level than -#| Perl 6 syntax and have very little context sensitivity, but also embody -#| little knowledge of the execution context. -class Niecza::Meta::Op; - -method compile() { ... } - -#| Variable fetch op. Returns the container, or something like that. Can be -#| applied to any simple variable? -class Var is Op { - has Str $.name; #= Name as suitable for L -} - -#| Simple function call. The circularity saw forces us to have an op for this, -#| though I'd so dearly like to generate a call to postcircumfix:<( )> instead. -class FunCall is Op { - has Op $.callee; - has Op @.arguments; -} - -#| Nothing to see here, just the words "hello world". -class StringLiteral is Op { - has Str $.text; -} diff --git a/System.pm6 b/System.pm6 deleted file mode 100644 index 7d51a738..00000000 --- a/System.pm6 +++ /dev/null @@ -1,14 +0,0 @@ -# Mock module for testing. Could be turned into an alternate bootstrap, if -# perlesque doesn't work. - -module System; - -class Void { ... } -class Int32 { ... } - -module Reflection { - module Emit { - class DynamicMethod { ... } - class OpCodes { ... } - } -}