Giter VIP home page Giter VIP logo

k7's People

Contributors

gritzko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

k7's Issues

lib/core/extend/extend.cpp:18: error: ‘EXTEND_JS’ was not declared in this scope

Traceback (most recent call last):
  File "tools/js2h", line 25, in <module>
    for c in jsmin.jsmin(f.read()):
AttributeError: 'module' object has no attribute 'jsmin'
g++  -DK7_VERSION=20100617 -g -DSTATIC -DWITH_LIBTASK -DWITH_LIBNODE -DEV_MULTIPLICITY=0 -Ideps/v8/include -Isrc -Ideps -Ideps/node -Ideps/node/src -Ideps/node/deps/coupling  -Ideps/node/deps/evcom -Ideps/node/deps/http_parser -Ideps/node/deps/libeio -Ideps/node/deps/libev -Ideps/node/deps/udns -Ideps/node/build/default/src -Ibuild/include/core/extend/ -c lib/core/extend/extend.cpp -o build/core/extend/extend.o
lib/core/extend/extend.cpp: In function ‘v8::Handle<v8::Object> core_extend(v8::Handle<v8::Object>)’:
lib/core/extend/extend.cpp:18: error: ‘EXTEND_JS’ was not declared in this scope
make: *** [build/core/extend/extend.o] Error 1

shell: Add nice traceback / exception handling

Right now, when a script fails we don't have a lot of useful information. For instance, running Narwhal leads to this:

./bin/narwhal
native runtime.js:160: TypeError: boolean is not a function
throw %MakeTypeError('called_non_callable', [typeof callee]);
^

While we'd like to have full traceback. This is very likely doable using K7, and quite important as otherwise debugging is hard. Maybe have a look at the D8 scripts shipped with V8.

modules: lazy initialization

Only initialize modules when they are actually referenced... if that's possible. This would allow to load K7 as fast as possible.

libevent: does not work with libevent 1

Libevent 1 is the default on most systems. If libevent 2 is better, then we should ship it with K7 and embed it in the deps so that it gets compiled as a dependency and then statically linked.

I'd personnaly prefer that the event module uses libevent1 by default and then has an option to use libevent2.

Argument macros

Old-style parameter macros look ugly when instantiated in big numbers, allow an unnecessary degree of freedom (parameter indexes).

#define ARG_obj(v,i)  v8::Local<v8::Object> v=args[i]->ToObject();

leads to
ARG_COUNT(4);
ARG_utf8(data,0);
ARG_int(size,1);
ARG_int(nmemb,2);
ARG_obj(fileObj,3);

ARGINT-style macros may add too much overhead.

Need a new syntax, e.g.
FUNCTION(some_function, P_int(a), P_str(b), P_obj(c)) {
// a will be an int, b will be a str and c will be an obj
} END
plus pluggable error processing code, e.g.
#define ARGS_INVALID return JS_undefined;

Add feature to monitor the execution

Maximum execution time
Maximum memory consumption


Script termination from the side has now been added to V8. Look for
the TerminateExecution methods in the API and have a look at the
test/cctest/test-thread-termination.cc test file for examples of using
it.

Remove python & scons dependencies from the k7 makefile

To me, having python & scons required to build k7 (and v8) is barrier to making k7 more portable. To remove, python & scons, the following is needed:

  • A little bit of OS & CPU (uname) to pick the right platform files for v8
  • Some makefile magic to do the libraries-empty.cc => libraries.cc compilation from the v8 JS library files
  • js2h python script replaced by a C/C++ file and jsmin.c from http://www.crockford.com/javascript/jsmin.html

I have some notes on this and was working on this in a private tree.

libevent: Segfault on tests/module-system- event.js

With latest version of K7, I get a segfault when executing

./k7 tests/module-system- event.js
bound!

event added fd 5
yep,added

expected err: Error: Operation now in progress

connected

event added fd 6
Uncaught exception: Error: Invalid argument
Segmentation fault

With gdb output

[Switching to Thread 0xb796f6f0 (LWP 30101)]
0xb7ce6613 in strlen () from /lib/tls/i686/cmov/libc.so.6
(gdb) backtrace
#0 0xb7ce6613 in strlen () from /lib/tls/i686/cmov/libc.so.6
#1 0x08066264 in v8::String::New ()
#2 0xbfd8d1ec in ?? ()
#3 0x08076441 in v8::internal::Builtin_HandleApiCall ()
#4 0x00000001 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

modules: add find, load and reload core functions

K7 should offer primitive for accessing and manipulating modules (in plain C++):

  • find(moduleName): finds the .js or .so representing the module in one of the K7_PATH dirs
  • load(modulePath): loads the .js or .so module at the given location
  • reload(modulePath): reloads the .js or .so module at the given location

Rewrite macros to be more C/C++ like

I'd like to be able to write glue code in a manner similar to this.

OBJECT( posix_FILE, 1, FILE* file )

{

OBJECT_SCOPE_START();

OBJECT_INTERNAL_SETUP( 1 );

INTERNAL( 0, file );

return( self );

};

FUNCTION( posix_fputs )

{

SCOPE_START();

ARG_utf8( str, 0 );

ARG_obj( fObj, 1 );

EXTERNAL( FILE*, file, fObj, 0 );

return( JS_int( fputs( *str, file ) ) );

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.