[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-bugtracker] Bug #3058: Jit creates fast version for every method/function when first method/fuction is fast


http://gambaswiki.org/bugtracker/edit?object=BUG.3058&from=L21haW4-

Comment #2 by Brian G:

It look like in the gbc_header.c file you use the (not sure if i understand correctly) pattern check function  Trans_is(RS_FAST)
It appears that the RS_FAST pattern is not checking for following valid function definition in this case
and setting the all_fast flag  when the first thing in a class/module file is a `fast sub xxx()`.

in gbc_header.c line 967..
if (TRANS_is(RS_FAST))
	{
		JOB->class->all_fast = TRUE;
		JOB->class->has_fast = TRUE;
		
		if (TRANS_is(RS_UNSAFE))
			JOB->class->all_unsafe = TRUE;
		
		return TRUE;
	}

causes the error in gbc_header.c line 743

    func->fast = is_fast || JOB->class->all_fast;
    if (func->fast)
		JOB->class->has_fast = TRUE;

then the call to

 __jit.Translate in the component gb.jit happily translates all the method/func/sub to fast formats.

I have not been able to find the pattern for RS_FAST, it also seems to be embedded as a reserved value

gbc_trans.h :
159: #define TRANS_is(_reserved) (PATTERN_is(*JOB->current, (_reserved)) ? JOB->current++, TRUE : FALSE)
gbc_read_common.h
75: #define PATTERN_is(pattern, res) (pattern == PATTERN_make(RT_RESERVED, res))
65: #define PATTERN_make(type, index) ((PATTERN)((type) | ((index) << 8)))


----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----