`Isolate::from_void_ptr` is renamed to `from_raw_ptr`, to keep
consistency with std libs.
It is changed to `unsafe` function, because it can't guarantee that the
input is valid. This guarantee should be provided by the caller.
Its return type is changed to `&Isolate`, because `&mut Isolate` type
requires that no other aliases co-exist in this period of time, this
does not seem true. So I changed most of the methods to accept shared
reference `&Isolate`. It is easier to reason about the correctness of
`unsafe` blocks. As long as these shared references are in the same
thread, these `unsafe` codes are probably correct.
The main purpose of this PR is to remove the `'static` lifetime bound in
type OpCreator =
fn(state: &Arc<IsolateState>, base: &msg::Base, data: &'static mut [u8])
-> Box<Op>;
The reason is simple: it is plain wrong, the `data` is actually not `'static`. It is created when the message is sent from C side, and will be recycled when the message is responded. It violates the definition of `'static` lifetime.
If someone save this pointer somewhere else, and reuse it later again, uninitialized memory could be accessed. This kind of memory unsafety does not happen yet because the logic is carefully organized in this project. Lifetime constraints are maintained by code convention. It could be more robust if we can express this constraint by Rust's type system.
Basic idea: tie buffer's lifetime to an object's lifetime, a.k.a, RAII. The type `deno_buf` is pretty suitable for this job.
This is the second attempt at this patch. The first version was reverted
in 2ffd78daf9
The problem, I suspect, was that the snapshot was represented as a
source_set, which inserted a node into the dependency tree.
include_bytes does properly insert the snapshot into rustc's depfile but
the use of source_set confused gn. Now the that the deno executable has
the create_deno_snapshot as a direct dependency, changes will be
propagated.
Currently gn builds into "target/debug"
however cargo tells gn to build into
"target/debug/build/deno-26d2b5325de0f0cf/out"
This patch changes it so that they both build into "target/debug".
This still retains the ability to build V8 from scratch, with an number
of configurations. The prebuilt binaries were created using
DENO_BUILD_MODE=release ./tools/build.py v8
Reverting because this is causing Appveyor to be red. However
I hope we can reintroduce include_bytes! soon in a way that
works on windows. Fixes #1208.
This reverts commits 96c3641fff
and 92e404706b.
Changes since v0.1.12:
- First pass at running subprocesses (#1156)
- Improve flag parsing (#1200)
- Improve fetch() (#1194#1188#1102)
- Support shebang (#1197)