• Create Account

## AngelScript 1.10.1 WIP 3 (2004/11/11)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

10 replies to this topic

### #1Andreas Jonsson  Moderators

Posted 07 November 2004 - 02:42 AM

I've released the next WIP with the following changes:
* Bug fixes
* The -> operator didn't compile correctly (thanks Adrian Licu)
* If the ?: operator returned literal constants there was an assert failure (thanks Alain "abrken" Bridel)
* Arrays of pointers were wrongly reported as uninitialized by the compiler
* Dereferencing temporary variables didn't release the variable
* Multidimensional arrays weren't working on GNUC based compilers
* Virtual Machine improvements
* Optimized the ASM VM
* The flag NO_THREADS no longer have any effect

The optimized ASM VM is now 10-25% faster than the C++ VM. The performance difference depends on the machine, where a faster, more modern CPU gets less performance improvement. This is probably because of the newer CPU's better pipelining and branch prediction. AngelScript 1.10.1 is now almost 5 times faster than it was with 1.9.0. The assembler VM is not turned on by default, you'll have to compile the library with the flag USE_ASM_VM (as explained in as_config.h). It will only work on compilers capable of understanding intel style inline assembly. Regards, Andreas Jönsson Author of AngelScript [Edited by - WitchLord on November 12, 2004 8:07:39 AM]
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #2Andreas Jonsson  Moderators

Posted 07 November 2004 - 07:32 AM

I just discovered a problem with the assembler VM in 1.10.1 WIP 1. The problem does not present itself with the C++ VM.

I'll let you know when it's been fixed.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #3Aggrav8d  Members

Posted 07 November 2004 - 10:21 AM

When I use the latest WIP with the fixes that were posted I get the assert in Dereference but I can't see the method names in the call stack. I am compiling Debug.

Dan Royer, OwnerMarginally Clever Games

### #4Andreas Jonsson  Moderators

Posted 07 November 2004 - 12:33 PM

The bug just won't go away, will it?

Does it present itself with the test case, you modified? Or just with your project? It will be next to impossible to find the bug without me being able to reproduce it.

I will try though.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #5Aggrav8d  Members

Posted 07 November 2004 - 01:54 PM

#include "utils.h"namespace TestRecursion{#define TESTNAME "TestRecursion"class ObjectInstance {public:  int val;};class ObjectType{public:};static ObjectInstance obj;static ObjectType type;static asIScriptEngine *engine;static const char *script1 = "void Test()                                        \n""{                                                  \n""  ObjectType *tbase = CreateObjectType(\"two\");   \n""  ObjectInstance*ptr = CreateObjectInstance(tbase);\n""  ptr->val = 0;                                    \n""}                                                  \n";static const char *script2 = "void Test() {}                                     \n";static bool LoadScriptSection(const char *script,const char *moduleName){  int r(engine->AddScriptSection(moduleName,moduleName,script,strlen(script),0));  if( r < 0 )  {    printf("%s: AddScriptSection failed on '%s' (%d)\n", TESTNAME, moduleName, r);    return false;  }  COutStream out;  r = engine->Build(moduleName, &out);  if( r < 0 )  {    printf("%s: Build failed on '%s' (%d)\n", TESTNAME, moduleName, r);    return false;  }  return true;}static ObjectInstance *CreateObjectInstance(ObjectType *type){  return &obj;}static ObjectType *CreateObjectType(std::string &str){  LoadScriptSection(script2,str.c_str());  return &type;}bool Test(){  bool fail = false;  engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);  RegisterStdString(engine);  int r;  r = engine->RegisterObjectType("ObjectInstance", sizeof(ObjectInstance), asOBJ_CLASS); assert(r>=0);  r = engine->RegisterObjectType("ObjectType", sizeof(ObjectType), asOBJ_CLASS); assert(r>=0);  r = engine->RegisterObjectProperty("ObjectInstance","int val", offsetof(ObjectInstance, val)); assert(r>=0);  r = engine->RegisterGlobalFunction("ObjectType *CreateObjectType(string &)", asFUNCTION(CreateObjectType), asCALL_CDECL); assert(r>=0);  r = engine->RegisterGlobalFunction("ObjectInstance *CreateObjectInstance(ObjectType *type)", asFUNCTION(CreateObjectInstance), asCALL_CDECL); assert(r>=0);  fail=!LoadScriptSection(script1,"one");  r = engine->ExecuteString("one", "Test()");  if( r < 0 )  {    printf("%s: failed %d\n", TESTNAME, r);    fail = true;  }  engine->Release();  return fail;}}

er, well, i'm trying to reproduce the problem...this is sort of what i'm doing, but it isn't failing.

One thing I did find: the msvc6 dsp for the feature tests should set the working directory to '../../bin'. if it doesn't then the ExecuteScript test will report errors.

...Followup: I seem to be compiling ok now. I downloaded the WIP again, installed the patches again, and everything appears to be working. *shrug* Probably something I did. :P

[Edited by - Aggrav8d on November 7, 2004 8:54:31 PM]

Dan Royer, OwnerMarginally Clever Games

### #6Andreas Jonsson  Moderators

Posted 08 November 2004 - 01:04 AM

Ok, let's hope it stays that way. These bugs that mysteriously dissappear always worries me, but all I can do is to ignore them until they appear again (if they appear again).

Yes, the debug working directory needs to be set to ../../bin, but unfortunately this information isn't stored in the dsp file, so when I clean up the directory before release this information is lost. If you know where this information is stored I would be grateful if you told me.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #7Andreas Jonsson  Moderators

Posted 12 November 2004 - 02:06 AM

WIP 3 has been released. The following changes where made:

• Script language

• All number types are now implicitly converted for assignments and function arguments
• When evaluating math operations of two different number types the types are first implicitly converted to the largest type
• bits datatype is implicitly converted to and from uint/int

• Bug fixes

• Arrays of pointers to objects where causing problems (thanks Dan "Aggrav8d" Royer)
• Conversions to and from double failed in the VM (thanks Jetro Lauha)
• CALLBND didn't work in the ASM vm
• ExecuteStep() still didn't work as before with BUILD_WITH_LINE_CUES (thanks Josh Passenger)
• ++ and -- failed in ASM VM for float values

• Compiler

• Greatly improved build times

• Library interface

• asIScriptContext::Prepare() can now be called with the argument asPREPARE_PREVIOUS to prepare a context for calling the same function that was previously called.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #8Aggrav8d  Members

Posted 14 November 2004 - 11:31 AM

WIPs come out so fast I'm afraid to upgrade - I don't want to change to a version that turns out to have some nasty bug that costs me a few days.

But my real question: is there a way to register a class method as an angelscript global function? At the moment I'm doing a lot of this
static void Method() {  Singleton::GetInst().Method();}// inside Singleton::Init()  asEngine->RegisterGlobalFunction("void Method()", asFUNCTION(::Method),asCALL_CDECL);

I realize I could probably use a static method but that wouldn't solve my problem because I'd still have to GetInst() and so on. I would only use this system in places where I could guarantee that the lifespan of Singleton bounded the lifespan of asEngine.

Dan Royer, OwnerMarginally Clever Games

### #9Andreas Jonsson  Moderators

Posted 14 November 2004 - 11:50 AM

It is of course a risk when using the very latest versions, but most of the time they contain mostly bug fixes. Most of the bugs are introduced when I implement new features, i.e. when the middle number changes. When only the last number in the version changes it usually means, bug fixes and minor improvements.

Currently the only class methods that can be registered as global functions are static methods. But I guess that doesn't solve your problem.

The problem with having class methods as global functions, is where AngelScript would get the class pointer. It would of course be possible to do if the object pointer was passed together with the method pointer, it would simplify things for the application writer, and it probably wouldn't complicate things too much for me. I'll investigate this further, maybe it's something I'll add for version 1.11.0.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #10Licu  Members

Posted 15 November 2004 - 01:39 AM

Quote:
 Original post by WitchLordOk, let's hope it stays that way. These bugs that mysteriously dissappear always worries me, but all I can do is to ignore them until they appear again (if they appear again).Yes, the debug working directory needs to be set to ../../bin, but unfortunately this information isn't stored in the dsp file, so when I clean up the directory before release this information is lost. If you know where this information is stored I would be grateful if you told me.

The local settings (like the starting directory) are saved in .opt file (VC 6) or .suo (.NET). Since they are local (individual for every user) they are not saved in the project (.dsp).

### #11Andreas Jonsson  Moderators

Posted 15 November 2004 - 03:28 AM

Thanks Licu. I suspected it was in this file, but hadn't confirmed it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.