10 Commits

Author SHA1 Message Date
d585a080e8 Merge pull request #751 from wren-lang/0.3.0-refactor
0.3.0 refactor
2020-06-05 14:57:20 -07:00
f91586a71a Fix wrenAbortFiber does not work inside of foreign class allocator 2019-09-17 19:43:53 +02:00
fde6cfc142 Generate wrenAllocateForeign() to match the other setSlot methods.
Thanks, Michel!
2016-01-24 09:25:04 -08:00
ed6fad6153 Get rid of fiber for finalizers.
Instead, finalizers just get access to the foreign object's raw bytes.
This is deliberately limiting, since it discourages the user from
interacting with the VM in the middle of a GC.
2015-12-28 08:06:29 -08:00
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
4b3c818ec5 Start moving embedding API towards "slot" register-API.
- wrenGetArgumentCount() -> wrenGetSlotCount()
- wrenGetArgument___() -> wrenGetSlot___()

Also, the get functions assert that the value is the right type instead
of checking at runtime. This puts the onus on the caller to be safe,
but maximizes performance.
2015-12-16 10:22:42 -08:00
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
720c03cf49 Add System.gc(). 2015-10-24 10:56:27 -07:00
36f3059e48 Get finalizers working. 2015-08-31 21:56:21 -07:00
48bdbc7745 First pass at implementing foreign classes.
Most of the pieces are there:

- You can declare a foreign class.
- It will call your C function to provide an allocator function.
- Whenever a foreign object is created, it calls the allocator.
- Foreign methods can access the foreign bytes of an object.
- Most of the runtime checking is in place for things like subclassing
  foreign classes.

There is still some loose ends to tie up:

- Finalizers are not called.
- Some of the error-handling could be better.
- The GC doesn't track how much memory a marked foreign object uses.
2015-08-15 12:07:53 -07:00