Skip to content

Commit 0c3d652

Browse files
committed
More deparroting
1 parent 560522b commit 0c3d652

File tree

4 files changed

+7
-236
lines changed

4 files changed

+7
-236
lines changed

src/NQP/Compiler.nqp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ my @clo := $nqpcomp.commandline_options();
2727
@clo.push('no-regex-lib');
2828
@clo.push('stable-sc');
2929
@clo.push('optimize=s');
30-
#?if parrot
31-
@clo.push('vmlibs=s');
32-
@clo.push('dynext=s');
33-
#?endif
3430
#?if jvm
3531
@clo.push('javaclass=s');
3632
@clo.push('bootstrap');
@@ -49,10 +45,6 @@ $nqpcomp.addstage('classname', :after<start>);
4945
@clo.push('nyi=s');
5046
#?endif
5147

52-
#?if parrot
53-
# XXX FIX ME
54-
sub MAIN(@ARGS) {
55-
#?endif
5648
#?if moar
5749
# XXX FIX ME
5850
sub MAIN(@ARGS) {

src/NQP/World.nqp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ class NQP::World is HLL::World {
3333
%!code_object_fixup_list := nqp::hash();
3434
%!code_stub_sc_idx := nqp::hash();
3535
@!clearup_tasks := nqp::list();
36-
37-
#?if parrot
38-
if nqp::defined(%*COMPILING<%?OPTIONS><dynext>) {
39-
my $dynext_path := %*COMPILING<%?OPTIONS><dynext>;
40-
my @dynext_paths := pir::getinterp__P()[pir::const::IGLOBALS_LIB_PATHS][pir::const::PARROT_LIB_PATH_DYNEXT];
41-
42-
@dynext_paths.push($dynext_path);
43-
}
44-
#?endif
4536
}
4637

4738
# Creates a new lexical scope and puts it on top of the stack.
@@ -102,7 +93,6 @@ class NQP::World is HLL::World {
10293
QAST::Op.new(
10394
:op('loadbytecode'),
10495
QAST::VM.new(
105-
:parrot(QAST::SVal.new( :value('ModuleLoader.pbc') )),
10696
:jvm(QAST::SVal.new( :value('ModuleLoader.class') )),
10797
:moar(QAST::SVal.new( :value('ModuleLoader.moarvm') ))
10898
)),
@@ -129,7 +119,6 @@ class NQP::World is HLL::World {
129119
QAST::Op.new(
130120
:op('loadbytecode'),
131121
QAST::VM.new(
132-
:parrot(QAST::SVal.new( :value('ModuleLoader.pbc') )),
133122
:jvm(QAST::SVal.new( :value('ModuleLoader.class') )),
134123
:moar(QAST::SVal.new( :value('ModuleLoader.moarvm') ))
135124
)),
@@ -428,10 +417,6 @@ class NQP::World is HLL::World {
428417
$obj.HOW."$meta_method_name"($obj, $to_add);
429418
}
430419

431-
method pkg_add_parrot_vtable_handler_mapping($obj, $name, $att_name) {
432-
$obj.HOW.add_parrot_vtable_handler_mapping($obj, $name, $att_name);
433-
}
434-
435420
# Composes the package.
436421
method pkg_compose($obj) {
437422
$obj.HOW.compose($obj);
@@ -479,16 +464,6 @@ class NQP::World is HLL::World {
479464

480465
# Adds libraries that NQP code depends on.
481466
method libs() {
482-
#?if parrot
483-
# Need to load the NQP dynops/dympmcs, plus any extras requested.
484-
my @loadlibs := ['nqp_group', 'nqp_ops', 'nqp_bigint_ops', 'trans_ops', 'io_ops'];
485-
if %*COMPILING<%?OPTIONS><vmlibs> {
486-
for nqp::split(',', %*COMPILING<%?OPTIONS><vmlibs>) {
487-
@loadlibs.push($_);
488-
}
489-
}
490-
QAST::VM.new( :@loadlibs );
491-
#?endif
492467
#?if jvm
493468
QAST::Op.new( :op('null') )
494469
#?endif
@@ -519,20 +494,6 @@ class NQP::World is HLL::World {
519494

520495
# Adds some initial tasks.
521496
method add_initializations() {
522-
self.add_load_dependency_task(:deserialize_ast(QAST::VM.new(
523-
:parrot(QAST::Stmts.new(
524-
QAST::VM.new( :pirop('nqp_dynop_setup v') ),
525-
QAST::VM.new( :pirop('nqp_bigint_setup v') ),
526-
QAST::Op.new(
527-
:op('callmethod'), :name('hll_map'),
528-
QAST::VM.new( :pirop('getinterp P') ),
529-
QAST::VM.new( :pirop('get_class Ps'), QAST::SVal.new( :value('LexPad') ) ),
530-
QAST::VM.new( :pirop('get_class Ps'), QAST::SVal.new( :value('NQPLexPad') ) )
531-
))),
532-
:jvm(QAST::Op.new( :op('null') )),
533-
:moar(QAST::Op.new( :op('null') )),
534-
:js(QAST::Op.new( :op('null') ))
535-
)));
536497
}
537498

538499
# Does cleanups.
@@ -542,18 +503,13 @@ class NQP::World is HLL::World {
542503

543504
# Makes a list safe to cross the compilation boundary.
544505
sub compilee_list(@orig?) {
545-
#?if parrot
546-
nqp::islist(@orig) ?? @orig !! nqp::list()
547-
#?endif
548-
#?if !parrot
549506
my $list := nqp::create(nqp::bootarray());
550507
if nqp::islist(@orig) {
551508
for @orig {
552509
nqp::push($list, $_);
553510
}
554511
}
555512
$list
556-
#?endif
557513
}
558514

559515
# Checks if the given name is known anywhere in the lexpad

src/QRegex/Cursor.nqp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,7 @@ role NQPCursorRole is export {
121121
$shared := nqp::create(ParseShared);
122122
nqp::bindattr($shared, ParseShared, '$!CUR_CLASS', $?CLASS);
123123
nqp::bindattr($shared, ParseShared, '$!orig', nqp::decont($orig));
124-
nqp::bindattr_s($shared, ParseShared, '$!target',
125-
#?if parrot
126-
pir::trans_encoding__Ssi($orig, pir::find_encoding__Is('ucs4')));
127-
#?endif
128-
#?if !parrot
129-
$orig);
130-
#?endif
124+
nqp::bindattr_s($shared, ParseShared, '$!target', $orig);
131125
nqp::bindattr_i($shared, ParseShared, '$!highwater', 0);
132126
nqp::bindattr($shared, ParseShared, '@!highexpect', nqp::list_s());
133127
nqp::bindattr($shared, ParseShared, '%!marks', nqp::hash());
@@ -814,16 +808,9 @@ class NQPMatch is NQPCapture {
814808
method to() { $!to }
815809
method CURSOR() { $!cursor }
816810
method PRECURSOR() { $!cursor."!cursor_init"($!orig,:p($!from)) }
817-
#?if parrot
818-
method Str() is parrot_vtable('get_string') { nqp::substr($!orig, $!from, $!to-$!from) }
819-
method Int() is parrot_vtable('get_integer') { +self.Str() }
820-
method Num() is parrot_vtable('get_number') { +self.Str() }
821-
#?endif
822-
#?if !parrot
823811
method Str() { nqp::substr($!orig, $!from, $!to-$!from) }
824812
method Int() { +self.Str() }
825813
method Num() { +self.Str() }
826-
#?endif
827814
method Bool() { $!to >= $!from }
828815
method chars() { $!to >= $!from ?? $!to - $!from !! 0 }
829816

tools/lib/NQP/Configure.pm

Lines changed: 6 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,17 @@ use File::Copy qw(copy);
77
use base qw(Exporter);
88
our @EXPORT_OK = qw(sorry slurp system_or_die
99
cmp_rev
10-
read_parrot_config read_config
10+
read_config
1111
fill_template_file fill_template_text
1212
git_checkout
1313
verify_install gen_moar
1414
github_url
1515
probe_node
16-
gen_nqp gen_parrot);
16+
gen_nqp);
1717

1818
our $exe = $^O eq 'MSWin32' ? '.exe' : '';
1919
our $bat = $^O eq 'MSWin32' ? '.bat' : '';
2020

21-
our @required_parrot_files = qw(
22-
@bindir@/parrot@exe@
23-
@bindir@/pbc_to_exe@exe@
24-
@bindir@/@ops2c@@exe@
25-
@libdir@@versiondir@/tools/build/pmc2c.pl
26-
@srcdir@@versiondir@/pmc
27-
@includedir@@versiondir@/pmc
28-
);
29-
3021
our @required_nqp_files = qw(
3122
@bindir@/nqp-p@exe@
3223
);
@@ -94,57 +85,6 @@ sub read_config {
9485
}
9586

9687

97-
sub read_parrot_config {
98-
my @parrot_config_src = @_;
99-
my %config = ();
100-
open my $CONFIG_PIR, '>', 'parrot-config.pir'
101-
or die "Unable to write parrot-config.pir\n";
102-
print $CONFIG_PIR <<'END';
103-
.include 'iglobals.pasm'
104-
.sub "main" :main
105-
.local pmc interp, config_hash, config_iter
106-
interp = getinterp
107-
config_hash = interp[.IGLOBALS_CONFIG_HASH]
108-
config_iter = iter config_hash
109-
config_loop:
110-
unless config_iter goto config_done
111-
$P0 = shift config_iter
112-
print "parrot::"
113-
$S0 = $P0.'key'()
114-
print $S0
115-
print "="
116-
$S0 = $P0.'value'()
117-
print $S0
118-
print "\n"
119-
goto config_loop
120-
config_done:
121-
.return ()
122-
.end
123-
END
124-
close($CONFIG_PIR);
125-
126-
for my $file (@parrot_config_src) {
127-
no warnings;
128-
if ($file =~ /.pir$/ && open my $PARROT_CONFIG, '<', $file) {
129-
while (<$PARROT_CONFIG>) {
130-
if (/P0\["(.*?)"\], "(.*?)"/) { $config{"parrot::$1"} = $2 }
131-
}
132-
close($PARROT_CONFIG) or die $!;
133-
}
134-
elsif (open my $PARROT, '-|', "\"$file\" parrot-config.pir") {
135-
while (<$PARROT>) {
136-
if (/^([\w:]+)=(.*)/) { $config{$1} = $2 }
137-
}
138-
close($PARROT);
139-
}
140-
last if %config;
141-
}
142-
unlink('parrot-config.pir');
143-
$config{'parrot::ops2c'} = 'ops2c' unless exists $config{'parrot::ops2c'};
144-
return %config;
145-
}
146-
147-
14888
sub fill_template_file {
14989
my $infile = shift;
15090
my $outfile = shift;
@@ -182,8 +122,8 @@ sub fill_template_text {
182122
$str;
183123
};
184124

185-
$text =~ s/@@([:\w]+)@@/$escape->($config{$1} || $config{"parrot::$1"} || '')/ge;
186-
$text =~ s/@([:\w]+)@/$config{$1} || $config{"parrot::$1"} || ''/ge;
125+
$text =~ s/@@([:\w]+)@@/$escape->($config{$1} || '')/ge;
126+
$text =~ s/@([:\w]+)@/$config{$1} || ''/ge;
187127
if ($text =~ /nqp::makefile/) {
188128
if ($^O eq 'MSWin32') {
189129
$text =~ s{/}{\\}g;
@@ -272,7 +212,6 @@ sub gen_nqp {
272212

273213
my $backends = $options{'backends'};
274214
my $gen_nqp = $options{'gen-nqp'};
275-
my $gen_parrot = $options{'gen-parrot'};
276215
my $prefix = $options{'prefix'} || cwd().'/install';
277216
my $startdir = cwd();
278217
my $git_protocol = $options{'git-protocol'} || 'https';
@@ -281,26 +220,6 @@ sub gen_nqp {
281220

282221
my (%impls, %need);
283222

284-
if ($backends =~ /parrot/) {
285-
my %c = read_parrot_config("$prefix/bin/parrot");
286-
287-
if (%c) {
288-
my $bin = fill_template_text('@bindir@/nqp-p@ext@', %c);
289-
$impls{parrot}{bin} = $bin;
290-
%c = read_config($bin);
291-
my $nqp_have = $c{'nqp::version'};
292-
my $nqp_ok = $nqp_have && cmp_rev($nqp_have, $nqp_want) >= 0;
293-
if ($nqp_ok) {
294-
$impls{parrot}{config} = \%c;
295-
}
296-
else {
297-
$need{parrot} = 1;
298-
}
299-
}
300-
else {
301-
$need{parrot} = 1;
302-
}
303-
}
304223
for my $b (qw/jvm moar/) {
305224
if ($backends =~ /$b/) {
306225
my $postfix = substr $b, 0, 1;
@@ -320,7 +239,7 @@ sub gen_nqp {
320239

321240
return %impls unless %need;
322241

323-
if (defined $gen_nqp || defined $gen_parrot) {
242+
if (defined $gen_nqp) {
324243
git_checkout(
325244
github_url($git_protocol, 'perl6', 'nqp'),
326245
'nqp', $nqp_want,
@@ -330,15 +249,7 @@ sub gen_nqp {
330249
);
331250
}
332251

333-
if ($need{parrot} && defined $gen_parrot) {
334-
my ($par_want) = split(' ', slurp($PARROT_REVISION));
335-
my $parrot = gen_parrot($par_want, %options, prefix => $prefix);
336-
my %c = read_parrot_config($parrot);
337-
$impls{parrot}{bin} = fill_template_text('@bindir@/nqp-p@ext@', %c);
338-
$impls{parrot}{config} = \%c;
339-
}
340-
341-
return %impls unless defined($gen_nqp) || defined($gen_parrot);
252+
return %impls unless defined($gen_nqp);
342253

343254
my $backends_to_build = join ',', sort keys %need;
344255
my @cmd = ($^X, 'Configure.pl', "--prefix=$prefix",
@@ -357,81 +268,6 @@ sub gen_nqp {
357268
return %impls;
358269
}
359270

360-
361-
sub gen_parrot {
362-
my $par_want = shift;
363-
my %options = @_;
364-
365-
my $prefix = $options{'prefix'} || cwd()."/install";
366-
my $gen_parrot = $options{'gen-parrot'};
367-
my @opts = @{ $options{'parrot-option'} || [] };
368-
push @opts, "--optimize";
369-
my $startdir = cwd();
370-
my $git_protocol = $options{'git-protocol'} || 'https';
371-
372-
my $par_exe = "$options{'prefix'}/bin/parrot$exe";
373-
my %config = read_parrot_config($par_exe);
374-
375-
my $par_have = $config{'parrot::git_describe'} || '';
376-
my $par_ok = $par_have && cmp_rev($par_have, $par_want) >= 0;
377-
if ($gen_parrot) {
378-
my $par_repo = git_checkout(
379-
github_url($git_protocol, 'parrot', 'parrot'),
380-
'parrot', $gen_parrot,
381-
github_url('ssh', 'parrot', 'parrot'),
382-
$options{'git-depth'} ? "--depth=$options{'git-depth'}" : '',
383-
$options{'git-reference'} ? "--reference=$options{'git-reference'}/parrot" : '',
384-
);
385-
$par_ok = $par_have eq $par_repo;
386-
}
387-
elsif (!$par_ok) {
388-
git_checkout(
389-
github_url($git_protocol, 'parrot', 'parrot'),
390-
'parrot', $par_want,
391-
github_url('ssh', 'parrot', 'parrot'),
392-
$options{'git-depth'} ? "--depth=$options{'git-depth'}" : '',
393-
$options{'git-reference'} ? "--reference=$options{'git-reference'}/parrot" : '',
394-
);
395-
}
396-
397-
if ($par_ok) {
398-
print "$par_exe is Parrot $par_have.\n";
399-
return $par_exe;
400-
}
401-
chdir("$startdir/parrot") or die $!;
402-
if (-f 'Makefile') {
403-
%config = read_parrot_config('config_lib.pir');
404-
my $make = $config{'parrot::make'};
405-
if ($make) {
406-
print "\nPerforming '$make realclean' ...\n";
407-
system_or_die($make, 'realclean');
408-
}
409-
}
410-
411-
$prefix =~ s{\\}{/}g;
412-
413-
print "\nConfiguring Parrot ...\n";
414-
my @cmd = ($^X, "Configure.pl", @opts, "--prefix=$prefix");
415-
print "@cmd\n";
416-
system_or_die(@cmd);
417-
418-
print "\nBuilding Parrot ...\n";
419-
%config = read_parrot_config('config_lib.pir');
420-
my $make = $config{'parrot::make'} or
421-
die "Unable to determine value for 'make' from parrot config\n";
422-
system_or_die($make, 'install-dev');
423-
chdir($startdir);
424-
425-
# That is a hack to get the import-lib in place. Parrot seems unpatchable because
426-
# its static build shares the same libname as the import-lib.
427-
if (-e "$startdir/parrot/libparrot.lib" && !-e "$startdir/install/bin/libparrot.lib") {
428-
copy("$startdir/parrot/libparrot.lib", "$startdir/install/bin/libparrot.lib");
429-
}
430-
431-
print "Parrot installed.\n";
432-
return fill_template_text('@bindir@/parrot@exe@', %config);
433-
}
434-
435271
sub gen_moar {
436272
my $moar_want = shift;
437273
my %options = @_;

0 commit comments

Comments
 (0)