Advertisement

Losing some function pointers after bytecode reload

Started by January 17, 2013 09:50 AM
1 comment, last by WitchLord 11 years, 8 months ago

I don't know where to start with this bug, so I'll just describe what happens.

I'm using the latest AS but it was like this a couple versions earlier too.

After I load byte code I get all sorts of errors.

Mainly I lose function pointers from the cache. I cache functions after loading like this:

cachedFuncs.func_onRender_CRules = mModule->GetFunctionByDecl( "void onRender( CRules@ this )" );

Now some functions lose the pointers and its just garbage. Not immediately but after some time before running the script.

But this is not the issue, its just an effect, cause if I dont use the cache there are some other random errors and crashes inside AS code.

I'm not 100% sure but I think the files I see breaking are the ones using an enum. It might be an AS bug not handling these enums properly:

this is the enum that is used in those files:

namespace Hitters {
shared enum hits{
hitter_nothing = 0,
//env
hitter_fall,
hitter_drown,
hitter_burn,
hitter_crush,
hitter_flying,
//common actor
hitter_stomp,
hitter_suicide,
//builders
hitter_hammer, //mason
hitter_saw, //carpenter
hitter_pick, //peasant
//arrows and similar projectiles
hitter_arrow,
hitter_ballista,
//cata
hitter_cata_stones,
//knight
hitter_sword,
hitter_shield,
hitter_bomb,
//siege
hitter_ram,
//traps
hitter_spikes,
//barbarian
hitter_muscles
};
}
its "shared" now but without shared it breaks too.
KAG DEVLOG: http://kagdev.tumblr.com/

It sounds like it might be a bug in AngelScript. Unfortunately I will need more information in order to reproduce the problem so I can identify and fix the bug.

Is it possible for you to write a smaller script that reproduces the problem?

Can you identify what function in the script that causes the functions to become invalid?

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

Advertisement

I just made a fix that I think may be related to this problem that you reported. You can find the fix in revision 1555 + 1556.

I found this problem after discussing the problem that TheAtom reported here: http://www.gamedev.net/topic/638529-wrong-function-called-on-bytecode-restoration/

It would be great if you could try it out to see if this corrected your problem too.

[edit] additional fixes related to this problem

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

This topic is closed to new replies.

Advertisement