Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: BESEN - A complete ECMAScript 5th edition implementation with a JIT

  1. #11

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    After testing BESEN a bit, I'm still impressed with your work. Thanks for adding support for FPC 2.4.0.

    It works without any problems on my Windows machine, but unfortunately I'm having some issues getting it to work on a Mac.
    First off, you something like this
    [pascal]
    {$ifdef fpc}
    {$ifdef darwin}
    {$pic off}
    {$endif}
    ...
    [/pascal]
    since -fPic switch is set by default when compiling on a Mac.

    BESEN loads dynamically from libc.so. Well, libc.so doesn't exist on Mac, it's called libc.dylib. So around line 41287 please change it to following:
    [pascal]
    {$ifdef darwin}
    fpmprotect:=dlsym(dlopen('libc.dylib',RTLD_NOW),'m protect');
    {$else}
    fpmprotect:=dlsym(dlopen('libc.so',RTLD_NOW),'mpro tect');
    {$endif}
    [/pascal]

    With those two changes it compile and BESENTest will at least start when being executed, but as soon as I load any script into the sample, I get this error:
    Code:
    Exception object An unhandled exception occurred at $00043114 :
    Illegal instruction

    I would love to see some more examples especially in regards on how to integrate BESEN into existing applications, like how to access certain aspects of the application from the script and vice versa.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  2. #12

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    Quote Originally Posted by Stoney
    After testing BESEN a bit, I'm still impressed with your work. Thanks for adding support for FPC 2.4.0.
    But support for 2.4.0 is only inoffically For example the 64-bit x64/AMD64 codegenerator of FPC 2.4.0 was/is very buggy, so BESEN compiles there only with -O1 or without any code optimizations.

    Quote Originally Posted by Stoney
    It works without any problems on my Windows machine, but unfortunately I'm having some issues getting it to work on a Mac.
    First off, you something like this
    [pascal]
    {$ifdef fpc}
    {$ifdef darwin}
    {$pic off}
    {$endif}
    ...
    [/pascal]
    since -fPic switch is set by default when compiling on a Mac.

    BESEN loads dynamically from libc.so. Well, libc.so doesn't exist on Mac, it's called libc.dylib. So around line 41287 please change it to following:
    [pascal]
    {$ifdef darwin}
    fpmprotect:=dlsym(dlopen('libc.dylib',RTLD_NOW),'m protect');
    {$else}
    fpmprotect:=dlsym(dlopen('libc.so',RTLD_NOW),'mpro tect');
    {$endif}
    [/pascal]
    Fixed

    Quote Originally Posted by Stoney
    With those two changes it compile and BESENTest will at least start when being executed, but as soon as I load any script into the sample, I get this error:
    Code:
    Exception object An unhandled exception occurred at $00043114 :
    Illegal instruction
    Try the new BESEN.pas from the Sourceforge SVN with -dDisableJIT to disable the JIT testwise, and say me then, if it had work or not. The JIT stuff works at least under Windows and LInux with FPC 2.5.1 and Delphi 7 + Kylix.

    Quote Originally Posted by Stoney
    I would love to see some more examples especially in regards on how to integrate BESEN into existing applications, like how to access certain aspects of the application from the script and vice versa.
    Yeah, this example stuff comes later.



  3. #13

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    Unfortunately I didn't work with the DisableJIT switch. I still get the same error
    Also when I recompile the latest SVN sources I get
    Code:
    BESEN.pas(19,24) Fatal: Internal error 200208151
    Fatal: Compilation aborted
    Only if I do a clean build (delete all *.o and *.ppu) compilation works without problems.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  4. #14

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    Quote Originally Posted by Stoney
    Unfortunately I didn't work with the DisableJIT switch. I still get the same error
    Also when I recompile the latest SVN sources I get
    Code:
    BESEN.pas(19,24) Fatal: Internal error 200208151
    Fatal: Compilation aborted
    Only if I do a clean build (delete all *.o and *.ppu) compilation works without problems.
    Which CPU target? 32-bit x86, 64-bit x64/AMD64, PowerPC, etc.?

    Maybe you can try to remove the Set8087CW($133f); stuff from the BESENTest.dpr. Or otherwise try to get the exact code line, where the "Illegal instruction" is triggered with the -g parameter to the FPC compiler to generate debug infos for GDB. and then run "./gdb --args ./BESENTEST.dpr myfile.js", type run, and check the output.

    Anyway a new version is on the SVN again, some bugs in the RegEx Stuff fixed.






  5. #15

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    BESEN.pas(19,24) Fatal: Internal error 200208151
    Actually this exception happens with the latest SVN version on all Lazarus/FPC 2.4.1 builds. Not sure exactly what it is, but I know it has to do with Inlining (http://bugs.freepascal.org/view.php?id=15909) typically.

    I posted this to the mail group as well, but I finally started playing with BESEN. Great, excellent, amazing work! Except...

    I want to import existing objects that do not inherit from TBESENNativeObject and some that do, and make them accessible to (some/all of) the running scripts . I found that you can register the prototype for a TBESENNativeObject via RegisterNativeObject, but can't figure out how to register the actual instance (btw: how can you create a proper instance of a TBESENNativeObject without passing in the BESEN base?) I'm guessing this is done via RegisterNativeFunction for instances that derive from TBESENNativeObject, but can't figure out the exact details.

    So, in short, lets say I have a playing field that has "smart objects" placed on it. Each object has a script assigned to it, and there is a global master script that needs access to these objects as well. How do I achieve this?

    This brings me to a great example app that could be put together: Tic-Tac-Toe. Two separate AI scripts loaded and one "master" script loaded. Each AI gets ran for 1 turn, then the master gets ran to check game state and report back. The game board is a standard object and each "player" is a TBESENNativeObject.

    This would should most scenarios where you need to interface with existing and custom objects.

    Thanks, and hopefully someone is still reading this thread,
    - Jeremy

  6. #16

    Re: BESEN - A complete ECMAScript 5th edition implementation with a JIT

    BESEN.pas(19,24) Fatal: Internal error 200208151
    PPS: If you want to get rid of the error building with Lazarus on the latest version, change line 160 to:
    Code:
     {.$define caninline}
    This removes the inlining (slowing down execution a bit) and lets you do a regular build with no exceptions.

    - Jeremy

  7. #17
    BESEN is moved to Google Code http://code.google.com/p/besen/ now. And it's also relicensed as LGPL with static-link-exception now.

  8. #18
    Any special reason to move to Google code? Many people are doing it nowadays.

  9. #19
    Quote Originally Posted by Rodrigo Robles View Post
    Any special reason to move to Google code? Many people are doing it nowadays.
    The reasons:

    1. The SourceForge servers are often very slow, even with my 64mbit/s down 5mbit/s up internet connection here in Germany. Google's server are simply reaction-faster and better load-balanced.
    2. The whole GoogleCode site (the enduser site backend and the admin web interface) is more cleaner and better usable than SourceForge. And GoogleCode has a nice Wiki integration, what is somewhat better than the stuff at SourceForge, at least for my usage.
    3. SourceForge forces an additional SSH Layer for R/W SVN Connections over Putty/TortoisePLink under Windows as TortoiseSVN user (and without a option to save the SVN user password, argh omg ), if you upgrade to their new platform version, what I've did, but what was a mistake from me at the end. Short: The SVN usage at GoogleCode is better than at SourceForge. And if you're on SF, then don't upgrade to their new platform version, at least, if you're using a SVN repo for your project.
    4. And some other smaller not-so-important reasons.

  10. #20
    Looks like Sourceforge will lose their position soon...

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •