Author: tewk
Date: Wed May 30 21:34:40 2007
New Revision: 18700
Modified:
branches/pmc2c/MANIFEST
branches/pmc2c/MANIFEST.SKIP
branches/pmc2c/lib/Parrot/Pmc2c/MethodEmitter.pm
branches/pmc2c/lib/Parrot/Pmc2c/PCCMETHOD.pm
branches/pmc2c/lib/Parrot/Pmc2c/PMC.pm
branches/pmc2c/lib/Parrot/Pmc2c/PMC/RO.pm
branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter.pm
branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter/default.pm
branches/pmc2c/lib/Parrot/Pmc2c/Parser.pm
Log:
[Pmc2c Branch] Checkpoint
Modified: branches/pmc2c/MANIFEST
==============================================================================
--- branches/pmc2c/MANIFEST (original)
+++ branches/pmc2c/MANIFEST Wed May 30 21:34:40 2007
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Wed May 23 08:18:31 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed May 30 22:23:36 2007 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -1411,6 +1411,7 @@
languages/lisp/lisp/pred.l [lisp]
languages/lisp/read.pir [lisp]
languages/lisp/system.pir [lisp]
+languages/lisp/t/atoms.t [lisp]
languages/lisp/t/harness [lisp]
languages/lisp/t/hello.t [lisp]
languages/lisp/types.pir [lisp]
@@ -2294,22 +2295,28 @@
lib/Parrot/Ops2pm/Utils.pm [devel]
lib/Parrot/OpsFile.pm [devel]
lib/Parrot/PIR/Formatter.pm [devel]
-lib/Parrot/Pmc2c.pm [devel]
+lib/Parrot/Pmc2c/CodeFragment.pm [devel]
+lib/Parrot/Pmc2c/Dumper.pm [devel]
+lib/Parrot/Pmc2c/Emitter.pm [devel]
lib/Parrot/Pmc2c/Library.pm [devel]
-lib/Parrot/Pmc2c/Null.pm [devel]
+lib/Parrot/Pmc2c/Method.pm [devel]
+lib/Parrot/Pmc2c/MethodEmitter.pm [devel]
lib/Parrot/Pmc2c/PCCMETHOD.pm [devel]
+lib/Parrot/Pmc2c/PMC.pm [devel]
+lib/Parrot/Pmc2c/PMC/RO.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/Null.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/Ref.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/SharedRef.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/Standard.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/StmRef.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/default.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/deleg_pmc.pm [devel]
+lib/Parrot/Pmc2c/PMCEmitter/delegate.pm [devel]
lib/Parrot/Pmc2c/Parser.pm [devel]
lib/Parrot/Pmc2c/Pmc2cMain.pm [devel]
-lib/Parrot/Pmc2c/Ref.pm [devel]
-lib/Parrot/Pmc2c/SharedRef.pm [devel]
-lib/Parrot/Pmc2c/Standard.pm [devel]
-lib/Parrot/Pmc2c/StandardConst.pm [devel]
-lib/Parrot/Pmc2c/StandardRO.pm [devel]
-lib/Parrot/Pmc2c/StmRef.pm [devel]
lib/Parrot/Pmc2c/UtilFunctions.pm [devel]
-lib/Parrot/Pmc2c/default.pm [devel]
-lib/Parrot/Pmc2c/deleg_pmc.pm [devel]
-lib/Parrot/Pmc2c/delegate.pm [devel]
+lib/Parrot/Pmc2c/VTable.pm [devel]
lib/Parrot/Revision.pm [devel]
lib/Parrot/Test.pm [devel]
lib/Parrot/Test/APL.pm [devel]
Modified: branches/pmc2c/MANIFEST.SKIP
==============================================================================
--- branches/pmc2c/MANIFEST.SKIP (original)
+++ branches/pmc2c/MANIFEST.SKIP Wed May 30 21:34:40 2007
@@ -1,6 +1,6 @@
# ex: set ro:
# $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Sat May 12 14:07:21 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed May 30 22:23:36 2007 UT
#
# This file should contain a transcript of the svn:ignore properties
# of the directories in the Parrot subversion repository. (Needed for
@@ -849,12 +849,14 @@
# generated from svn:ignore of 'languages/lua/src/'
^languages/lua/src/.*\.pbc$
^languages/lua/src/.*\.pbc/
-^languages/lua/src/ASTGrammar\.pir$
-^languages/lua/src/ASTGrammar\.pir/
+^languages/lua/src/PASTGrammar_gen\.pir$
+^languages/lua/src/PASTGrammar_gen\.pir/
+^languages/lua/src/POSTGrammar_gen\.pir$
+^languages/lua/src/POSTGrammar_gen\.pir/
^languages/lua/src/dumplex_gen\.pir$
^languages/lua/src/dumplex_gen\.pir/
-^languages/lua/src/lua51_grammar_gen\.pir$
-^languages/lua/src/lua51_grammar_gen\.pir/
+^languages/lua/src/lua51_gen\.pir$
+^languages/lua/src/lua51_gen\.pir/
^languages/lua/src/lua51_testlex_gen\.pir$
^languages/lua/src/lua51_testlex_gen\.pir/
# generated from svn:ignore of 'languages/lua/t/'
@@ -1013,6 +1015,9 @@
^languages/perl6/src/pmc/.*\.pdb/
^languages/perl6/src/pmc/.*\.so$
^languages/perl6/src/pmc/.*\.so/
+# generated from svn:ignore of 'languages/perl6/t/'
+^languages/perl6/t/spec$
+^languages/perl6/t/spec/
# generated from svn:ignore of 'languages/pheme/lib/'
^languages/pheme/lib/.*\.pbc$
^languages/pheme/lib/.*\.pbc/
Modified: branches/pmc2c/lib/Parrot/Pmc2c/MethodEmitter.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/MethodEmitter.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/MethodEmitter.pm Wed May 30 21:34:40 2007
@@ -58,7 +58,7 @@
$emit->($self->decl( $pmc, 'CFILE' ));
$emit->("{\n");
$emit->($body);
- $emit->("}\n\n");
+ $emit->("}\n");
for my $mmd ( @{ $self->mmds } ) {
$mmd->generate_body($pmc);
Modified: branches/pmc2c/lib/Parrot/Pmc2c/PCCMETHOD.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/PCCMETHOD.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/PCCMETHOD.pm Wed May 30 21:34:40 2007
@@ -250,7 +250,6 @@
string_from_const_cstring(interp, $returns_flags, 0), 0);
$goto_string
/*END PCCRETURN $returns */
-}
END
$matched->replace($match, $e);
}
@@ -425,20 +424,16 @@
END
$e_post->emit(<<"END", __FILE__, __LINE__ + 1);
- /* if (PMC_cont(ccont)->address) { */
- {
- /* parrot_context_t * const caller_ctx = PMC_cont(ccont)->to_ctx; */
- if (! caller_ctx) {
- /* there is no point calling real_exception here, because
- PDB_backtrace can't deal with a missing to_ctx either. */
- internal_exception(1, "No caller_ctx for continuation \%p.",
ccont);
- }
-
- interp->returns_signature = return_sig;
- parrot_pass_args(interp, ctx, caller_ctx, return_indexes,
- caller_ctx->current_results, PARROT_PASS_RESULTS);
+ if (! caller_ctx) {
+ /* there is no point calling real_exception here, because
+ PDB_backtrace can't deal with a missing to_ctx either. */
+ internal_exception(1, "No caller_ctx for continuation \%p.", ccont);
}
+ interp->returns_signature = return_sig;
+ parrot_pass_args(interp, ctx, caller_ctx, return_indexes,
+ caller_ctx->current_results, PARROT_PASS_RESULTS);
+
/* END PARAMS SCOPE */
}
no_return:
@@ -454,6 +449,7 @@
$e_body->emit($self->body);
$e_body->emit($e_post);
$self->body($e_body);
+ $self->{PCCMETHOD} = 1;
return 1;
}
Modified: branches/pmc2c/lib/Parrot/Pmc2c/PMC.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/PMC.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/PMC.pm Wed May 30 21:34:40 2007
@@ -122,6 +122,13 @@
return get_method($self, $vt_meth)->is_vtable;
}
+sub unimplemented_vtable {
+ my ( $self, $vt_meth ) = @_;
+ return 0 if $vt_meth eq 'class_init';
+ return 0 if $self->has_method($vt_meth);
+ return 1;
+}
+
sub normal_unimplemented_vtable {
my ( $self, $vt_meth ) = @_;
return 0 if $vt_meth eq 'class_init';
Modified: branches/pmc2c/lib/Parrot/Pmc2c/PMC/RO.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/PMC/RO.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/PMC/RO.pm Wed May 30 21:34:40 2007
@@ -71,7 +71,25 @@
# (e.g. some ro_fail pseudoclass that generates an exception)
foreach my $vt_method ( @{ $self->vtable->methods } ) {
my $vt_method_name = $vt_method->name;
- if ( $parent->vtable_method_does_write($vt_method_name) ) {
+ if ( $vt_method_name eq 'find_method' ) {
+ my $ro_method = Parrot::Pmc2c::Method->new({
+ name => $vt_method_name,
+ return_type => $vt_method->return_type,
+ parameters => $vt_method->parameters,
+ type => Parrot::Pmc2c::Method::VTABLE,
+ });
+ my $real_findmethod = 'Parrot_' . $self->{super}{find_method} .
'_find_method';
+ my $body = <<"EOC";
+ PMC *const method = $real_findmethod(interp, pmc, method_name);
+ if (!PMC_IS_NULL(VTABLE_getprop(interp, method, const_string(interp,
"write"))))
+ return PMCNULL;
+ else
+ return method;
+EOC
+ $ro_method->body(Parrot::Pmc2c::Emitter->text($body));
+ $self->add_method($ro_method);
+ }
+ elsif ( $parent->vtable_method_does_write($vt_method_name) ) {
my $ro_method = Parrot::Pmc2c::Method->new({
name => $vt_method_name,
return_type => $vt_method->return_type,
@@ -81,8 +99,8 @@
my $pmcname = $parent->name;
my $ret = gen_ret($ro_method);
my $body = <<EOC;
-
- internal_exception(WRITE_TO_CONSTCLASS, "$vt_method_name() in read-only
instance of $pmcname");
+ internal_exception(WRITE_TO_CONSTCLASS,
+ "$vt_method_name() in read-only instance of $pmcname");
EOC
$body .= " $ret\n" if $ret;
$ro_method->body(Parrot::Pmc2c::Emitter->text($body));
Modified: branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter.pm Wed May 30 21:34:40 2007
@@ -595,7 +595,7 @@
my $proto = proto( $method->return_type, $method->parameters );
my $method_name = $method->name;
my $symbol_name = defined $method->symbol ? $method->symbol :
$method->name;
- if ( exists $method->{pre_block} ) {
+ if ( exists $method->{PCCMETHOD} ) {
$cout .= <<"EOC";
register_raw_nci_method_in_ns(interp, entry,
F2DPTR(Parrot_${classname}_${method_name}), "$symbol_name");
Modified: branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter/default.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter/default.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/PMCEmitter/default.pm Wed May 30
21:34:40 2007
@@ -24,13 +24,14 @@
# vtable methods
foreach my $method ( @{ $self->vtable->methods } ) {
my $vt_method_name = $method->name;
- next unless $self->normal_unimplemented_vtable($vt_method_name);
+ next unless $self->unimplemented_vtable($vt_method_name);
my $new_default_method = $method->clone();
my $ret = "";
$ret = gen_ret($method);
$new_default_method->body(Parrot::Pmc2c::Emitter->text(<<"EOC"));
- cant_do_method(interp, pmc, "$vt_method_name");$ret
+ cant_do_method(interp, pmc, "$vt_method_name");
+ $ret
EOC
$new_default_method->type(Parrot::Pmc2c::Method::VTABLE);
$self->add_method($new_default_method);
Modified: branches/pmc2c/lib/Parrot/Pmc2c/Parser.pm
==============================================================================
--- branches/pmc2c/lib/Parrot/Pmc2c/Parser.pm (original)
+++ branches/pmc2c/lib/Parrot/Pmc2c/Parser.pm Wed May 30 21:34:40 2007
@@ -151,12 +151,13 @@
$lineno += count_newlines($1);
my $right_type = $2;
$method->add_mmd_rights($right_type);
- my $mmd_part = extract_bracketed_body_text( $body_text, '{' );
+ my $mmd_part = extract_bracketed_body_text( \$body_text, '{' );
die "Empty MMD body near '$body_text'" if ( !$mmd_part );
my $mmd_part_lines = count_newlines($mmd_part);
#$mmd_part =~ s/(\n\s*)$//s;
if ( $right_type eq 'DEFAULT' ) {
$default_body = $mmd_part;
+ print "$right_type $default_body \n";
$default_body_lineno = $lineno;
}
else {
@@ -188,7 +189,7 @@
sub extract_bracketed_body_text {
my ( $body_text, $bracketed ) = @_;
- return strip_outer_brackets( extract_bracketed( $body_text, $bracketed ) );
+ return strip_outer_brackets( extract_bracketed( $$body_text, $bracketed )
);
}