pike.git
/
src
/
docode.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/docode.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: docode.c,v 1.
206
2009
/
11
/
20
10
:
58
:
09
grubba Exp $
+
|| $Id: docode.c,v 1.
207
2010
/
07
/
01
17
:
23
:
51
grubba Exp $
*/ #include "global.h" #include "las.h" #include "program.h" #include "pike_types.h" #include "stralloc.h" #include "interpret.h" #include "constants.h" #include "array.h"
pike.git/src/docode.c:914:
return do_lfun_call(f + inh->identifier_level, NULL); } else { /* FIXME: Support inlining for the parent case. * * do_call_external(n->u.integer.a, f + inh->identifier_level, * NULL); */ emit2(F_EXTERNAL, n->u.integer.b, level); } } else if (level) {
+
if (IDENTIFIER_IS_CONSTANT(id->identifier_flags) &&
+
(ref->id_flags & ID_INLINE) && !ref->inherit_offset &&
+
(id->func.offset >= 0)) {
+
/* An inline, local or final constant identifier in
+
* a lexically surrounding (aka parent) class.
+
* Avoid vtable traversal during runtime by moving
+
* the constant to this class.
+
*/
+
int tmp1 = store_constant(&state->new_program->
+
constants[id->func.offset].sval,
+
1, NULL);
+
emit1(F_CONSTANT, tmp1);
+
} else {
emit2(F_EXTERNAL, n->u.integer.b, level);
-
+
}
} else if (n->u.integer.b == IDREF_MAGIC_THIS) { emit1(F_THIS_OBJECT, 0); } else if(IDENTIFIER_IS_FUNCTION(id->identifier_flags) && id->identifier_flags & IDENTIFIER_HAS_BODY) { /* Only use this opcode when it's certain that the result * can't zero, i.e. when we know the function isn't just a * prototype. */ emit1(F_LFUN, n->u.integer.b);
-
+
} else if (IDENTIFIER_IS_CONSTANT(id->identifier_flags) &&
+
(ref->id_flags & ID_INLINE) && !ref->inherit_offset &&
+
(id->func.offset >= 0)) {
+
/* An inline, local or final constant identifier.
+
* No need for vtable traversal during runtime.
+
*/
+
emit1(F_CONSTANT, id->func.offset);
}else{ emit1(F_GLOBAL, n->u.integer.b); } } } return 1; case F_THIS: { int level = 0;
pike.git/src/docode.c:991:
POP_AND_DONT_CLEANUP; return 1; } case '?': { INT32 *prev_switch_jumptable = current_switch.jumptable; int adroppings , bdroppings; current_switch.jumptable=0;
-
+
if(!CDDR(n)) { tmp1=alloc_label(); do_jump_when_zero(CAR(n), DO_NOT_WARN((INT32)tmp1)); DO_CODE_BLOCK(CADR(n)); low_insert_label( DO_NOT_WARN((INT32)tmp1)); current_switch.jumptable = prev_switch_jumptable; return 0; }