Skip to content

Commit

Permalink
Add 'nashorn/' from commit '58ddd6f905e1a9949d3c0feb0d85754fadd1bf16'
Browse files Browse the repository at this point in the history
git-subtree-dir: nashorn
git-subtree-mainline: 256a906
git-subtree-split: 58ddd6f
  • Loading branch information
joeylee1997 committed Mar 16, 2022
2 parents 256a906 + 58ddd6f commit 2e06f02
Show file tree
Hide file tree
Showing 2,775 changed files with 393,745 additions and 0 deletions.
27 changes: 27 additions & 0 deletions nashorn/.hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax: glob

^.hgtip
build/*
dist/*
/nbproject/private/
private.xml
private.properties
webrev/*
webrev.zip
.classpath
*.class
*.clazz
*.log
*.orig
genfiles.properties
hotspot.log
.DS_Store*
TEST-*.xml
TESTS-*.xml
report.xml
CC/*
jcov2/*
.idea/*
test/lib/*.jar
test/script/external/*
.project
1,149 changes: 1,149 additions & 0 deletions nashorn/.hgtags

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions nashorn/.jcheck/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project=jdk8
bugids=dup
27 changes: 27 additions & 0 deletions nashorn/ASSEMBLY_EXCEPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

OPENJDK ASSEMBLY EXCEPTION

The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
only ("GPL2"), with the following clarification and special exception.

Linking this OpenJDK Code statically or dynamically with other code
is making a combined work based on this library. Thus, the terms
and conditions of GPL2 cover the whole combination.

As a special exception, Oracle gives you permission to link this
OpenJDK Code with certain code licensed by Oracle as indicated at
http://openjdk.java.net/legal/exception-modules-2007-05-08.html
("Designated Exception Modules") to produce an executable,
regardless of the license terms of the Designated Exception Modules,
and to copy and distribute the resulting executable under GPL2,
provided that the Designated Exception Modules continue to be
governed by the licenses under which they were offered by Oracle.

As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
to build an executable that includes those portions of necessary code that
Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
with the Classpath exception). If you modify or add to the OpenJDK code,
that new GPL2 code may still be combined with Designated Exception Modules
if the new code is made subject to this exception by its copyright holder.
347 changes: 347 additions & 0 deletions nashorn/LICENSE

Large diffs are not rendered by default.

149 changes: 149 additions & 0 deletions nashorn/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
- What is Nashorn?

Nashorn is a runtime environment for programs written in ECMAScript 5.1
that runs on top of JVM.

- How to find out more about ECMAScript 5.1?

The specification can be found at

http://www.ecma-international.org/publications/standards/Ecma-262.htm

- How to checkout sources of Nashorn project?

Nashorn project uses Mercurial source code control system. You can
download Mercurial from http://mercurial.selenic.com/wiki/Download

Information about the forest extension can be found at

http://mercurial.selenic.com/wiki/ForestExtension

and downlaoded using

hg clone https://bitbucket.org/gxti/hgforest

You can clone Nashorn Mercurial forest using this command:

hg fclone http://hg.openjdk.java.net/nashorn/jdk8 nashorn~jdk8

To update your copy of the forest (fwith the latest code:

(cd nashorn~jdk8 ; hg fpull)

Or just the nashorn subdirectory with

(cd nashorn~jdk8/nashorn ; hg pull -u)

To learn about Mercurial in detail, please visit http://hgbook.red-bean.com.

- How to build?

To build Nashorn, you need to install JDK 8. You may use the Nashorn
forest build (recommended) or down load from java.net. You will need to
set JAVA_HOME environmental variable to point to your JDK installation
directory.

cd nashorn~jdk8/nashorn/make
ant clean; ant

- How to run?

Use the jjs script (see RELESE_README):

cd nashorn~jdk8/nashorn
sh bin/jjs <your .js file>

Nashorn supports javax.script API. It is possible to drop nashorn.jar in
class path and request for "nashorn" script engine from
javax.script.ScriptEngineManager.

Look for samples under the directory test/src/jdk/nashorn/api/scripting/.

- Documentation

Comprehensive development documentation is found in the Nashorn JavaDoc. You can
build it using:

cd nashorn~jdk8/nashorn/make
ant javadoc

after which you can view the generated documentation at dist/javadoc/index.html.

- Running tests

Nashorn tests are TestNG based. Running tests requires downloading the
TestNG library and placing its jar file into the test/lib subdirectory. This is
done automatically when executing the "ant externals" command to get external
test suites (see below).

Once TestNG is properly installed, you can run the tests using:
cd make
ant clean test

You can also run the ECMA-262 test suite with Nashorn. In order to do
that, you will need to get a copy of it and put it in
test/script/external/test262 directory. A convenient way to do it is:

git clone https://github.com/tc39/test262 test/script/external/test262

Alternatively, you can check it out elsewhere and make
test/script/external/test262 a symbolic link to that directory. After
you've done this, you can run the ECMA-262 tests using:

cd nashorn~jdk8/nashorn/make
ant test262

Ant target to get/update external test suites:

ant externals
ant update-externals

These tests take time, so we have a parallelized runner for them that
takes advantage of all processor cores on the computer:

cd nashorn~jdk8/nashorn/make
ant test262parallel

- How to write your own test?

Nashorn uses it's own simple test framework. Any .js file dropped under
nashorn/test directory is considered as a test. A test file can
optionally have .js.EXPECTED (foo.js.EXPECTED for foo.js) associated
with it. The .EXPECTED file, if exists, should contain the output
expected from compiling and/or running the test file.

The test runner crawls these directories for .js files and looks for
JTReg-style @foo comments to identify tests.

* @test - A test is tagged with @test.

* @test/fail - Tests that are supposed to fail (compiling, see @run/fail
for runtime) are tagged with @test/fail.

* @test/compile-error - Test expects compilation to fail, compares
output.

* @test/warning - Test expects compiler warnings, compares output.

* @test/nocompare - Test expects to compile [and/or run?]
successfully(may be warnings), does not compare output.

* @subtest - denotes necessary file for a main test file; itself is not
a test.

* @run - A test that should be run is also tagged with @run (otherwise
the test runner only compiles the test).

* @run/fail - A test that should compile but fail with a runtime error.

* @run/ignore-std-error - script may produce output on stderr, ignore
this output.

* @argument - pass an argument to script.

* @option \ - pass option to engine, sample.

/**
* @option --dump-ir-graph
* @test
*/
20 changes: 20 additions & 0 deletions nashorn/RELEASE_README
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The Nashorn repo is in the process of being migrated to OpenJDK and as such is
incomplete in several areas.

- The build system is not fully integrated. When complete, Nashorn will be
installed in its proper location in the JRE.

- Once integrated, the correct version of the JDK will be wrapped around
Nashorn. In the meantime, ensure you use JDK8 b68 or later.

- The jjs tool has not been implemented in binary form yet. Use "sh bin/jjs"
(or bin/jjs.bat on windows) in the interm.

- The Dynalink component is not fully integrated into Nashorn as yet, but will
be when details are finalized.

- And, finally Nashorn is still in development. To stay up to date, subscribe
to nashorn-dev@openjdk.java.net at

http://mail.openjdk.java.net/mailman/listinfo/nashorn-dev.

Loading

0 comments on commit 2e06f02

Please sign in to comment.