...
 
Commits (4)
module.exports = {
"extends": "google",
"parserOptions": {
"ecmaVersion": 6
"ecmaVersion": 10
},
"rules": {
"require-jsdoc": "off",
"max-len": "off",
"arrow-parens": "off",
"no-extend-native": "off",
"camelcase": "off",
"guard-for-in": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"no-invalid-this": "off",
"no-throw-literal": "off",
"prefer-const": "error"
"prefer-const": "error",
"spaced-comment": "off",
"new-cap": "off"
}
};
......@@ -190,6 +190,7 @@ src/vm/js/nqp-runtime/deserialization.js
src/vm/js/nqp-runtime/exceptions-stack.js
src/vm/js/nqp-runtime/fake-stable.js
src/vm/js/nqp-runtime/fiber-continuations.js
src/vm/js/nqp-runtime/global-context.js
src/vm/js/nqp-runtime/graphemes.js
src/vm/js/nqp-runtime/hash-iter.js
src/vm/js/nqp-runtime/hash.js
......@@ -210,7 +211,6 @@ src/vm/js/nqp-runtime/null.js
src/vm/js/nqp-runtime/null_s.js
src/vm/js/nqp-runtime/package.json
src/vm/js/nqp-runtime/refs.js
src/vm/js/nqp-runtime/repossession.js
src/vm/js/nqp-runtime/reprs.js
src/vm/js/nqp-runtime/resolve-sourcemap.js
src/vm/js/nqp-runtime/runtime.js
......@@ -483,6 +483,7 @@ t/moar/09-concat.t
t/moar/10-eqatim.t
t/moar/11-decode.t
t/moar/12-decodelocaltime.t
t/moar/13-writeint.t
t/moar/50-jit-register-alloc.t
t/moar/51-jit-div_i.t
t/moar/52-pluggable-spesh.t
......
nqp (2018.12+dfsg-1) unstable; urgency=medium
* New upstream version 2018.12+dfsg
* control: update moarvm-dev dep versions
-- Robert Lemmen <robertle@semistable.com> Sat, 22 Dec 2018 14:40:43 +0100
nqp (2018.11+dfsg-1) unstable; urgency=medium
* New upstream version 2018.11+dfsg
......
......@@ -10,7 +10,7 @@ Build-Depends: debhelper (>= 9),
libjs-jquery,
libreadline-dev,
libtommath-dev (>= 0.42.0-1.2),
moarvm-dev (>= 2018.11),
moarvm-dev (>= 2018.12),
perl
Standards-Version: 4.1.4
Vcs-Browser: https://salsa.debian.org/perl6-team/nqp
......
......@@ -242,6 +242,13 @@
* [tostr](#tostr)
* [tonum](#tonum)
* [unbox](#unbox)
- [Binary Data Opcodes](#-binary-data-opcodes)
* [writeint](#writeint)
* [writeuint](#writeuint)
* [writenum](#writenum)
* [readint](#readint)
* [readuint](#readuint)
* [readnum](#readnum)
- [OO/SixModel Opcodes](#-oosixmodel-opcodes)
* [attrinited](#attrinited)
* [bindattr](#bindattr)
......@@ -404,6 +411,7 @@ The opcodes are grouped into the following categories:
* [External command Opcodes](#extern)
* [File / Directory / Network Opcodes](#filedirnet)
* [Type/Conversion Opcodes](#type)
* [Binary Data Opcodes](#binarydata)
* [OO/SixModel Opcodes](#sixmodel)
* [Bit Opcodes](#bit)
* [Context Introspection Opcodes](#context)
......@@ -2068,6 +2076,71 @@ Convert Big Integer value to a native number.
Given a Perl 6 object, return a native with the same value,
of the type indicated by the opcode suffix.
# <a id="binarydata"></a> Binary Data Opcodes
For these definitions, `buffer` refers to a concrete object with a REPR of
either `VMArray` or `MultiDimArray`, the latter being constrained to a single
dimension. (Note: dimensionality is a property of the type, meaning that type
specialization is already sufficient to optimize out both the REPR and shape
checks.) In either case, the array must be an 8-bit integer array (as a Perl 6
`Blob` or `Buf` will be).
### Constants
The following new `nqp::const` entries are defined for use with the new ops,
and specify sizes to use in reads and writes:
* `BINARY_SIZE_8_BIT`
* `BINARY_SIZE_32_BIT`
* `BINARY_SIZE_16_BIT`
* `BINARY_SIZE_64_BIT`
These `nqp::const` entries are defined for specifying the endianness of the data
to read or write:
* `BINARY_ENDIAN_LITTLE`
* `BINARY_ENDIAN_BIG`
Operations not configured with one of these options will assume native endian.
Reading or writing little endian on a little endian machine will, of course,
carry no transformation overhead.
## writeint
* `nqp::writeint(buffer $target, int $offset, int $value, int $flags)`
Writes the signed integer `$value` at `$offset` into the buffer `$target`,
with the size and endianness specified by `$flags`.
## writeuint
* `nqp::writeuint(buffer $target, int $offset, uint $value, int $flags)`
Writes the unsigned integer `$value` at `$offset` into the buffer `$target`,
with the size and endianness specified by `$flags`.
## writenum
* `nqp::writenum(buffer $target, int $offset, num $value, int $flags)`
Writes the floating point `$value` at `$offset` into the buffer `$target`.
Only 32-bit and 64-bit sizes are supported.
## readint
* `nqp::readint(buffer $source, int $offset, int $flags --> int)`
Reads a signed integer at offset `$offset` from `$source` with size and
endianness specified by `$flags`. Returns that value, widened to a 64-bit int.
## readuint
* `nqp::readuint(buffer $source, int $offset, int $flags --> uint)`
Reads an unsigned integer at offset `$offset` from `$source` with size and
endianness specified by `$flags`. Returns that value, widened to a 64-bit uint.
## readnum
* `nqp::readnum(buffer $source, int $offset, int $flags --> num)`
Reads a floating point number at offset `$offset` from `$source` with the
size specified by `$flags`. Returns that value, widened to a 64-bit num.
# <a id="sixmodel"></a> OO/SixModel Opcodes
## attrinited
......@@ -2464,6 +2537,13 @@ constants below can be used in nqp as (e.g.) `nqp::const::CCLASS_ANY`.
* STAT_PLATFORM_BLOCKSIZE
* STAT_PLATFORM_BLOCKS
* BINARY_SIZE_8_BIT
* BINARY_SIZE_32_BIT
* BINARY_SIZE_16_BIT
* BINARY_SIZE_64_BIT
* BINARY_ENDIAN_LITTLE
* BINARY_ENDIAN_BIG
* TYPE_CHECK_CACHE_DEFINITIVE
* TYPE_CHECK_CACHE_THEN_METHOD
* TYPE_CHECK_NEEDS_ACCEPTS
......
{
"version": "0.15.0",
"version": "0.28.0",
"name": "nqp-js-on-js",
"bin": {
"nqp-js-on-js": "nqp-bootstrapped.js"
},
"files": [
"*.js"
"*.js", "*.js.map"
],
"licenses": [
{
......@@ -14,6 +14,6 @@
}
],
"dependencies": {
"nqp-runtime": "0.15.0"
"nqp-runtime": "0.28.0"
}
}
......@@ -8,7 +8,7 @@
"private": true,
"repository": "http://github.com/perl6/nqp/",
"devDependencies": {
"eslint": "^3.19.0",
"eslint": "^5.9.0",
"eslint-config-google": "^0.8.0"
},
"dependencies": {
......
......@@ -397,7 +397,7 @@ role NQPMatchRole is export {
$caps;
}
method !cursor_init($orig, :$p = 0, :$c, :$shared, :$braid, :$build, *%ignore) {
method !cursor_init($orig, :$p = 0, :$c, :$shared, :$braid, :$build, :$fail_cursor, *%ignore) {
my $new := $build ?? self !! self.CREATE();
unless $shared {
$shared := nqp::create(ParseShared);
......@@ -428,7 +428,8 @@ role NQPMatchRole is export {
nqp::bindattr_i($new, $?CLASS, '$!pos', $p);
}
nqp::bindattr_i($new, $?CLASS, '$!to', -1); # delegates to $!pos if negative
nqp::bindattr($shared, ParseShared, '$!fail_cursor', $new.'!cursor_start_cur'());
nqp::bindattr($shared, ParseShared, '$!fail_cursor',
nqp::isconcrete($fail_cursor) ?? $fail_cursor !! $new.'!cursor_start_cur'());
$new
}
......
......@@ -82,17 +82,22 @@ public class AsyncServerSocketHandle implements IIOBindable, IIOCancelable {
ThreadContext curTC = tc.gc.getCurrentThreadContext();
AsyncSocketHandle handle = new AsyncSocketHandle(curTC, channel);
IOHandleInstance ioHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
AsyncSocketHandle clientHandle = new AsyncSocketHandle(curTC, channel);
IOHandleInstance clientIoHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
IOType.st);
ioHandle.handle = handle;
clientIoHandle.handle = clientHandle;
IOHandleInstance serverIoHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
IOType.st);
serverIoHandle.handle = this;
SixModelObject result = Array.st.REPR.allocate(curTC, Array.st);
result.push_boxed(curTC, task.schedulee);
result.push_boxed(curTC, ioHandle);
result.push_boxed(curTC, clientIoHandle);
result.push_boxed(curTC, Null);
result.push_boxed(curTC, Ops.box_s(peerHost, Str, curTC));
result.push_boxed(curTC, Ops.box_i(peerPort, Int, curTC));
result.push_boxed(curTC, serverIoHandle);
result.push_boxed(curTC, Ops.box_s(socketHost, Str, curTC));
result.push_boxed(curTC, Ops.box_i(socketPort, Int, curTC));
......@@ -108,6 +113,7 @@ public class AsyncServerSocketHandle implements IIOBindable, IIOCancelable {
result.push_boxed(curTC, Ops.box_s(exc.toString(), Str, curTC));
result.push_boxed(curTC, Str);
result.push_boxed(curTC, Int);
result.push_boxed(curTC, IOType);
result.push_boxed(curTC, Str);
result.push_boxed(curTC, Int);
}
......@@ -134,17 +140,24 @@ public class AsyncServerSocketHandle implements IIOBindable, IIOCancelable {
socketHost = "::1";
int socketPort = localAddress.getPort();
SixModelObject result = Array.st.REPR.allocate(tc, Array.st);
ThreadContext curTC = tc.gc.getCurrentThreadContext();
IOHandleInstance ioHandle = (IOHandleInstance) IOType.st.REPR.allocate(curTC,
IOType.st);
ioHandle.handle = this;
SixModelObject result = Array.st.REPR.allocate(curTC, Array.st);
result.push_boxed(tc, task.schedulee);
result.push_boxed(tc, IOType);
result.push_boxed(tc, Null);
result.push_boxed(tc, Str);
result.push_boxed(tc, Int);
result.push_boxed(tc, Ops.box_s(socketHost, Str, tc));
result.push_boxed(tc, Ops.box_i(socketPort, Int, tc));
result.push_boxed(curTC, task.schedulee);
result.push_boxed(curTC, IOType);
result.push_boxed(curTC, Null);
result.push_boxed(curTC, Str);
result.push_boxed(curTC, Int);
result.push_boxed(curTC, ioHandle);
result.push_boxed(curTC, Ops.box_s(socketHost, Str, curTC));
result.push_boxed(curTC, Ops.box_i(socketPort, Int, curTC));
((ConcBlockingQueueInstance) task.queue).push_boxed(tc, result);
((ConcBlockingQueueInstance) task.queue).push_boxed(curTC, result);
}
catch (Exception e) {
throw ExceptionHandling.dieInternal(tc, e);
......
......@@ -2208,14 +2208,14 @@ class MoarVM::Callsites {
if $name {
my int $idx := nqp::unbox_i($frame.add-string($name));
nqp::push_i(@named_idxs, $idx);
nqp::writeuint($identifier, $id_offset, $idx, 4);
nqp::writeuint($identifier, $id_offset, $idx, 9);
$id_offset := $id_offset + 4;
$result_typeflag := $result_typeflag +| $named;
}
}
nqp::push_i(@flags, $result_typeflag);
nqp::writeuint($identifier, $id_offset++, $result_typeflag, 0);
nqp::writeuint($identifier, $id_offset++, $result_typeflag, 1);
$i++;
}
......@@ -2228,18 +2228,18 @@ class MoarVM::Callsites {
my $callsite-idx := nqp::elems(%!callsites);
%!callsites{$identifier_s} := $callsite-idx;
my uint $callsites_offset := nqp::elems($!callsites);
nqp::writeuint($!callsites, $callsites_offset, $elems, 2);
nqp::writeuint($!callsites, $callsites_offset, $elems, 5);
$callsites_offset := $callsites_offset + 2;
my $iter := nqp::iterator(@flags);
while $iter {
nqp::writeuint($!callsites, $callsites_offset++, nqp::shift_i($iter), 0);
nqp::writeuint($!callsites, $callsites_offset++, nqp::shift_i($iter), 1);
}
if $elems +& 1 {
nqp::writeuint($!callsites, $callsites_offset++, 0, 0);
nqp::writeuint($!callsites, $callsites_offset++, 0, 1);
}
$iter := nqp::iterator(@named_idxs);
while $iter {
nqp::writeuint($!callsites, $callsites_offset, nqp::shift_i($iter), 4);
nqp::writeuint($!callsites, $callsites_offset, nqp::shift_i($iter), 9);
$callsites_offset := $callsites_offset + 4;
}
$callsite-idx
......
This diff is collapsed.
plan(62);
my $buf := MAST::Bytecode.new;
nqp::writeuint($buf, 0, 0x1234, 1);
is(nqp::atpos_i($buf, 0), 0x34);
is(nqp::elems($buf), 1);
$buf := MAST::Bytecode.new;
nqp::writeint($buf, 0, -128, 1);
is(nqp::atpos_i($buf, 0), 128);
is(nqp::elems($buf), 1);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 0, 0x1234, 5);
is(nqp::atpos_i($buf, 0), 0x34);
is(nqp::atpos_i($buf, 1), 0x12);
is(nqp::elems($buf), 2);
$buf := MAST::Bytecode.new;
nqp::writeint($buf, 0, -32768, 5);
is(nqp::atpos_i($buf, 0), 0);
is(nqp::atpos_i($buf, 1), 128);
is(nqp::elems($buf), 2);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 0, 0x1234, 6);
is(nqp::atpos_i($buf, 0), 0x12);
is(nqp::atpos_i($buf, 1), 0x34);
is(nqp::elems($buf), 2);
$buf := MAST::Bytecode.new;
nqp::writeint($buf, 0, -32768, 6);
is(nqp::atpos_i($buf, 0), 128);
is(nqp::atpos_i($buf, 1), 0);
is(nqp::elems($buf), 2);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, 0x12345678, 9);
is(nqp::atpos_i($buf, 1), 0x78);
is(nqp::atpos_i($buf, 2), 0x56);
is(nqp::atpos_i($buf, 3), 0x34);
is(nqp::atpos_i($buf, 4), 0x12);
is(nqp::elems($buf), 5);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, -2147483648, 9);
is(nqp::atpos_i($buf, 1), 0);
is(nqp::atpos_i($buf, 2), 0);
is(nqp::atpos_i($buf, 3), 0);
is(nqp::atpos_i($buf, 4), 128);
is(nqp::elems($buf), 5);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, 0x12345678, 10);
is(nqp::atpos_i($buf, 1), 0x12);
is(nqp::atpos_i($buf, 2), 0x34);
is(nqp::atpos_i($buf, 3), 0x56);
is(nqp::atpos_i($buf, 4), 0x78);
is(nqp::elems($buf), 5);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, -2147483648, 10);
is(nqp::atpos_i($buf, 1), 128);
is(nqp::atpos_i($buf, 2), 0);
is(nqp::atpos_i($buf, 3), 0);
is(nqp::atpos_i($buf, 4), 0);
is(nqp::elems($buf), 5);
# work around NQP's literals defaulting to num
my uint64 $val := nqp::bitor_i(nqp::bitshiftl_i(0x01234567, 32), 0x89ABCDEF);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, $val, 13);
is(nqp::atpos_i($buf, 1), 0xEF);
is(nqp::atpos_i($buf, 2), 0xCD);
is(nqp::atpos_i($buf, 3), 0xAB);
is(nqp::atpos_i($buf, 4), 0x89);
is(nqp::atpos_i($buf, 5), 0x67);
is(nqp::atpos_i($buf, 6), 0x45);
is(nqp::atpos_i($buf, 7), 0x23);
is(nqp::atpos_i($buf, 8), 0x01);
is(nqp::readuint($buf, 1, 1), 0xEF, 'read byte');
is(nqp::readuint($buf, 1, 5), 0xCDEF, 'read word');
is(nqp::readuint($buf, 1, 9), 0x89ABCDEF, 'read dword');
is(nqp::readuint($buf, 1, 13), $val, 'read qword');
is(nqp::elems($buf), 9);
$buf := MAST::Bytecode.new;
nqp::writeuint($buf, 1, $val, 14);
is(nqp::atpos_i($buf, 1), 0x01);
is(nqp::atpos_i($buf, 2), 0x23);
is(nqp::atpos_i($buf, 3), 0x45);
is(nqp::atpos_i($buf, 4), 0x67);
is(nqp::atpos_i($buf, 5), 0x89);
is(nqp::atpos_i($buf, 6), 0xAB);
is(nqp::atpos_i($buf, 7), 0xCD);
is(nqp::atpos_i($buf, 8), 0xEF);
is(nqp::readuint($buf, 1, 2), 0x01, 'read big endian byte');
is(nqp::readuint($buf, 1, 6), 0x0123, 'read big endian word');
is(nqp::readuint($buf, 1, 10), 0x01234567, 'read big endian dword');
is(nqp::readuint($buf, 1, 14), $val, 'read big endian qword');
is(nqp::elems($buf), 9);