Commit Graph

110 Commits

Author SHA1 Message Date
Johann Muszynski
a32f54126b Add Visual Studio 2017 solution 2017-03-28 22:05:58 +03:00
Bob Nystrom
02bcefcbe4 Add test for user data.
Also moved the VM parameter in the error callback to be first like it
is in other callbacks.
2017-03-22 07:26:19 -07:00
Bob Nystrom
0cc00c41c0 Simplify test runner output a little. 2017-01-12 21:38:06 -08:00
Bob Nystrom
e8dfb1bf10 Don't test bitwise operations on operands that don't fit in u32.
The current behavior is undefined in C when converting the double to a
u32, so the tests fail on some compilers. For now, I'm just removing
those parts of the tests because I'm not sure what I want the behavior
to be. Modulo? Truncate? Runtime error?
2017-01-12 21:32:50 -08:00
Will Speak
04a7c9b5c8 Improve Travis Build & Test Coverage
Build Wren for more targets, and run the test suite on both 32 and 64
bit builds.

 * Update the build config to test both with and without NAN_TAGGING
   defined.

 * Updatest `util/test.py` to take the executable suffix as a
   parameter. This allows the makefile to control which binaries will be
   tested.

   Adds a new target to the makefile to be run by travis, this runs the
   test suite against all of the configurations it builds.

 * Gcc on some 32 bit platforms was complaining about numeric overflows
   when -INFINITY was used. Update the logic for converting a double to
   a string to not explicitly check against the literal values.

 * Make CI builds run the tests on both 64 _and_ 32 bit builds.

 * If I limit the number of CPUs on my MBP I can get some of the tests
   to time out, I'm imagining that the specs of the Travis Macs means
   that the same is happening there too. Updated the test script to
   allow an extra few seconds for the test to complete successfully
   before killing it.

 * Due to slight differences in accuracy in some computations tests were
   failing on 32 bit builds. Stop comparing things quite as exactly in
   the cases where it is causing issues.

   For some reason 12.34 was refusing to compare equal to itself. Bad
   show 12.34 :-/. I've also updated the test so it doesn't leak handles
   even if the assertions fail.

 * Double-cast from `double` to `uint32_t` to prevent undefined
   behaviour on overflow of basic integers. This should hopefully
   prevent 32 bit test failures on Linux.

 * Move to a version of LibUV with a fix for the 32 bit build error on
   Travis.
2016-12-29 17:52:38 +00:00
Bob Nystrom
b9f53f71fb Reset API stack a fiber is aborted from wrenCall(). 2016-11-01 08:40:16 -07:00
Bob Nystrom
e7cabbb5e4 Reset the API stack after a foreign constructor returns. 2016-08-28 08:23:27 -07:00
Baptiste Fontaine
b41a0f7c07 Allow builds to be verbose
It’s impossible to disable @s in Makefiles to get a verbose build.
Adding them conditionally using a variable lets users choose if they
want a verbose build by using the VERBOSE variable.

Normal build:

    make

Verbose build:

    make VERBOSE=1
2016-07-02 11:21:47 +02:00
Bob Nystrom
689cd42269 Start writing the REPL in Wren.
It doesn't actually execute code yet, but it:

- Supports left and right arrow keys for moving the cursor.
- Ctrl-C, Ctrl-D, Ctrl-A, and Ctrl-E for navigating.
- Syntax highlights the line (!).

The next step is to do a rough parse so that we can tell if the line
is an expression, statement, or needs more input. That will tell us
whether we need to interpret it at the top level (statement) and not
worry about a result, evaluate it as an expression and print the result,
or read more lines.
2016-06-09 19:16:41 -07:00
Bob Nystrom
59e9eb127e Add wrenAbortFiber().
Thanks, @underscorediscovery!
2016-06-09 19:14:21 -07:00
Bob Nystrom
06731f66d4 Add a Platform class.
- Rename the "process" module to "os".
- Add Platform to it.
- Static "name" method.
- Static "isPosix" method.
- Docs and tests!
2016-05-21 12:44:17 -07:00
Bob Nystrom
0a060a9678 WrenValue -> WrenHandle. 2016-05-20 20:55:28 -07:00
Bob Nystrom
678051c5e1 Tweak makefile formatting. 2016-03-16 07:22:18 -07:00
Yasuhiro Matsumoto
8c79501738 Fix windows build 2016-03-16 00:37:23 +09:00
Bob Nystrom
485e91ab05 Redo metrics script. 2016-03-07 07:56:44 -08:00
Bob Nystrom
84bcb5801c Add a test for creating a VM without a config. 2016-03-03 14:31:47 -08:00
Bob Nystrom
fa2598c601 Upgrade to libuv 1.8.0. 2016-02-27 09:19:56 -08:00
Bob Nystrom
bec5181bdb Add separate targets for building just the shared or static library.
make static
make shared

Running "make vm" will build both, as usual.

Fixes #322.
2016-02-19 07:22:10 -08:00
Bob Nystrom
5b7cd12e76 Don't run the skynet example from the tests.
It's too slow on the Travis bots and times out.
2016-02-14 22:28:14 -08:00
Bob Nystrom
b8e85c83a8 Fix test and add skynet example. 2016-02-14 22:21:50 -08:00
Bob Nystrom
71e2458a6c Add API for accessing command-line arguments.
- Add process module with Process class.
- Add "arguments" and "allArguments" methods.
- Docs for same.
- Support passing additional arguments to command line.
- Add "--help" support to command line.
2016-01-22 07:57:26 -08:00
Bob Nystrom
860220869a Oops. Completely disable lto. 2016-01-22 07:01:56 -08:00
Bob Nystrom
7e8bc2a89a Disable link-time-optimization for now.
It's failing when building with clang on Travis. The underlying problem
seems to be something broken with how LLVM is looking for the gold
linker, and working around that is outside of my skillset.

To learn more, Google: "LLVMgold.so: error loading plugin" lto
2016-01-22 06:42:01 -08:00
Bob Nystrom
39b29ee07a Enable link time optimization in the CLI.
One little compiler flag makes a surprisingly large difference:

api_call - wren            0.05s 0.0017 130.52% relative to baseline
api_foreign_method - wren  0.24s 0.0017 144.54% relative to baseline
binary_trees - wren        0.21s 0.0032 112.27% relative to baseline
binary_trees_gc - wren     0.75s 0.0288 115.02% relative to baseline
delta_blue - wren          0.13s 0.0031 103.24% relative to baseline
fib - wren                 0.20s 0.0036 120.56% relative to baseline
fibers - wren              0.04s 0.0007 108.52% relative to baseline
for - wren                 0.07s 0.0009 124.45% relative to baseline
method_call - wren         0.12s 0.0010  95.58% relative to baseline
map_numeric - wren         0.30s 0.0031 110.11% relative to baseline
map_string - wren          0.11s 0.0098 111.38% relative to baseline
string_equals - wren       0.19s 0.0064 115.49% relative to baseline
2016-01-20 07:47:00 -08:00
Bob Nystrom
9512ce74c3 Merge branch 'master' into api
# Conflicts:
#	src/module/io.c
2015-12-26 20:42:53 -08:00
Bob Nystrom
8ab329ff91 Make wren.mk log wren_to_c_string.
Thanks, Michel!
2015-12-26 20:11:48 -08:00
Bob Nystrom
8203baf7bd Initialize match in the test script.
Thanks, Michel!
2015-12-26 20:08:20 -08:00
Bob Nystrom
1d16e85a85 Add an API to load a top-level variable into a slot. 2015-12-26 10:53:14 -08:00
Bob Nystrom
15043b897f Add a benchmark for wrenCall(). 2015-12-23 17:29:53 -08:00
Bob Nystrom
6f37d379f4 Add C API functions for working with lists:
- wrenEnsureSlots()
  Lets you go the foreign slot stack to make room for a temporary work
  area.

- wrenSetSlotNewList()
  Creates a new empty list and stores it in a slot.

- wrenInsertInList()
  Takes a value from one slot and inserts it into the list in another.

Still need more functions like getting elements from a list, removing,
etc. but this at least lets you create, populate, and return lists from
foreign methods.
2015-12-16 16:28:26 -08:00
Bob Nystrom
7fcdcf2f1a wrenReturn___() -> wrenSlotSet___().
This turns those functions into general-purpose functions for writing
raw C values into slots on the foreign call stack.

Writing a return just means writing a value to slot 0.
2015-12-16 13:00:13 -08:00
Bob Nystrom
01e8f9053e Add a benchmark to test the Wren C API.
I've got some ideas on how to tweak the embedding API, but I want to
see what performance impact they have first, so this adds a little
benchmark that just calls a foreign method a ton of times.
2015-12-15 16:02:13 -08:00
Bob Nystrom
2df5362ab2 Handle compile errors in imported modules. 2015-12-08 07:49:37 -08:00
Bob Nystrom
10ece995f7 Add some Dart benchmarks running on fletch. 2015-12-05 11:09:30 -08:00
Bob Nystrom
a38753d1d6 Add an animals guessing game example. 2015-11-29 09:43:47 -08:00
Bob Nystrom
c46507d937 Fix .gitignore (and add incorrectly ignored file!) 2015-11-27 11:22:09 -08:00
Rohan Singh
2125471132 Addressing feedback
* Always include fcntl.h in io.c
* FileReqData -> FileRequestData
* Don't combine allocations
* Make output paths more consistent with the docs
2015-11-25 19:47:13 -05:00
Rohan Singh
2d3a7ece40 Remove reference to timer.h, add reference to wren.h 2015-11-25 12:43:49 -05:00
Rohan Singh
f09e75c6e8 Update Visual Studio projects so we can build again 2015-11-25 12:43:19 -05:00
Bob Nystrom
71575d9179 Switch to O3 for release builds.
It now seems to be fairly consistently faster on my machine:

binary_trees - wren     0.22s 0.0023 100.10% relative to baseline
binary_trees_gc - wren  0.85s 0.0160 112.63% relative to baseline
delta_blue - wren       0.12s 0.0044 102.91% relative to baseline
fib - wren              0.21s 0.0021 103.34% relative to baseline
fibers - wren           0.26s 0.0083 102.46% relative to baseline
for - wren              0.08s 0.0024 111.82% relative to baseline
method_call - wren      0.11s 0.0087  94.56% relative to baseline
map_numeric - wren      0.32s 0.0042 109.83% relative to baseline
map_string - wren       0.11s 0.0096 105.69% relative to baseline
string_equals - wren    0.19s 0.0028 110.00% relative to baseline
2015-11-10 07:33:15 -08:00
Bob Nystrom
82706b74fc Reorganize site to make room for documenting the other built-in modules. 2015-11-08 13:31:22 -08:00
Bob Nystrom
8c0dae1320 Move precedence table to syntax page. 2015-11-08 10:59:23 -08:00
Bob Nystrom
931d9ca4d3 Reorganize the language guide.
- Rename "Expressions" -> "Method Calls".
- Organize "Types" and "Language" into a single linear narrative.
- Mobile-specific navigation to handle the longer guide.
- Rename "Fibers" -> "Concurrency".
- Get rid of duplicate stuff about signatures in "Classes".
- Add next/prev links to each page in the guide.
- Move "Contributing" and "Community" up to the top level.
- Move the precendence table to a separate "Grammar" page.
- Lots of other little stuff.
2015-11-07 11:09:04 -08:00
Bob Nystrom
b365c07d7a Add a benchmark that explicitly invokes the GC. 2015-10-24 11:00:17 -07:00
Bob Nystrom
0f7d4dd4d0 Add a timeout to the test runner.
This ensures that when you run the tests while stress testing the GC,
that a pathological test won't hang forever.
2015-10-24 10:58:21 -07:00
Bob Nystrom
f145662158 "Auxiliary" -> "optional".
Fixes #309.
2015-10-24 09:23:25 -07:00
Bob Nystrom
545a4cbf7e Style example output and errors in the docs. 2015-10-18 15:56:52 -07:00
Bob Nystrom
30e7d9e508 Move core.wren to be next to wren_core.wren.inc. 2015-10-17 22:17:10 -07:00
Bob Nystrom
e5176607d9 Move meta and random to "aux" modules.
Wren now has three classes of modules:

- The one magic "core" module that's built in and always needed.
- Auxiliary libraries like "meta" and "random". These do not have any
  dependencies, so can be used even when you embed Wren inside an
  application. But they're also optional and can be disabled if you
  don't need them.
- CLI modules. These ones need libuv and are tied to the CLI wrapper
  around the VM.
2015-10-17 22:09:48 -07:00
Bob Nystrom
a3f3e3ce03 Don't try to run the guess_number example from the test script. 2015-10-17 13:29:50 -07:00
Bob Nystrom
8436ce1934 Add a random module. 2015-10-17 11:03:15 -07:00
Bob Nystrom
29eebe4928 Tweak libuv.py a bit. 2015-10-16 21:33:22 -07:00
Bob Nystrom
82d6453a7e Merge branch 'master' of https://github.com/ppearson/wren into ppearson-master 2015-10-16 21:24:22 -07:00
Bob Nystrom
d431c2eaa8 Start sketching in support for reading from stdin. 2015-10-16 21:05:24 -07:00
Bob Nystrom
79354f5a97 Do some work on wrenCall().
- Add an explicit va_list version. That lets variadic functions
  forward to it.
- Fix a GC bug in wrenCall() with return values.
- Make the call API test not re-enter the VM.
2015-09-29 19:29:10 -07:00
Bob Nystrom
f757c9efac Better embedding API support (and tests!) for strings with null bytes.
- Test that a foreign method can return strings.
- Test that a foreign method can return a string with null bytes.
- Test wrenCall().
- Allow passing NULL for "v" to wrenCall().
- Allow "a" for passing an explicit length byte array to wrenCall().
2015-09-24 08:02:31 -07:00
Peter Pearson
52b1b7698f Modified libuv.py file to be able to work with Python 2.6 2015-09-24 21:05:08 +12:00
Bob Nystrom
a944ead5b4 Give the docs some love. 2015-09-22 21:19:38 -07:00
Bob Nystrom
505b48fdac Add a real Pygments lexer for Wren (finally!). 2015-09-22 07:59:54 -07:00
Bob Nystrom
36f7d74183 Unify "script" and "project" under "util". 2015-09-22 07:45:58 -07:00