nit.git
9 years agotests: fix errlist
Jean Privat [Thu, 28 Aug 2014 02:37:34 +0000 (22:37 -0400)]
tests: fix errlist

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

9 years agomisc: make public some scripts used by Jenkins
Jean Privat [Thu, 28 Aug 2014 02:16:20 +0000 (22:16 -0400)]
misc: make public some scripts used by Jenkins

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

9 years agoMerge: phase: Do not revisit all annotations for each phase
Jean Privat [Wed, 27 Aug 2014 20:26:49 +0000 (16:26 -0400)]
Merge: phase: Do not revisit all annotations for each phase

Instead of one visit per phase per module, do one single visit per module that collect the nodes.

With the standard `nitg nitg.nit`, the gain is approx 4%. Not so bad.

Pull-Request: #690
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agophase: Do not revisit all annotations for each phase
Jean Privat [Wed, 27 Aug 2014 15:40:58 +0000 (11:40 -0400)]
phase: Do not revisit all annotations for each phase

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

9 years agoMerge: Less char boxings
Jean Privat [Wed, 27 Aug 2014 15:11:16 +0000 (11:11 -0400)]
Merge: Less char boxings

Because of the way the boxing is done in nitg-s, the services in the `Text::chars` view cause unnecessary boxing of chars.

After profiling, we found that the biggest consumers of such boxing are `Lexer::get_token` and `BufferedIStream::read_all`.

Thus, the idea is to implement a efficient `Text::[]` method that do not use the `chars` view. Then to update the two consumers to use it instead.

With `nitg nitg.nit`, the total gain is approx 5%, and the number of boxes of char is reduced by 70% (from 4.8Mboxes to 1.4Mboxes).

Note: this is only an easy workaround until the boxing is done better in nitg (mid-term goal)

Pull-Request: #688
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoMerge: Clean make
Jean Privat [Wed, 27 Aug 2014 15:11:12 +0000 (11:11 -0400)]
Merge: Clean make

The various Makefile need some love. So, a new recipe `full` can be used to build programs from examples and contrib.

The `clean` recipe is also updated to work and clean stuff.

However, some questions:

1. Should the `clean` recipe clean the binaries? I did not fine a definitive answer on the Internet.
2. Should the binaries be .gitignored?

Note: In a near future, Jenkins may also check that all the Makefile, and their `clean` work as expected.

Pull-Request: #687
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agocontrib/sort_downloads: use relative nitg binary
Jean Privat [Wed, 27 Aug 2014 03:42:44 +0000 (23:42 -0400)]
contrib/sort_downloads: use relative nitg binary

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

9 years agoMakefile: clean the clean recipes
Jean Privat [Tue, 26 Aug 2014 17:53:05 +0000 (13:53 -0400)]
Makefile: clean the clean recipes

And remove the useless dist-clean recipe

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

9 years agoparser: Lexer.get_token use String[j] instead of String.chars[]
Jean Privat [Wed, 27 Aug 2014 02:15:47 +0000 (22:15 -0400)]
parser: Lexer.get_token use String[j] instead of String.chars[]

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

9 years agolib/stream: BufferedIStream.read_all use Buffer[j] instead of Buffer.chars[]
Jean Privat [Wed, 27 Aug 2014 02:15:02 +0000 (22:15 -0400)]
lib/stream: BufferedIStream.read_all use Buffer[j] instead of Buffer.chars[]

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

9 years agolib/string: redefine [] for FlatString and FlatBuffer without using chars
Jean Privat [Wed, 27 Aug 2014 02:11:56 +0000 (22:11 -0400)]
lib/string: redefine [] for FlatString and FlatBuffer without using chars

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

9 years agoMakefile: add recipe `full` to build examples and programs.
Jean Privat [Tue, 26 Aug 2014 17:14:39 +0000 (13:14 -0400)]
Makefile: add recipe `full` to build examples and programs.

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

9 years agoexamples/mnit_*: add icon in .gitignore
Jean Privat [Wed, 27 Aug 2014 00:52:45 +0000 (20:52 -0400)]
examples/mnit_*: add icon in .gitignore

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

9 years agoexamples/mnit_*: add Makefile recipe to build svg_to_icons
Jean Privat [Tue, 26 Aug 2014 17:32:51 +0000 (13:32 -0400)]
examples/mnit_*: add Makefile recipe to build svg_to_icons

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

9 years agoleapfrog: add .gitignore
Jean Privat [Wed, 27 Aug 2014 00:49:23 +0000 (20:49 -0400)]
leapfrog: add .gitignore

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

9 years agoleapfrog: fix Makefile
Jean Privat [Tue, 26 Aug 2014 17:33:05 +0000 (13:33 -0400)]
leapfrog: fix Makefile

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

9 years agoonline_ide: add .gitignore
Jean Privat [Wed, 27 Aug 2014 00:48:30 +0000 (20:48 -0400)]
online_ide: add .gitignore

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

9 years agojwrapper: add .gitignore
Jean Privat [Tue, 26 Aug 2014 18:02:55 +0000 (14:02 -0400)]
jwrapper: add .gitignore

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

9 years agonitcc: .gitignore .out files
Jean Privat [Wed, 27 Aug 2014 00:42:10 +0000 (20:42 -0400)]
nitcc: .gitignore .out files

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

9 years agonitcc: generate info files with .out instead of .txt
Jean Privat [Wed, 27 Aug 2014 00:40:02 +0000 (20:40 -0400)]
nitcc: generate info files with .out instead of .txt

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

9 years agogitignore: ingore all bin/ and doc/ in examples/
Jean Privat [Wed, 27 Aug 2014 00:48:01 +0000 (20:48 -0400)]
gitignore: ingore all bin/ and doc/ in examples/

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

9 years agoMerge: lib/standard: optimize Array.to_s
Jean Privat [Tue, 26 Aug 2014 22:56:25 +0000 (18:56 -0400)]
Merge: lib/standard: optimize Array.to_s

Micro-optimized version of Array::to_s based on the results of benchmarks available in PR #685.

`./bin/nitg ./src/nitg.nit`
Before : `15.080 s`
After : `13.928 s`

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

9 years agoMerge: Bench string
Jean Privat [Tue, 26 Aug 2014 22:54:40 +0000 (18:54 -0400)]
Merge: Bench string

Added a few benches for variations of String and Array.
Also added a array_debug module on the same idea as hash_debug (PR #664) to track the use of to_s in Array (other functions may be supported someday if needed).

The UTF-8 benchmarks only work with the no-index version for now.

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

9 years agoMerge: Utf8 strings - noindex
Jean Privat [Tue, 26 Aug 2014 22:53:45 +0000 (18:53 -0400)]
Merge: Utf8 strings - noindex

Added a few features missing from UTF8 Strings without index.

NOTE : It is slow and space-consuming (lots of allocated characters and no GC), however by experimenting a bit (read : force UnicodeChar as a Universal intern class), the performance is surprisingly close to the old ones and the memory-use becomes acceptable once again :
* < 10% loss for iteration (with iterator, not index, this is much slower) and concat
* substring is slower by a significant margin (75%), however considering the cost of the ancient one (close to none), I guess this is still acceptable.

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

9 years agotests: Update tests for conformance with modifications.
Lucas Bajolet [Tue, 26 Aug 2014 19:56:04 +0000 (15:56 -0400)]
tests: Update tests for conformance with modifications.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/standard/string: Array.to_s micro-optimization
Lucas Bajolet [Tue, 26 Aug 2014 18:27:57 +0000 (14:27 -0400)]
lib/standard/string: Array.to_s micro-optimization

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/standard/array: new NativeArray/NativeString are now usable everywhere.
Lucas Bajolet [Tue, 26 Aug 2014 18:32:46 +0000 (14:32 -0400)]
lib/standard/array: new NativeArray/NativeString are now usable everywhere.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/array_debug: Added array_debug module to keep stats on Array use in a program.
Lucas Bajolet [Tue, 26 Aug 2014 14:40:12 +0000 (10:40 -0400)]
lib/array_debug: Added array_debug module to keep stats on Array use in a program.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agobenchmarks/string: Added benchmark for Array.to_s
Lucas Bajolet [Thu, 21 Aug 2014 19:23:59 +0000 (15:23 -0400)]
benchmarks/string: Added benchmark for Array.to_s

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoc_src: Fix uname in Makefile
Jean Privat [Tue, 26 Aug 2014 15:28:02 +0000 (11:28 -0400)]
c_src: Fix uname in Makefile

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

9 years agoMerge: New constructors
Jean Privat [Tue, 26 Aug 2014 00:55:47 +0000 (20:55 -0400)]
Merge: New constructors

A very long development for a very important but experimental feature: the new-style constructors.

Most of the cleaning and other stuff was committed under interdependent PR.
So what remain here is the hardcore fundamental stuff.

I didn't find a simple way to have nice commits. So I went for some kind of incremental features.

## First commit

It is the worse since it introduces the new-style constructors in the model, semantic analysis and engines.

With the new-style constructors, the point is to understand that the syntax `var a = new A(some_b)` is in fact the following sequence

~~~
var a = ALLOC_INSTANCE(A)
a.b=(some_b)
a.init()
~~~

Where the `a.b=` part is a standard method call for the accessor `b=`.
Therefore, each constructor has a sequence of methods to call, they are called `initializers`.
Since redefinitions of constructor can provide different initializers, the initializers are attached to the MMethodDef class.

Because of this, a MMethodDef for a new-style constructor has two signatures, the real empty msigntature seen by the programmer that implements the constructor, and the one seen by the programmer that uses it to instantiate objects trough `new`, so called `new_msignature`.

~~~
class A
  var b: B
  # here, an implicit init, with, by rule of inheritance, the empty signature
end
var a = new A(some_b) # here the `new` takes a single B
~~~

Note that the `new_msignature` has to be conform with the `inititializers` since the arguments of the `new` are used for the invocations of the inititializers.

Modules `modelize_property` (and `auto_super_init` in a lesser extend) is modified to use new-style constructors for the default/automatic/free/implicit constructors.
Explicit constructors (named or not) use the old-style-constructors.
The code in these two modules is quite complex because it has to deal with the various implicit combinations of the old-style and new-style constructors.

For the engines (and rta), modifications are made to handle correctly the implementations of:

1. the invocation of the new-style constructors. by invoking each initializer, and
2. the implicit body of the new-style default/automatic/free/implicit constructors; they do just a call to super since the initializations of the attributes is done outside the init: in the sequence code of the new.

While user-defined constructor is not present in this commit, all the implicit init are converted.
The boostrap still works, and most tests pass.

## Second commit

Just introduce (and use) the annotation `old_style_init` that is used to mark explicit constructors to use the old semantic (and implementation).
The annotation can be put on a single `init`, or on the whole module.

## Third commit

'simple' `init` are those defined without name nor parameters (and that are public).
They are converted to the new-style constructors.
This is just magic because things, like the boostrap and most tests, still work as expected.

Now, programmers can use the default init and get the initializers automatically called.
Basically, instead of writing

~~~
class A
  var b: B
  init(b: B)
  do
    self.b = b
    rest_of_init
  end
end
var a = new A(some_b)
~~~

just write

~~~
class A
  var b: B
  init
  do
    rest_of_init
  end
end
var a = new A(some_b) # Same client, but less code in the A class
~~~

And simple subclasses get easier

~~~
class SubA
  super A
  var c: C
  init
  do
    some_other_stuff
  end
end
var sa = new SubA(some_b, some_c)
# Done in order:
# 1. set b
# 2. set c
# 3. rest_of_init
# 4. some_other_stuff
~~~

## Fourth commit

Update existing tests.

## Last commit

add a new test that illustrates combination and the linearization of the simple init

## What is next?

### User-definer initializers

Conflict on initializers are detected, but currently there is no simple way for the used to define its own sequence of initializers.

* what syntax to use? something like `init is initializers(a,b,c) do ...`?
* what rules? are any sequence allowed?

### Not-simple constructors

The status of the constructors that remains is still unclear.

* named constructors are the simpler case since the proposed specification want to have them working like standard method but usable with a new. In fact, they will behave as a simple version of the old-style-constructors, with less shenanigans.
* init with parameters, still accepted for compatibility but they should be migrated. If not migratable, more investigation and thinking will be required
* private init. Since the root `init` of Object is public, subclasses cannot change its visibility. So how to indicate that a class cannot be instantiated publicly? Again, more investigation and thinking.

Pull-Request: #679
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agotests: add base_init_basic.nit
Jean Privat [Wed, 20 Aug 2014 01:43:12 +0000 (21:43 -0400)]
tests: add base_init_basic.nit

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

9 years agotests: update to pass tests
Jean Privat [Wed, 20 Aug 2014 00:52:23 +0000 (20:52 -0400)]
tests: update to pass tests

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

9 years agomodelize_property: simple inits are new-style
Jean Privat [Wed, 20 Aug 2014 00:37:50 +0000 (20:37 -0400)]
modelize_property: simple inits are new-style

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

9 years agoMerge: tests: do not check whitespace errors in *.res files
Jean Privat [Mon, 25 Aug 2014 17:01:13 +0000 (13:01 -0400)]
Merge: tests: do not check whitespace errors in *.res files

Pull-Request: #682
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agostring_exp/utf8_noindex: Update README
Lucas Bajolet [Mon, 25 Aug 2014 16:47:04 +0000 (12:47 -0400)]
string_exp/utf8_noindex: Update README

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/string_exp/utf8_noindex: Access is now done from the nearest point of insertion...
Lucas Bajolet [Mon, 25 Aug 2014 16:43:09 +0000 (12:43 -0400)]
lib/string_exp/utf8_noindex: Access is now done from the nearest point of insertion (begin, end or cache)

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agotests: do not check whitespace errors in *.res files
Jean Privat [Sat, 23 Aug 2014 19:59:09 +0000 (15:59 -0400)]
tests: do not check whitespace errors in *.res files

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

9 years agoMerge: Intro `user/group_exists` and apply a few small fixes
Jean Privat [Sat, 23 Aug 2014 19:49:58 +0000 (15:49 -0400)]
Merge: Intro `user/group_exists` and apply a few small fixes

Pull-Request: #678
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/curl: use more precise return types
Alexis Laferrière [Fri, 18 Jul 2014 16:01:08 +0000 (12:01 -0400)]
lib/curl: use more precise return types

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

9 years agobench/strings: Added bench for UTF-8 strings without index
Lucas Bajolet [Mon, 18 Aug 2014 17:22:07 +0000 (13:22 -0400)]
bench/strings: Added bench for UTF-8 strings without index

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agosrc: new annotation old_style_init
Jean Privat [Wed, 20 Aug 2014 00:36:41 +0000 (20:36 -0400)]
src: new annotation old_style_init

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

9 years agosrc: introduce new constructors
Jean Privat [Tue, 19 Aug 2014 23:53:37 +0000 (19:53 -0400)]
src: introduce new constructors

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

9 years agolib/privileges: prevent seg faults with asserts and require in doc
Alexis Laferrière [Fri, 1 Aug 2014 23:19:44 +0000 (19:19 -0400)]
lib/privileges: prevent seg faults with asserts and require in doc

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

9 years agolib: intro `user_exists` and `group_exists`
Alexis Laferrière [Fri, 1 Aug 2014 23:19:08 +0000 (19:19 -0400)]
lib: intro `user_exists` and `group_exists`

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

9 years agosendmail: fix missing empty line between header and body
Alexis Laferrière [Wed, 6 Aug 2014 17:45:22 +0000 (13:45 -0400)]
sendmail: fix missing empty line between header and body

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

9 years agoMerge: Auto super init call next method
Jean Privat [Tue, 19 Aug 2014 00:33:07 +0000 (20:33 -0400)]
Merge: Auto super init call next method

If one redefines a constructor in a subclass (a real redefinition, not just a look-alike init with the same name) the auto-super-init phase automatically inserted a call to a compatible constructor in the super-class, so a call to itself, so a fatal infinite recursive call :/

It is an old bug, but nobody did real redefinitions of constructors, except that it will be the norm with the new constructors. So just let solve the bug now, before people start to complain.

Pull-Request: #676
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agolib/string_exp/utf8_noindex: Added cache for last access.
Lucas Bajolet [Mon, 18 Aug 2014 15:59:07 +0000 (11:59 -0400)]
lib/string_exp/utf8_noindex: Added cache for last access.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/string_exp/utf8_noindex: Added two-way iterators for FlatString
Lucas Bajolet [Mon, 18 Aug 2014 15:08:35 +0000 (11:08 -0400)]
lib/string_exp/utf8_noindex: Added two-way iterators for FlatString

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: introduce Sequence::prepend
Jean Privat [Mon, 18 Aug 2014 13:11:17 +0000 (09:11 -0400)]
Merge: introduce Sequence::prepend

How could people live without having a working prepend?

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

9 years agotests: add base_init_super_call3.nit and it does not stack-overflow
Jean Privat [Sat, 16 Aug 2014 01:09:21 +0000 (21:09 -0400)]
tests: add base_init_super_call3.nit and it does not stack-overflow

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

9 years agoauto_super_init: handle the case of constructors redefinition (instead of infinitivel...
Jean Privat [Sat, 16 Aug 2014 01:07:03 +0000 (21:07 -0400)]
auto_super_init: handle the case of constructors redefinition (instead of infinitively recurse)

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

9 years agotests: update sav/test_new_native_alt1.res because of changes in array.nit
Jean Privat [Sat, 16 Aug 2014 00:41:20 +0000 (20:41 -0400)]
tests: update sav/test_new_native_alt1.res because of changes in array.nit

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

9 years agoMerge: Prepare for new constructors
Jean Privat [Fri, 15 Aug 2014 21:21:39 +0000 (17:21 -0400)]
Merge: Prepare for new constructors

With new constructors, attributes without default value are considered even if a constructor is present.

So, while ugly, the following code is currently working.
~~~
class A
   var attr: Attr
   init do attr = new Attr(foo)
end
var a = new A
~~~

With the new constructors, the attribute `attr` will be part of the signature of the new,

~~~
var a = new A # Error, expected one argument `attr: Attr`
~~~

So this series do some cosmetic changes to accommodate the future new constructors.
Most of these change make senes own their own since they:

* reduce the number of lines by removing useless init
* clarify the behavior of some attributes by adding a default value or a `noinit` annotation

More precisely, easy cases of the previous code is usually migrated into

~~~
class A
   var attr = new Attr(foo)
end
var a = new A
~~~

And complex cases into

~~~
class A
   var attr: Attr is noinit
   init do attr = new Attr(foo)
end
var a = new A
~~~

The few remaining very complex cases (ex parser) will be migrated latter, and a temporally new annotation `old_style_init` may be created for them.

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

9 years agoMerge: Annotation `nosuper` to avoid automatic super call in constructors
Jean Privat [Fri, 15 Aug 2014 21:21:36 +0000 (17:21 -0400)]
Merge: Annotation `nosuper` to avoid automatic super call in constructors

A super-init-call is automatically added in constructors that do not invoke one (a la java)
But sometimes one may want to avoid calling a super-init.

Before, this could be done with a dead super

~~~
init do
  if false the super # a super is present, so no additional implicit super-init
  rest
end
~~~

Now, one can just write

~~~
init is nosuper do
   rest
end
~~~

that is more KISS I think.

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

9 years agoMerge: Fixes for supercalls
Jean Privat [Fri, 15 Aug 2014 21:21:34 +0000 (17:21 -0400)]
Merge: Fixes for supercalls

A bug was found while working on the new constructors.

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

9 years agolib: add Seq:prepend as an alias of `insert_all(0)`
Jean Privat [Fri, 15 Aug 2014 19:56:27 +0000 (15:56 -0400)]
lib: add Seq:prepend as an alias of `insert_all(0)`

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

9 years agolib: add Seq:insert_all as a generalized `insert`
Jean Privat [Fri, 15 Aug 2014 19:55:50 +0000 (15:55 -0400)]
lib: add Seq:insert_all as a generalized `insert`

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

9 years agolib: make Seq::append an alias of add_all (instead of relying on an inefficient defau...
Jean Privat [Fri, 15 Aug 2014 19:54:52 +0000 (15:54 -0400)]
lib: make Seq::append an alias of add_all (instead of relying on an inefficient default implementation)

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

9 years agotests: update sav for modified files
Jean Privat [Fri, 15 Aug 2014 10:54:00 +0000 (06:54 -0400)]
tests: update sav for modified files

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

9 years agotests: prepare for new constructors
Jean Privat [Fri, 15 Aug 2014 10:46:28 +0000 (06:46 -0400)]
tests: prepare for new constructors

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

9 years agosrc: prepare for new constructors
Jean Privat [Fri, 15 Aug 2014 10:25:35 +0000 (06:25 -0400)]
src: prepare for new constructors

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

9 years agocontrib: prepare for new constructors
Jean Privat [Fri, 15 Aug 2014 10:22:53 +0000 (06:22 -0400)]
contrib: prepare for new constructors

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

9 years agolib: prepare for new constructors
Jean Privat [Fri, 15 Aug 2014 10:21:22 +0000 (06:21 -0400)]
lib: prepare for new constructors

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

9 years agotests: add base_init_nosuper.nit
Jean Privat [Fri, 15 Aug 2014 02:34:41 +0000 (22:34 -0400)]
tests: add base_init_nosuper.nit

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

9 years agoauto_super_init: add annotation `nosuper`
Jean Privat [Fri, 15 Aug 2014 02:32:04 +0000 (22:32 -0400)]
auto_super_init: add annotation `nosuper`

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

9 years agoMerge: nitgg: use is_toplevel instead of heuristics to not customize top-level methods
Jean Privat [Fri, 15 Aug 2014 02:12:58 +0000 (22:12 -0400)]
Merge: nitgg: use is_toplevel instead of heuristics to not customize top-level methods

Pull-Request: #671
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: phase: remove a useless verbose line
Jean Privat [Fri, 15 Aug 2014 02:12:56 +0000 (22:12 -0400)]
Merge: phase: remove a useless verbose line

Was called nb_classdefs*nb_phases times, so approximatively 50.000 for nitg.
Without it, the gain is 6% in compiling nitg

Pull-Request: #670
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agorta: `add_super_send` uses live_classes instead of live_types
Jean Privat [Thu, 14 Aug 2014 17:38:49 +0000 (13:38 -0400)]
rta: `add_super_send` uses live_classes instead of live_types

Otherwise, some not-yet-resolved open types can be forgot.

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

9 years agosrc: add some asserts on `super` related things
Jean Privat [Thu, 14 Aug 2014 17:37:00 +0000 (13:37 -0400)]
src: add some asserts on `super` related things

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

9 years agophase: remove a useless verbose executed
Jean Privat [Thu, 14 Aug 2014 01:50:38 +0000 (21:50 -0400)]
phase: remove a useless verbose executed

Was called nb_classdefs*nb_phases times, so approximatively 50.000 for nitg.
Without it, the gain is 6% in compiling nitg

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

9 years agonitgg: use is_toplevel instead of heuristics to not customize top-level methods
Jean Privat [Thu, 14 Aug 2014 00:25:12 +0000 (20:25 -0400)]
nitgg: use is_toplevel instead of heuristics to not customize top-level methods

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

9 years agoMerge: lib: introduce module hash_debug
Jean Privat [Wed, 13 Aug 2014 20:31:00 +0000 (16:31 -0400)]
Merge: lib: introduce module hash_debug

Nit-exclusivity thanks to class refinements, intrude imports and the control of the main function.

Inject behavior analysis to hash-collections (HashMap, HashSet, etc.)
Accesses to hash collections are instrumented, and statistics are automatically displayed at the end of the program.

This module helps to detect, and track bad behavior on hash-collections, especially collisions.

Simple usage:

1. compile your program with `-m hash_debug`
2. execute your program.

Advanced usage:

import `hash_debug` and use the functions `Sys::show_hash_stats` and `Sys::clear_hash_stats` at strategic points.

You can also use some dynamic call-graph tools (like valgrind) and look at callers of `HashCollection::gt_collide` and `HashCollection::st_collide`.

Pull-Request: #664
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Deserialize generics with nitserial
Jean Privat [Wed, 13 Aug 2014 20:30:15 +0000 (16:30 -0400)]
Merge: Deserialize generics with nitserial

nitserial compiles a Nit module after analyzing a Nit program. This module can then be compiled with the program (possibly using `-m`) to support deserializing any alive generic type. Many generated module can be used to support different libraries with hidden serialization logic, or to support exchanges between a client and a server.

Will be used by the RESTful interface of Benitlux.

Pull-Request: #650
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agoMerge: cleanup --no-check-*
Jean Privat [Wed, 13 Aug 2014 20:30:12 +0000 (16:30 -0400)]
Merge: cleanup --no-check-*

Some people like to live dangerously, they unplug their usb stick without unmounting, they write long comments in a textbox in a browser, they eat pasta with a white t-shirt.
Now, they can also `--no-check-all` to disable all runtime-tests and sweat pure adrenaline.

Some numbers, because people like numbers: `--no-check-all` gives a small 6% boost for compiling nitg.
(for reference, --semi-global is a 20% boost).

Pull-Request: #665
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Optimize usage of the chars of a string
Jean Privat [Wed, 13 Aug 2014 20:29:53 +0000 (16:29 -0400)]
Merge: Optimize usage of the chars of a string

* The first commit, on `html_escape`, improves nitdoc execution on RnR by about 10s, or 6%.
* The second commit _theorically_ improves access to the chars of strings. It _worsen_ the execution of nitdoc on RnR by about 9s.

The overall gain on this specific use case is of 1s. Obviously this PR is not to be merged as is!

Pull-Request: #663
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agotests: nitg-e doesn't know the full type of generics, expect the error
Alexis Laferrière [Thu, 7 Aug 2014 16:18:44 +0000 (12:18 -0400)]
tests: nitg-e doesn't know the full type of generics, expect the error

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

9 years agotests: test a module generated by `nitserial`
Alexis Laferrière [Wed, 6 Aug 2014 17:19:54 +0000 (13:19 -0400)]
tests: test a module generated by `nitserial`

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

9 years agotests: test nitserial itself
Alexis Laferrière [Wed, 6 Aug 2014 15:20:57 +0000 (11:20 -0400)]
tests: test nitserial itself

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

9 years agotests: extend test_deserialization with generics
Alexis Laferrière [Wed, 18 Jun 2014 17:07:07 +0000 (13:07 -0400)]
tests: extend test_deserialization with generics

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

9 years agonitserial: intro a support tool to deserialize generic types
Alexis Laferrière [Sun, 20 Jul 2014 18:46:29 +0000 (14:46 -0400)]
nitserial: intro a support tool to deserialize generic types

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

9 years agolib/json_serialization: support Arrays
Alexis Laferrière [Wed, 18 Jun 2014 17:01:15 +0000 (13:01 -0400)]
lib/json_serialization: support Arrays

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

9 years agolib/string: use indexed access to chars instead of iterators
Alexis Laferrière [Tue, 12 Aug 2014 21:11:38 +0000 (17:11 -0400)]
lib/string: use indexed access to chars instead of iterators

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

9 years agocomp: add --no-check-all
Jean Privat [Wed, 13 Aug 2014 14:12:59 +0000 (10:12 -0400)]
comp: add --no-check-all

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

9 years agocomp: rename --no-check-other to --no-check-null, because it is what it does
Jean Privat [Wed, 13 Aug 2014 14:02:35 +0000 (10:02 -0400)]
comp: rename --no-check-other to --no-check-null, because it is what it does

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

9 years agonitgg: correclty disable attr check with --no-check-attr-isset
Jean Privat [Wed, 13 Aug 2014 13:59:08 +0000 (09:59 -0400)]
nitgg: correclty disable attr check with --no-check-attr-isset

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

9 years agoMerge: Ai search
Jean Privat [Wed, 13 Aug 2014 13:47:48 +0000 (09:47 -0400)]
Merge: Ai search

Second part of the ai library. now with astar (and other search algos)

Look a puzzle.nit for a simple example of usage.

Pull-Request: #660
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Intent: An android API to launch activities and services
Jean Privat [Wed, 13 Aug 2014 13:47:27 +0000 (09:47 -0400)]
Merge: Intent: An android API to launch activities and services

New API for `lib/android` allowing to start/stop activities and services. Intent tests raised new subtle errors in `Bundle`API and `Audio` API that have been fixed in this PR.

Pull-Request: #644
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agoMerge: UTF-8 Strings without index
Jean Privat [Wed, 13 Aug 2014 13:47:16 +0000 (09:47 -0400)]
Merge: UTF-8 Strings without index

Another WIP version of UTF-8 Strings, without indexing this time.

This is more likely to become the final implementation, depending on the performance of it. I'll add benches for the versions of UTF-8 to examine their impact and decide a bit later.

This implementation being less rigid than the other, more of the API is supported, still, more work needs to be done.

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

9 years agoMerge: Memcpy -> memmove
Jean Privat [Wed, 13 Aug 2014 13:46:50 +0000 (09:46 -0400)]
Merge: Memcpy -> memmove

As discussed in #655, this PR replaces the uses of memcpy in standard by memmove, a safer alternative while not costing that much more.

Before : 0m15.584s
After : 0m15.748s

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

9 years agoMerge: Finalizing Nit objects on garbage collection
Jean Privat [Wed, 13 Aug 2014 13:46:43 +0000 (09:46 -0400)]
Merge: Finalizing Nit objects on garbage collection

Rules for finalizable objects:

* They must be a standard Nit class (not an extern, nor a universal).
* They must not have any cycles, or else they won't be finalized.
* In practice, they should be used on small Nit objects acting as a thin layer around a resource. In other words, it is to be used in the Nity layer.
* `finalize` may be invoked more than once, and the underlying resources may also be used by other instances. This must be considered when implementing `finalize`.
* The finalizer will be called on garbage collection. It can be forced with `sys.force_garbage_collection`.
* When attempting to aquire a limited resource (for example, a file description) if you hit the limit, it is a good practice to force the garbage collection and try again.

Pull-Request: #659
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib: introduce module hash_debug
Jean Privat [Wed, 13 Aug 2014 03:17:00 +0000 (23:17 -0400)]
lib: introduce module hash_debug

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

9 years agolib/android: Removed deprecated `super Serializable`
Frédéric Vachon [Tue, 5 Aug 2014 18:02:19 +0000 (14:02 -0400)]
lib/android: Removed deprecated `super Serializable`

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib/android: Fixes audio module tests
Frédéric Vachon [Tue, 5 Aug 2014 02:10:30 +0000 (22:10 -0400)]
lib/android: Fixes audio module tests

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib/android: Bundle API JNI error fix
Frédéric Vachon [Tue, 5 Aug 2014 01:10:02 +0000 (21:10 -0400)]
lib/android: Bundle API JNI error fix

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib/android: Added Intent API tests to mnit_simple
Frédéric Vachon [Mon, 4 Aug 2014 23:51:09 +0000 (19:51 -0400)]
lib/android: Added Intent API tests to mnit_simple

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib: use a simple iteration in `html_escape` and move to `string`
Alexis Laferrière [Tue, 12 Aug 2014 21:05:14 +0000 (17:05 -0400)]
lib: use a simple iteration in `html_escape` and move to `string`

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

9 years agotests: test finalization effect
Alexis Laferrière [Fri, 8 Aug 2014 23:18:45 +0000 (19:18 -0400)]
tests: test finalization effect

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

9 years agonitg & lib: intro `Finalizable` to be called when an object is freed
Alexis Laferrière [Fri, 8 Aug 2014 23:18:20 +0000 (19:18 -0400)]
nitg & lib: intro `Finalizable` to be called when an object is freed

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

9 years agolib/ai: add the n-puzzle problem as an example of search
Jean Privat [Mon, 11 Aug 2014 19:09:35 +0000 (15:09 -0400)]
lib/ai: add the n-puzzle problem as an example of search

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