nit.git
8 years agotyping: also type signature for intern methods
Alexandre Terrasa [Tue, 14 Jul 2015 05:28:14 +0000 (01:28 -0400)]
typing: also type signature for intern methods

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: compile concrete methods bodies
Alexandre Terrasa [Thu, 9 Jul 2015 23:58:12 +0000 (19:58 -0400)]
nitj: compile concrete methods bodies

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement instance initialization and ANewExprs
Alexandre Terrasa [Mon, 6 Jul 2015 16:49:20 +0000 (12:49 -0400)]
nitj: implement instance initialization and ANewExprs

Attributes are not handled in this commit.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: avoid calls to abstract methods
Alexandre Terrasa [Mon, 13 Jul 2015 21:08:52 +0000 (17:08 -0400)]
nitj: avoid calls to abstract methods

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implements AReturnExprs
Alexandre Terrasa [Fri, 10 Jul 2015 05:38:35 +0000 (01:38 -0400)]
nitj: implements AReturnExprs

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: shortcut calls on primitive instances
Alexandre Terrasa [Mon, 6 Jul 2015 16:50:01 +0000 (12:50 -0400)]
nitj: shortcut calls on primitive instances

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement static and polymorphic sends
Alexandre Terrasa [Fri, 17 Jul 2015 18:32:17 +0000 (14:32 -0400)]
nitj: implement static and polymorphic sends

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement boxing for Java primitives
Alexandre Terrasa [Tue, 14 Jul 2015 06:08:08 +0000 (02:08 -0400)]
nitj: implement boxing for Java primitives

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement variable declaration
Alexandre Terrasa [Fri, 17 Jul 2015 18:23:12 +0000 (14:23 -0400)]
nitj: implement variable declaration

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: compile native instances of Int, Byte, Float, Char and Bool
Alexandre Terrasa [Mon, 6 Jul 2015 15:33:04 +0000 (11:33 -0400)]
nitj: compile native instances of Int, Byte, Float, Char and Bool

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement `self` accesses
Alexandre Terrasa [Thu, 9 Jul 2015 23:20:44 +0000 (19:20 -0400)]
nitj: implement `self` accesses

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement aborts
Alexandre Terrasa [Fri, 17 Jul 2015 18:06:57 +0000 (14:06 -0400)]
nitj: implement aborts

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement static frame to handle calls
Alexandre Terrasa [Thu, 9 Jul 2015 23:20:08 +0000 (19:20 -0400)]
nitj: implement static frame to handle calls

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: prepare node visit of method bodies
Alexandre Terrasa [Mon, 13 Jul 2015 21:07:32 +0000 (17:07 -0400)]
nitj: prepare node visit of method bodies

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: implement variable handling
Alexandre Terrasa [Wed, 1 Jul 2015 00:02:58 +0000 (20:02 -0400)]
nitj: implement variable handling

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: build naive type tables using Java HashMaps
Alexandre Terrasa [Thu, 9 Jul 2015 23:55:32 +0000 (19:55 -0400)]
nitj: build naive type tables using Java HashMaps

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: build naive vfts using Java HashMaps
Alexandre Terrasa [Tue, 30 Jun 2015 19:48:51 +0000 (15:48 -0400)]
nitj: build naive vfts using Java HashMaps

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: generate runtime mmethodef structure stubs
Alexandre Terrasa [Fri, 17 Jul 2015 17:44:32 +0000 (13:44 -0400)]
nitj: generate runtime mmethodef structure stubs

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: generate runtime class structure stubs
Alexandre Terrasa [Fri, 17 Jul 2015 17:41:05 +0000 (13:41 -0400)]
nitj: generate runtime class structure stubs

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: introduce JavaRuntimeModel used to represent Nit entities in Java runtime
Alexandre Terrasa [Fri, 17 Jul 2015 17:37:50 +0000 (13:37 -0400)]
nitj: introduce JavaRuntimeModel used to represent Nit entities in Java runtime

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: introduce JavaCompilerVisitor to generate java code
Alexandre Terrasa [Fri, 17 Jul 2015 17:31:48 +0000 (13:31 -0400)]
nitj: introduce JavaCompilerVisitor to generate java code

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: add tests for the nitj engine
Alexandre Terrasa [Mon, 20 Jul 2015 17:58:31 +0000 (13:58 -0400)]
nitj: add tests for the nitj engine

Reused tests from `nitg-e`.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: compile generated Java files using make and Javac
Alexandre Terrasa [Fri, 17 Jul 2015 17:16:49 +0000 (13:16 -0400)]
nitj: compile generated Java files using make and Javac

This will be used to compile generated files into an executable jar.
Also introduce a shell script to directly run the generated jar to come like it was a binary.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agonitj: introduce compiler to Java code
Alexandre Terrasa [Fri, 17 Jul 2015 17:06:34 +0000 (13:06 -0400)]
nitj: introduce compiler to Java code

This commit only introduce a stub and a way to test it.
Code generation will be added in next commits.

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

8 years agoMerge: Opportunity i18n & traduction française
Jean Privat [Mon, 22 Jun 2015 23:54:30 +0000 (19:54 -0400)]
Merge: Opportunity i18n & traduction française

This PR brings partial i18n support to Opportunity with a french translation. Most strings from the
 UI are covered but not the error messages. This PR also fixes a few bugs in the i18n phase.

I still have difficulty with the deployment. Launching my web server use `LANGUAGE=fr sudo bin/xymus_net` works, but not when using `daemonize -E LANGUAGE=fr ...`. @R4PaSs do you have an idea for a solution?

http://xymus.net/opportunity/ temporary serves the French version of the site. I may have to revert tot the English version if I need monit and I can't fix the locale issue.

Pull-Request: #1531
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agoMerge: Geometry fix
Jean Privat [Mon, 22 Jun 2015 23:53:43 +0000 (19:53 -0400)]
Merge: Geometry fix

There was a big mistake in the boxes API where you would get the bottom of a line when calling for it's top and get the top when you were calling for the bottom xD, so fixed it.
There also was a bug with the usage of the Numerics in the quadtree API.
Also implemented a to_s for quadtree, but not sure if it needs to stay here.

Pull-Request: #1534
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Use light FFI instead of the legacy NI in the lib
Jean Privat [Mon, 22 Jun 2015 23:52:49 +0000 (19:52 -0400)]
Merge: Use light FFI instead of the legacy NI in the lib

Update all extern methods previously implemented with the legacy NI to use the light FFI. Also cleans up the `_nit.[ch]` files and a few redundant `is extern` declarations.

There could be a performance hit because we add at least one layer of indirection when invoking the extern method code. And some were previously only macros applied within the generated internal code... However I don't see a difference with the performance of nitc and it can be optimized by the C compiler.

The C structure used in the `exec` module should be replaced by a Nit class. I've added 2 FIXMEs to make it clear. The C structure makes dealing with calls to `pipe` easier but it also makes the rest of the code more complex than needed.

The only use of the legacy NI left is the parser generated by the modified SableCC.

Pull-Request: #1520
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Nitunit fails bad code
Jean Privat [Mon, 22 Jun 2015 19:36:14 +0000 (15:36 -0400)]
Merge: Nitunit fails bad code

Documentation that contains only bad code (not tagged) is now reported by nitunit as it should be.

Pull-Request: #1522
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agoMerge: Adaptive typing: fix buggy warning messages
Jean Privat [Mon, 22 Jun 2015 19:36:12 +0000 (15:36 -0400)]
Merge: Adaptive typing: fix buggy warning messages

 #1257 relaxed some rules about untyped code in order to allow the compiler to compute a fixed point. So an inconsistent state with untyped code was permitted during the typing.

The problem is that errors messages or warnings could be prematurely displayed during the analysis thus be false because based on non final information.
The solution is to add a post-processing after the fixed point and delay the premature warning so that the information used is computed and reliable.

Moreover, the `useless null test because always null` is now brought back (it was disabled because caused too much unreliable noise)

Close #1257

Pull-Request: #1524
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agotests: skip nitpick args1 in niti and nitvm
Alexis Laferrière [Mon, 22 Jun 2015 13:42:06 +0000 (09:42 -0400)]
tests: skip nitpick args1 in niti and nitvm

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/opportunity: gitignore .pot and .mo files
Alexis Laferrière [Sun, 21 Jun 2015 21:06:16 +0000 (17:06 -0400)]
contrib/opportunity: gitignore .pot and .mo files

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/i18n_phase: there's no need to unescape
Alexis Laferrière [Sat, 20 Jun 2015 11:44:01 +0000 (07:44 -0400)]
src/i18n_phase: there's no need to unescape

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/i18n_phase: breakup 2 complexe lines of code
Alexis Laferrière [Sat, 20 Jun 2015 11:48:51 +0000 (07:48 -0400)]
src/i18n_phase: breakup 2 complexe lines of code

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/i18n_phase: use an escape custom to gettext
Alexis Laferrière [Fri, 19 Jun 2015 14:59:30 +0000 (10:59 -0400)]
src/i18n_phase: use an escape custom to gettext

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/opportunity: add rule to build .mo files
Alexis Laferrière [Sat, 20 Jun 2015 03:02:54 +0000 (23:02 -0400)]
contrib/opportunity: add rule to build .mo files

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/opportunity: intro french translation
Alexis Laferrière [Fri, 19 Jun 2015 15:04:10 +0000 (11:04 -0400)]
contrib/opportunity: intro french translation

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/opportunity: hack to circumvent #1530
Alexis Laferrière [Fri, 19 Jun 2015 15:02:49 +0000 (11:02 -0400)]
contrib/opportunity: hack to circumvent #1530

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agocontrib/opportunity: prepare for i18n by separating the localized strings from the...
Alexis Laferrière [Fri, 19 Jun 2015 15:01:24 +0000 (11:01 -0400)]
contrib/opportunity: prepare for i18n by separating the localized strings from the rest

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agogeometry/quadtree: fixed use of the numerics
BlackMinou [Sun, 21 Jun 2015 17:32:41 +0000 (19:32 +0200)]
geometry/quadtree: fixed use of the numerics

Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>

8 years agogeometry/boxes: top and bottom in ILine were inversed...
BlackMinou [Sun, 21 Jun 2015 17:35:58 +0000 (19:35 +0200)]
geometry/boxes: top and bottom in ILine were inversed...

Signed-off-by: BlackMinou <romain.chanoir@viacesi.fr>

8 years agolib/text: protect the `format` method against inconsistencies
Alexis Laferrière [Fri, 19 Jun 2015 15:00:24 +0000 (11:00 -0400)]
lib/text: protect the `format` method against inconsistencies

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/i18n_phase: accepts string literals within a superstring
Alexis Laferrière [Fri, 19 Jun 2015 14:59:53 +0000 (10:59 -0400)]
src/i18n_phase: accepts string literals within a superstring

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoMerge: Check for errors in regex within string literals at compilation
Jean Privat [Fri, 19 Jun 2015 19:41:12 +0000 (15:41 -0400)]
Merge: Check for errors in regex within string literals at compilation

This is the first part for #1511.

Pull-Request: #1528
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: niti-ffi: NativeString is re-a `char*` since #1502
Jean Privat [Fri, 19 Jun 2015 19:41:09 +0000 (15:41 -0400)]
Merge: niti-ffi: NativeString is re-a `char*` since #1502

This removes a warning during the initial make.

Pull-Request: #1529
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoniti-ffi: NativeString is re-a `char*` since #1502
Jean Privat [Fri, 19 Jun 2015 02:06:57 +0000 (22:06 -0400)]
niti-ffi: NativeString is re-a `char*` since #1502

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Bug fixes in SSA module
Jean Privat [Fri, 19 Jun 2015 01:34:47 +0000 (21:34 -0400)]
Merge: Bug fixes in SSA module

This small PR fixes two bugs in SSA.

First: A property was unecessary specific in the hierarchy.
Second: Bad initialization of two attributes which cause runtime error in new tests.

Pull-Request: #1526
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Fix FFI with private extern classes not needing a "C Header" block
Jean Privat [Fri, 19 Jun 2015 01:33:41 +0000 (21:33 -0400)]
Merge: Fix FFI with private extern classes not needing a "C Header" block

According to the [manual of the C FFI for wrappers](http://nitlanguage.org/FFI/wrapping_C_libraries/), a private extern class does not need to import (or declare) its C equivalent type in the "C header" it can be done only in the "C body" (or the default "C" block).

This bug broke this feature. It may have been reintroduced by 16f94e0, or maybe even before. This PR adds a test to prevent future regression.

Bug referenced in #1520.

Pull-Request: #1521
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agotests: test regular expression validation phase
Alexis Laferrière [Thu, 18 Jun 2015 19:30:29 +0000 (15:30 -0400)]
tests: test regular expression validation phase

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/frontend: add a phase to validate regular expression
Alexis Laferrière [Thu, 18 Jun 2015 14:25:53 +0000 (10:25 -0400)]
src/frontend: add a phase to validate regular expression

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agossa: Delete an unused variable
Julien Pagès [Thu, 18 Jun 2015 14:03:13 +0000 (16:03 +0200)]
ssa: Delete an unused variable

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

8 years agossa: Bug fixe with a wrong initialization
Julien Pagès [Thu, 18 Jun 2015 13:14:06 +0000 (15:14 +0200)]
ssa: Bug fixe with a wrong initialization

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

8 years agossa: Make a property more general
Julien Pagès [Mon, 15 Jun 2015 14:46:38 +0000 (16:46 +0200)]
ssa: Make a property more general

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

8 years agotests: mark as undefined tests using NativeFile, hacked in niti
Alexis Laferrière [Thu, 18 Jun 2015 12:48:22 +0000 (08:48 -0400)]
tests: mark as undefined tests using NativeFile, hacked in niti

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/signals: fix missing import and initializer for GCC
Alexis Laferrière [Thu, 18 Jun 2015 12:45:06 +0000 (08:45 -0400)]
lib/signals: fix missing import and initializer for GCC

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/signals: do no pin references if the FFI feature is not available
Alexis Laferrière [Thu, 18 Jun 2015 12:39:17 +0000 (08:39 -0400)]
lib/signals: do no pin references if the FFI feature is not available

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/signals: clean up whitespaces and style
Alexis Laferrière [Thu, 18 Jun 2015 12:37:54 +0000 (08:37 -0400)]
lib/signals: clean up whitespaces and style

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/signals: remove full FFI features from the module blocks
Alexis Laferrière [Thu, 18 Jun 2015 12:37:21 +0000 (08:37 -0400)]
lib/signals: remove full FFI features from the module blocks

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: intro a test with the different FFI module block
Alexis Laferrière [Tue, 16 Jun 2015 23:50:37 +0000 (19:50 -0400)]
tests: intro a test with the different FFI module block

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc/ffi: do not declare the impl signature before the custom C code
Alexis Laferrière [Tue, 16 Jun 2015 23:16:50 +0000 (19:16 -0400)]
src/ffi: do not declare the impl signature before the custom C code

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoMerge branch 'master' into lib-use-light-ffi
Alexis Laferrière [Thu, 18 Jun 2015 11:28:23 +0000 (07:28 -0400)]
Merge branch 'master' into lib-use-light-ffi

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoMerge: Second batch of RosettaCode
Jean Privat [Thu, 18 Jun 2015 03:09:37 +0000 (23:09 -0400)]
Merge: Second batch of RosettaCode

In this one, I rewrote the commits to squash them, clean them and add tests.

Since the commits are rewrote, their sha1 differ so the PR numbers are added in the descriptions of the commits to keep track of the original request.

Pull-Request: #1519
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agoMerge: Do not compile dead modules
Jean Privat [Thu, 18 Jun 2015 03:09:33 +0000 (23:09 -0400)]
Merge: Do not compile dead modules

Separate compilation implies that a module is compiled independently of its clients.
This point ensure us that the recompilation of programs is fast since only modified modules need to be recompiled and that modules used by multiples clients need to be compiled only once.

Unfortunately, currently an already compiled module need to still to be fully compiled in C on each compilation (avoiding doing it is a very complex matter). Fortunately, most of the compilation time is spend by the C compiler (especially when #1498) and this time is safely decimated by ccache.

However, a thing that some modules are imported by programs (thus provide declarations, introductions, importations) but are only made of method definitions that will never be executed by the program. Such a module is called a *dead* module and our static analysis RTA can approximate them.
So, now, the generation of C code for such a module is skipped (and its associated C compilation, obviously)

This will benefit mostly small programs that imports standard and other libraries but only use a small portion of them. Eg: programs in `tests/` or in `examples/rossetacode`.

For numbers, lets try with `time ./tests.sh ../examples/rosettacode/*.nit` to test the 32 (currently) programs.

* before: 30s
* after: 21s

I hope that CI servers will like what we, human masters, do for them!

Pull-Request: #1509
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agotests: other update related to adaptive typing messages
Jean Privat [Thu, 18 Jun 2015 02:26:12 +0000 (22:26 -0400)]
tests: other update related to adaptive typing messages

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotests: new tests base_adaptive_loop_null2.nit base_adaptive_loop_isa.nit
Jean Privat [Thu, 18 Jun 2015 02:12:29 +0000 (22:12 -0400)]
tests: new tests base_adaptive_loop_null2.nit base_adaptive_loop_isa.nit

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotyping: warn about useless null when the target is always `null`
Jean Privat [Thu, 18 Jun 2015 01:51:44 +0000 (21:51 -0400)]
typing: warn about useless null when the target is always `null`

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotyping: warnings related to adaptive typing are moved to the post_typing
Jean Privat [Thu, 18 Jun 2015 01:49:56 +0000 (21:49 -0400)]
typing: warnings related to adaptive typing are moved to the post_typing

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agolib/markdown: fix markdown used in documentation (how ironic)
Jean Privat [Thu, 18 Jun 2015 02:51:02 +0000 (22:51 -0400)]
lib/markdown: fix markdown used in documentation (how ironic)

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotyping: new PostTypingVisitor that is run after the visit
Jean Privat [Thu, 18 Jun 2015 01:49:38 +0000 (21:49 -0400)]
typing: new PostTypingVisitor that is run after the visit

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotyping: factorize AEqExpr and ANeExpr into AEqFormExpr
Jean Privat [Thu, 18 Jun 2015 01:46:19 +0000 (21:46 -0400)]
typing: factorize AEqExpr and ANeExpr into AEqFormExpr

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agoast: new class AEqFormExpr to factorize AEqExpr and ANeExpr
Jean Privat [Thu, 18 Jun 2015 01:44:22 +0000 (21:44 -0400)]
ast: new class AEqFormExpr to factorize AEqExpr and ANeExpr

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotyping: `or else` on null is no more an error
Jean Privat [Thu, 18 Jun 2015 01:14:51 +0000 (21:14 -0400)]
typing: `or else` on null is no more an error

A warning at most

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agotests: update line number with latest changes to the lib
Alexis Laferrière [Wed, 17 Jun 2015 20:17:50 +0000 (16:17 -0400)]
tests: update line number with latest changes to the lib

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agofixup: add first_letter_last_letter niti.skip
Jean Privat [Wed, 17 Jun 2015 20:15:13 +0000 (16:15 -0400)]
fixup: add first_letter_last_letter niti.skip

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agoMerge: Light FFI for the interpreter
Jean Privat [Wed, 17 Jun 2015 20:14:38 +0000 (16:14 -0400)]
Merge: Light FFI for the interpreter

Intro an FFI for the interpreter. This is a first draft/proof of concept to support the light FFI and few more features, more work is needed to implement the full FFI and support for other languages.

When the interpreter has to execute an extern method, it compiles all the extern code of the modules into an external native shared library (.so). Then the interpreter load dynamically the module, and invoke the C implementation function. The handle to the library is cached so a module isn't compiled twice per execution.

The current version is limited to the light FFI with a few more features. So there is extern methods, native type support and extern classes but it does not support callbacks.

The interpreter can now run 7 out of the 24 tests for the FFI with C.

This version was kept "simple" by design, it lacks some not-so-hard to implement features as well as portability concerns:
* Choosing the compiler (hard coded gcc) and the compile folder.
* Recompile the extern library only when the source is updated.
* Clear the compile folder.
* Support shared library format on OS X.
* Ensure call compatibility between the interpreter and extern libraries

The remaining features of the FFI, the callbacks and the other languages, require a decent amount of work but less than this PR.

Note that not a single line of code was added to the FFI folder, it uses the exact same backend as the compiler without modifications.

The design was inspired by other interpreters and VM-based languages. The JNI expect the user to manually compile the extern code into a native shared library before executing the Java code. This FFI automates the same process.

---

Please ignore the first 6 commits from #1441 and #1442.

Pull-Request: #1443
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

8 years agoMerge: More limit on tests
Jean Privat [Wed, 17 Jun 2015 19:47:24 +0000 (15:47 -0400)]
Merge: More limit on tests

Implemented more kind of size and time limits in `tests.sh` so that broken tests will not fill the disk with useless garbage.

realtimelimit is the existing time limit (in seconds)
It is used to avoid waiting or sleeping tests.
It requires timeout or timelimit, or else is not used.
The main change is the name (there is one now) and is lowered to 5 min

usertimelimit is an additional user CPU time limit (in seconds)
It is used to avoid to CPU intensive test (infinite loops). See ulimit -t
Is set to 1 CPU minute

filelimit is the user limit for write files (in kilo-bytes)
Is used to avoid execution that loop and fill the hard drive. See ulimit -f
Note that a test might require a lot of temporary disk space (eg. nitc+gcc) so it is set to approximately 100MB

reslimit is the limit (in bytes) for generated .res file.
Larger ones are truncated and will fail tests
It is used to avoid processing huge crappy res file (diff, xml, etc)
Is set to approximately 100KB

Pull-Request: #1454
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agoMerge: code: cleanup some docunits
Jean Privat [Wed, 17 Jun 2015 19:47:19 +0000 (15:47 -0400)]
Merge: code: cleanup some docunits

They where detected since #1332 is merged

Pull-Request: #1508
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

8 years agotests: force compilation of the test error_annot_pkgconfig
Alexis Laferrière [Wed, 17 Jun 2015 16:50:40 +0000 (12:50 -0400)]
tests: force compilation of the test error_annot_pkgconfig

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: skip raspberry pi tests on niti and nitvm
Alexis Laferrière [Wed, 17 Jun 2015 10:56:00 +0000 (06:56 -0400)]
tests: skip raspberry pi tests on niti and nitvm

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: nitvm also skip the mpi_simple test
Alexis Laferrière [Tue, 16 Jun 2015 17:25:35 +0000 (13:25 -0400)]
tests: nitvm also skip the mpi_simple test

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agosrc: fix interpreter FFI to support nitvm
Alexis Laferrière [Tue, 16 Jun 2015 17:05:21 +0000 (13:05 -0400)]
src: fix interpreter FFI to support nitvm

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: make as UNDEFINED tests that break niti at the FFI level
Alexis Laferrière [Tue, 16 Jun 2015 15:25:06 +0000 (11:25 -0400)]
tests: make as UNDEFINED tests that break niti at the FFI level

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: test bad code in nitunits
Jean Privat [Wed, 17 Jun 2015 15:15:05 +0000 (11:15 -0400)]
tests: test bad code in nitunits

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agonitunit: bad code count as code (to avoid more failures that code)
Jean Privat [Wed, 17 Jun 2015 15:12:16 +0000 (11:12 -0400)]
nitunit: bad code count as code (to avoid more failures that code)

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agonitunit: process failures (bad code) before leaving
Jean Privat [Wed, 17 Jun 2015 15:11:42 +0000 (11:11 -0400)]
nitunit: process failures (bad code) before leaving

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agolib/mnit: remove the `is extern` declaration
Alexis Laferrière [Tue, 16 Jun 2015 20:45:52 +0000 (16:45 -0400)]
lib/mnit: remove the `is extern` declaration

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib: update the text group to the light FFI
Alexis Laferrière [Tue, 16 Jun 2015 20:34:01 +0000 (16:34 -0400)]
lib: update the text group to the light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/file: move macros to the light FFI
Alexis Laferrière [Tue, 16 Jun 2015 20:25:04 +0000 (16:25 -0400)]
lib/file: move macros to the light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/file: move implementation code to light FFI
Alexis Laferrière [Tue, 16 Jun 2015 20:23:21 +0000 (16:23 -0400)]
lib/file: move implementation code to light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/file: wrap a long signature and add some space between methods
Alexis Laferrière [Tue, 16 Jun 2015 20:24:33 +0000 (16:24 -0400)]
lib/file: wrap a long signature and add some space between methods

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib: update the math module to use the light FFI
Alexis Laferrière [Tue, 16 Jun 2015 19:57:23 +0000 (15:57 -0400)]
lib: update the math module to use the light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agolib/exec: move the C structure se_exec_data to the light FFI
Alexis Laferrière [Tue, 16 Jun 2015 19:44:39 +0000 (15:44 -0400)]
lib/exec: move the C structure se_exec_data to the light FFI

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

8 years agotests: add sav files for some rosettacode
Jean Privat [Tue, 16 Jun 2015 19:44:09 +0000 (15:44 -0400)]
tests: add sav files for some rosettacode

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agoRosettaCode: Random numbers
Simon Zeni [Wed, 10 Jun 2015 12:42:44 +0000 (12:42 +0000)]
RosettaCode: Random numbers

Close #1466

8 years agorosettacode: cleanup and test guess_the_number.nit
Jean Privat [Tue, 16 Jun 2015 19:26:11 +0000 (15:26 -0400)]
rosettacode: cleanup and test guess_the_number.nit

Signed-off-by: Jean Privat <jean@pryen.org>

8 years agoRosettaCode: Guess the Number
Istvan SZALAI [Wed, 10 Jun 2015 17:57:42 +0000 (13:57 -0400)]
RosettaCode: Guess the Number

Close #1476

Signed-off-by: Istvan SZALAI <szalai972@gmail.com>

8 years agoRosetta Code: added HTML Table
Anis Boubaker [Wed, 10 Jun 2015 18:42:14 +0000 (14:42 -0400)]
Rosetta Code: added HTML Table

Close #1486

8 years agoRosetta Code: added dot_product
Anis Boubaker [Wed, 10 Jun 2015 18:23:21 +0000 (14:23 -0400)]
Rosetta Code: added dot_product

Close #1481

8 years agoRosetta Code: Added Even/Odd
Anis Boubaker [Wed, 10 Jun 2015 17:48:27 +0000 (13:48 -0400)]
Rosetta Code: Added Even/Odd

8 years agoRosettacode: add Tokenizer
Anis Boubaker [Wed, 10 Jun 2015 16:52:53 +0000 (12:52 -0400)]
Rosettacode: add Tokenizer

Close #1475

8 years agotests: blacklist most things from src in nitg-g.skip
Jean Privat [Wed, 17 Jun 2015 13:28:14 +0000 (09:28 -0400)]
tests: blacklist most things from src in nitg-g.skip

Signed-off-by: Jean Privat <jean@pryen.org>