Closed Bug 474014 Opened 16 years ago Closed 6 years ago

Run-time compiler, read-eval-print loop, 'eval'

Categories

(Tamarin Graveyard :: Virtual Machine, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
Future

People

(Reporter: lhansen, Unassigned)

References

Details

(Whiteboard: Tracking)

Attachments

(8 files)

Bug to track ongoing work on a run-time compiler for ActionScript and its interactive and programmatic interfaces.

(All development work is happening on
http://hg.mozilla.org/users/lhansen_adobe.com/redux-mephitis-macroura; patches in this bug are candidates for tamarin-redux.)
Depends on: 474021
Depends on: 474024
Depends on: 471361
Depends on: 479631
Depends on: 479633
This patch adds one option to runtestBase.py, --eval (aka -e).  If started with this switch the test harness loads the test from .as source, it does not run it through ASC to produce .abc files.  However, it is different from the existing runSource mechanism, which resolves 'include' directives -- that's not necessary or desirable here, as 'eval' manages to do that itself.  With --eval, the test harness computes the list of shell files and the test case file, and those are all the arguments.

Incidentally this patch also fixes a bug for runSource: the top-level shell.as file was not included in the list of computed files.  Apparently runSource had not been tested -- do we need to maintain it?
Attachment #363504 - Flags: review?(dschaffe)
Attached patch eval core codeSplinter Review
The AS3 run-time compiler.

This is not complete but handles almost all of the ecma3/ and e4x/ test suites in the test/acceptance/ suite, and some simple AS3 constructs in addition.  It's pretty good about signalling when it's presented with something valid but unimplemented, but probably not consistent.
Attachment #363506 - Flags: review?(edwsmith)
This ultra-simple harness allows the run-time compiler to be used as an ahead-of-time compiler.  Besides being cool and demonstrating that the eval code is pretty independent of avmplus, it simplifies debugging - the ABC code can be saved and examined off-line.

Project files for Xcode only in this patch.
Attachment #363508 - Flags: review?
Attachment #363508 - Flags: review? → review?(edwsmith)
Attachment #363509 - Flags: review?(edwsmith)
Attachment #363510 - Flags: review?(edwsmith)
Modest changes to the shell code to do the following:

 - make the shell load a file as source if it can't be loaded as .abc
 - implement a read-eval-print loop (start the shell with "-repl")
 - support for processing the 'include' directive in AS3 code

This code is a little raw still but it is good enough for casual work, including acceptance testing and interactive and noninteractive scripting, if you don't go bananas with your character encodings.
Attachment #363512 - Flags: review?(edwsmith)
Missing pieces of core code for eval, very modest.  Note a couple of things:

- AVMPLUS_FEATURE_EVAL is enabled in avmbuild.h; before I land this patch I
  will likely remove it and move it into the project files, so that only shell
  builds compile with eval support (for now :-)

- You have to rebuild the builtins in order to get access to the eval function,
  because this patch does not include the builtins ABC or C++ code.  I'm
  not sure if 'eval' is even the interface we want, for AS3, but as an
  experiment it's here.

- The icky hack in ActionBlockConstants.cpp is there to support avmc, 
  and it works OK and isn't in the way, but a more principled approach
  might be better.
Attachment #363515 - Flags: review?(edwsmith)
As a general comment on eval, there are some notes in eval/eval.h about coding style, assumptions, and so on, which have worked OK for me so far but which can be challenged (for example the eval code does not yet use the VMPI_ library, having been written for sane platforms only - this can be fixed but it didn't seem urgent).
(memo to self)

Patches yet to be posted:
- windows project files

To be done before finally landing:
- windows testing
- linux testing

Pieces that would be really nice to have but which I may omit for now, citing time pressure:
- the ".load" command in the repl

Bugs to be logged after landing:
- sundry acceptance test failures that are bugs either in the libraries
  (number parsing) or in the test cases
- instruction set bugs, see eval/documentation.txt
Attachment #363506 - Flags: review?(edwsmith) → review+
Attachment #363508 - Flags: review?(edwsmith) → review+
Attachment #363509 - Flags: review?(edwsmith) → review+
Attachment #363510 - Flags: review?(edwsmith) → review+
Comment on attachment 363506 [details] [diff] [review]
eval core code

eval-parse.h spews many warnings about unused parameters.  we can live with them but life is better when there's less build noise.
(In reply to comment #12)
> (From update of attachment 363506 [details] [diff] [review])
> eval-parse.h spews many warnings about unused parameters.  we can live with
> them but life is better when there's less build noise.

Ah, you have different settings.  This is a compiler settings bug IMO (complaining about unused parameters discourages abstraction and code sharing and serves no useful purpose unless all your functions are non-virtual), but I can fix it in the source.  Will look into this before landing.
i'd be just as happy with a compiler setting fix too.  this is with the configure.py build.
Blocks: 479782
Comment on attachment 363512 [details] [diff] [review]
shell tie-ins for eval

minor suggestion:  factor out duplicated code in AbcParser::decodeAbc() by calling canParse(), and remove ifdef VMCFG_EVAL around canParse().
Attachment #363512 - Flags: review?(edwsmith) → review+
Attachment #363515 - Flags: review?(edwsmith) → review+
Attachment #363504 - Flags: review?(dschaffe) → review+
Comment on attachment 363504 [details] [diff] [review]
patch implementing a --eval switch to runtestBase.py

confirmed standard usage works correctly (not --eval mode).
First eight patches (through "core tie-ins for eval") landed as changeset:   1502:1abdb2df5b16.  Note, eval is disabled by default, turn on in avmbuild.h if you want to build it.

Keeping bug open as there will be more stuff coming, eventually.
it would be cool if "avm" with no args started the REPL, like other engines. i'll tinker and offer a patch in my spare time, if you don't beat me to it and don't recoil at the idea :-)
(In reply to comment #18)
> it would be cool if "avm" with no args started the REPL, like other engines.

speaking of which, do we have a bug open to unify the name to "avm" everywhere?
(In reply to comment #18)
> it would be cool if "avm" with no args started the REPL, like other engines.
> i'll tinker and offer a patch in my spare time, if you don't beat me to it and
> don't recoil at the idea :-)

No objection, makes sense.  Make sure -h and --help both give us the old listing of available options.

(In reply to comment #19)
> speaking of which, do we have a bug open to unify the name to
> "avm" everywhere?

https://bugzilla.mozilla.org/show_bug.cgi?id=478714
Assignee: lhansen → nobody
Status: ASSIGNED → NEW
Target Milestone: --- → Future
Assignee: nobody → lhansen
Whiteboard: Tracker
Whiteboard: Tracker → Tracking
Status: NEW → ASSIGNED
Depends on: 602046
Depends on: 668243
Flags: flashplayer-qrb+
Assignee: lhansen → nobody
No assignee, updating the status.
Status: ASSIGNED → NEW
No assignee, updating the status.
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: