1
0
forked from Mirror/wren
Commit Graph

25 Commits

Author SHA1 Message Date
876c2d9208 Add API to call Wren method from C code.
This gives you a simple, efficient way to invoke a method on
some Wren object from C code, passing in arguments.

The basic API is in place and works, but there's still lots to do:

- Lots of error handling.
- Documentation.
- Tests!
2015-02-28 13:31:15 -08:00
e007bb7f11 Make embedding API provide full method signature. 2015-02-26 07:44:45 -08:00
0242e43ed5 Make sure UINT32_MAX is available even in gcc C++ builds. 2015-02-24 21:09:04 -08:00
bc5a793c41 Split out the core and main modules.
- Implicitly import everything in core into every imported module.
- Test cyclic imports.
2015-02-11 10:06:45 -08:00
bb647d4247 Start getting module loading working.
Right now, it uses a weird "import_" method on String which
should either be replaced or at least hidden behind some syntax.

But it does roughly the right thing. Still lots of corner cases to
clean up and stuff to fix. In particular:

- Need to handle compilation errors in imported modules.
- Need to implicitly import all core and IO types into imported module.
- Need to handle circular imports.
  (Just need to give entry module the right name for this to work.)
2015-02-06 07:01:15 -08:00
b3f556adba Move globals out of VM and into a Module struct.
Functions store a reference to the module where they were
defined and load "module" variables from there.

Right now there's only one "main" module, but this is a step
in the right direction. Perf is down, though. :(

binary_trees - wren            ..........  3026  0.33s   88.28% relative to baseline
delta_blue - wren              ..........  7248  0.14s   94.32% relative to baseline
fib - wren                     ..........  2414  0.41s   88.08% relative to baseline
for - wren                     ..........  6753  0.15s   78.79% relative to baseline
method_call - wren             ..........  6624  0.15s  100.03% relative to baseline
2015-01-26 07:45:21 -08:00
efd161cea2 Add "arity" getter to Fn. 2015-01-23 20:33:05 -08:00
2cee4c83bd Clean up and improve docs in embedder API. Fix #133. 2015-01-22 07:05:55 -08:00
363dff2ffd Reorganize a bit. 2015-01-20 14:00:03 -08:00
a65e11b9f7 Added comment for wrenGetArgumentBool 2015-01-19 14:52:30 +00:00
2763ab3176 Implemented wrenGetArgumentBool 2015-01-19 14:40:37 +00:00
b7d03971c6 Added comment for wrenReturnBool 2015-01-17 12:02:23 +00:00
dec4f0d1e7 Implemented wrenReturnBool in vm 2015-01-17 11:48:27 +00:00
1d9445d9bc Tests for IO.read(). 2015-01-11 21:47:29 -08:00
db082967f4 Minor cleanup and refactoring. 2014-04-06 18:59:53 -07:00
e9ee4eb147 Add FFI support for returning strings and null. 2014-02-05 06:30:20 -08:00
36df70dba1 Move IO into a separate module. 2014-02-04 08:44:59 -08:00
ba06a4fd8a Define error type enum. 2014-02-03 06:51:44 -08:00
092107742d hack unused-value warning on POP() to pass build 2014-02-02 01:12:52 +08:00
48db3a9620 Start adding support for runtime errors:
- Primitives can now signal an error.
- An error prints a callstack and ends the current (and right 
  now only) fiber.
- Arithmetic operators error if the operand is not a number.
- Real error for method not found.
- Associate source file name, and method names with functions.
- Debug line number info for functions.

Unfortunately, this regresses perf on fib about 15%, mostly
because of the better checking in arithmetic ops.

There's still a bunch of clean up to do, but this is a big step
in the right direction.
2014-01-01 13:25:24 -08:00
63d1255566 Start sketching in the FFI. 2013-12-29 10:06:35 -08:00
315ed1c425 Make heap usage configurable. 2013-12-20 07:41:35 -08:00
7fe60499db Get rid of my name from TODOs. Anyone can do them. 2013-12-14 15:28:18 -08:00
5c807c0ec5 Track memory during deallocation correctly.
It used to subtract the number of bytes during deallocation, but
that required knowing the size of an object at free time. That
isn't always available. The old code could read a freed object
while doing this. Bad!

Instead, this tracks how much memory is still being used by
marked objects. It's correct, and is also a bit less code and
faster.
2013-12-14 14:17:16 -08:00
af6b73208c Start defining actual API for embedding Wren. 2013-11-25 07:47:02 -08:00