1 /* src/vm/jit/jit.c - calls the code generation functions
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 #include "mm/memory.h"
37 #include "native/native.h"
39 #include "toolbox/logging.h"
41 #include "threads/lock-common.h"
42 #include "threads/threads-common.h"
44 #include "vm/global.h"
45 #include "vm/initialize.h"
47 #include "vm/jit/asmpart.h"
49 #include "vm/jit/cfg.h"
51 #include "vm/jit/codegen-common.h"
52 #include "vm/jit/disass.h"
53 #include "vm/jit/dseg.h"
54 #include "vm/jit/jit.h"
55 #include "vm/jit/parse.h"
56 #include "vm/jit/reg.h"
58 #include "vm/jit/show.h"
59 #include "vm/jit/stack.h"
61 #include "vm/jit/allocator/simplereg.h"
62 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
63 # include "vm/jit/allocator/lsra.h"
66 #if defined(ENABLE_SSA)
67 # include "vm/jit/optimizing/lsra.h"
68 # include "vm/jit/optimizing/ssa.h"
71 #if defined(ENABLE_INLINING)
72 # include "vm/jit/inline/inline.h"
75 #include "vm/jit/ir/bytecode.h"
77 #include "vm/jit/loop/analyze.h"
78 #include "vm/jit/loop/graph.h"
79 #include "vm/jit/loop/loop.h"
81 #if defined(ENABLE_IFCONV)
82 # include "vm/jit/optimizing/ifconv.h"
85 #include "vm/jit/optimizing/reorder.h"
87 #if defined(ENABLE_PYTHON)
88 # include "vm/jit/python.h"
91 #include "vm/jit/verify/typecheck.h"
93 #include "vmcore/class.h"
94 #include "vmcore/loader.h"
95 #include "vmcore/method.h"
96 #include "vmcore/options.h"
97 #include "vmcore/rt-timing.h"
98 #include "vmcore/statistics.h"
101 /* debug macros ***************************************************************/
104 #define DEBUG_JIT_COMPILEVERBOSE(x) \
106 if (compileverbose) { \
107 log_message_method(x, m); \
111 #define DEBUG_JIT_COMPILEVERBOSE(x) /* nothing */
115 # define TRACECOMPILERCALLS() \
117 if (opt_TraceCompilerCalls) { \
119 log_print("[JIT compiler started: method="); \
126 # define TRACECOMPILERCALLS()
130 /* the ICMD table ************************************************************/
133 #define N(name) name,
138 /* abbreviations for flags */
140 #define PEI ICMDTABLE_PEI
141 #define CALLS ICMDTABLE_CALLS
143 /* some machine dependent values */
148 #define IDIV_CALLS ICMDTABLE_CALLS
151 #if (SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
154 #define LDIV_CALLS ICMDTABLE_CALLS
157 /* include the actual table */
159 icmdtable_entry_t icmd_table[256] = {
160 #include <vm/jit/icmdtable.inc>
167 /* XXX hack until the old "PEI" definition is removed */
171 /* jit_init ********************************************************************
173 Initializes the JIT subsystem.
175 *******************************************************************************/
179 #if defined(ENABLE_JIT)
180 /* initialize stack analysis subsystem */
185 /* initialize show subsystem */
191 /* initialize codegen subsystem */
195 /* initialize code subsystem */
199 /* Machine dependent initialization. */
201 #if defined(ENABLE_JIT)
202 # if defined(ENABLE_INTRP)
214 /* jit_close *******************************************************************
216 Close the JIT subsystem.
218 *******************************************************************************/
226 /* dummy function, used when there is no JavaVM code available */
228 static u1 *do_nothing_function(void)
234 /* jit_jitdata_new *************************************************************
236 Allocates and initalizes a new jitdata structure.
238 *******************************************************************************/
240 jitdata *jit_jitdata_new(methodinfo *m)
245 /* allocate jitdata structure and fill it */
250 jd->cd = DNEW(codegendata);
251 jd->rd = DNEW(registerdata);
252 #if defined(ENABLE_LOOP)
253 jd->ld = DNEW(loopdata);
256 /* Allocate codeinfo memory from the heap as we need to keep them. */
258 code = code_codeinfo_new(m);
260 /* Set codeinfo flags. */
262 #if defined(ENABLE_THREADS)
263 if (checksync && (m->flags & ACC_SYNCHRONIZED))
264 code_flag_synchronized(code);
266 if (checksync && (m->flags & ACC_SYNCHRONIZED))
267 code_unflag_leafmethod(code);
270 code_flag_leafmethod(code);
272 /* initialize variables */
276 jd->exceptiontable = NULL;
277 jd->exceptiontablelength = 0;
279 jd->branchtoentry = false;
280 jd->branchtoend = false;
282 jd->returnblock = NULL;
283 jd->maxlocals = m->maxlocals;
289 /* jit_compile *****************************************************************
291 Translates one method to machine code.
293 *******************************************************************************/
295 static u1 *jit_compile_intern(jitdata *jd);
297 u1 *jit_compile(methodinfo *m)
303 STATISTICS(count_jit_calls++);
305 /* Initialize the static function's class. */
307 /* ATTENTION: This MUST be done before the method lock is aquired,
308 otherwise we could run into a deadlock with <clinit>'s that
309 call static methods of it's own class. */
311 if ((m->flags & ACC_STATIC) && !(m->class->state & CLASS_INITIALIZED)) {
314 log_message_class("Initialize class ", m->class);
317 if (!initialize_class(m->class))
320 /* check if the method has been compiled during initialization */
322 if ((m->code != NULL) && (m->code->entrypoint != NULL))
323 return m->code->entrypoint;
326 /* enter a monitor on the method */
328 LOCK_MONITOR_ENTER(m);
330 /* if method has been already compiled return immediately */
332 if (m->code != NULL) {
333 LOCK_MONITOR_EXIT(m);
335 assert(m->code->entrypoint);
336 return m->code->entrypoint;
339 TRACECOMPILERCALLS();
341 STATISTICS(count_methods++);
343 #if defined(ENABLE_STATISTICS)
346 if (opt_getcompilingtime)
347 compilingtime_start();
350 /* mark start of dump memory area */
354 /* create jitdata structure */
356 jd = jit_jitdata_new(m);
358 /* set the flags for the current JIT run */
360 jd->flags = JITDATA_FLAG_PARSE;
362 #if defined(ENABLE_VERIFIER)
364 jd->flags |= JITDATA_FLAG_VERIFY;
367 #if defined(ENABLE_PROFILING)
369 jd->flags |= JITDATA_FLAG_INSTRUMENT;
372 #if defined(ENABLE_IFCONV)
374 jd->flags |= JITDATA_FLAG_IFCONV;
377 #if defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG)
378 if (opt_inlining && opt_inline_debug_all)
379 jd->flags |= JITDATA_FLAG_INLINE;
382 if (opt_showintermediate)
383 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
385 if (opt_showdisassemble)
386 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
389 jd->flags |= JITDATA_FLAG_VERBOSECALL;
391 #if defined(ENABLE_REPLACEMENT) && defined(ENABLE_INLINING)
393 jd->flags |= JITDATA_FLAG_COUNTDOWN;
396 #if defined(ENABLE_JIT)
397 # if defined(ENABLE_INTRP)
400 /* initialize the register allocator */
406 /* setup the codegendata memory */
410 /* now call internal compile function */
412 r = jit_compile_intern(jd);
415 /* We had an exception! Finish stuff here if necessary. */
417 /* release codeinfo */
419 code_codeinfo_free(jd->code);
421 #if defined(ENABLE_PROFILING)
422 /* Release memory for basic block profiling information. */
424 if (JITDATA_HAS_FLAG_INSTRUMENT(jd))
425 if (jd->code->bbfrequency != NULL)
426 MFREE(jd->code->bbfrequency, u4, jd->code->basicblockcount);
430 DEBUG_JIT_COMPILEVERBOSE("Running: ");
433 /* release dump area */
437 #if defined(ENABLE_STATISTICS)
440 if (opt_getcompilingtime)
441 compilingtime_stop();
444 /* leave the monitor */
446 LOCK_MONITOR_EXIT(m);
448 /* return pointer to the methods entry point */
454 /* jit_recompile ***************************************************************
456 Recompiles a Java method.
458 *******************************************************************************/
460 u1 *jit_recompile(methodinfo *m)
467 /* check for max. optimization level */
469 optlevel = (m->code) ? m->code->optlevel : 0;
473 /* log_message_method("not recompiling: ", m); */
478 DEBUG_JIT_COMPILEVERBOSE("Recompiling start: ");
480 STATISTICS(count_jit_calls++);
482 #if defined(ENABLE_STATISTICS)
485 if (opt_getcompilingtime)
486 compilingtime_start();
489 /* mark start of dump memory area */
493 /* create jitdata structure */
495 jd = jit_jitdata_new(m);
497 /* set the current optimization level to the previous one plus 1 */
499 jd->code->optlevel = optlevel + 1;
501 /* get the optimization flags for the current JIT run */
503 #if defined(ENABLE_VERIFIER)
504 jd->flags |= JITDATA_FLAG_VERIFY;
507 /* jd->flags |= JITDATA_FLAG_REORDER; */
508 if (opt_showintermediate)
509 jd->flags |= JITDATA_FLAG_SHOWINTERMEDIATE;
510 if (opt_showdisassemble)
511 jd->flags |= JITDATA_FLAG_SHOWDISASSEMBLE;
513 jd->flags |= JITDATA_FLAG_VERBOSECALL;
515 #if defined(ENABLE_INLINING)
517 jd->flags |= JITDATA_FLAG_INLINE;
520 #if defined(ENABLE_JIT)
521 # if defined(ENABLE_INTRP)
524 /* initialize the register allocator */
529 /* setup the codegendata memory */
533 /* now call internal compile function */
535 r = jit_compile_intern(jd);
538 /* We had an exception! Finish stuff here if necessary. */
540 /* release codeinfo */
542 code_codeinfo_free(jd->code);
545 /* release dump area */
549 #if defined(ENABLE_STATISTICS)
552 if (opt_getcompilingtime)
553 compilingtime_stop();
556 DEBUG_JIT_COMPILEVERBOSE("Recompiling done: ");
558 /* return pointer to the methods entry point */
563 #if defined(ENABLE_PM_HACKS)
564 #include "vm/jit/jit_pm_1.inc"
567 /* jit_compile_intern **********************************************************
569 Static internal function which does the actual compilation.
571 *******************************************************************************/
573 static u1 *jit_compile_intern(jitdata *jd)
579 #if defined(ENABLE_RT_TIMING)
580 struct timespec time_start,time_checks,time_parse,time_stack,
581 time_typecheck,time_loop,time_ifconv,time_alloc,
585 RT_TIMING_GET_TIME(time_start);
587 /* get required compiler data */
589 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
596 #if defined(ENABLE_DEBUG_FILTER)
597 show_filters_apply(jd->m);
600 /* Handle native methods and create a native stub. */
602 if (m->flags & ACC_NATIVE) {
605 f = native_method_resolve(m);
610 code = codegen_generate_stub_native(m, f);
612 /* Native methods are never recompiled. */
618 return code->entrypoint;
621 /* if there is no javacode, print error message and return empty method */
623 if (m->jcode == NULL) {
624 DEBUG_JIT_COMPILEVERBOSE("No code given for: ");
626 code->entrypoint = (u1 *) (ptrint) do_nothing_function;
629 return code->entrypoint; /* return empty method */
632 #if defined(ENABLE_STATISTICS)
634 count_javacodesize += m->jcodelength + 18;
635 count_tryblocks += jd->exceptiontablelength;
636 count_javaexcsize += jd->exceptiontablelength * SIZEOF_VOID_P;
640 RT_TIMING_GET_TIME(time_checks);
642 #if defined(WITH_CLASSPATH_SUN)
643 /* Code for Sun's OpenJDK (see
644 hotspot/src/share/vm/classfile/verifier.cpp
645 (Verifier::is_eligible_for_verification)): Don't verify
646 dynamically-generated bytecodes. */
648 # if defined(ENABLE_VERIFIER)
649 if (class_issubclass(m->class, class_sun_reflect_MagicAccessorImpl))
650 jd->flags &= ~JITDATA_FLAG_VERIFY;
654 /* call the compiler passes ***********************************************/
656 DEBUG_JIT_COMPILEVERBOSE("Parsing: ");
658 /* call parse pass */
661 DEBUG_JIT_COMPILEVERBOSE("Exception while parsing: ");
665 RT_TIMING_GET_TIME(time_parse);
667 DEBUG_JIT_COMPILEVERBOSE("Parsing done: ");
669 #if defined(ENABLE_JIT)
670 # if defined(ENABLE_INTRP)
673 DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
675 /* call stack analysis pass */
677 if (!stack_analyse(jd)) {
678 DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
682 RT_TIMING_GET_TIME(time_stack);
684 DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
686 /* Build the CFG. This has to be done after stack_analyse, as
687 there happens the JSR elimination. */
692 #ifdef ENABLE_VERIFIER
693 if (JITDATA_HAS_FLAG_VERIFY(jd)) {
694 DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
696 /* call typecheck pass */
697 if (!typecheck(jd)) {
698 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
703 DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
706 RT_TIMING_GET_TIME(time_typecheck);
708 #if defined(ENABLE_LOOP)
713 jit_renumber_basicblocks(jd);
716 RT_TIMING_GET_TIME(time_loop);
718 #if defined(ENABLE_IFCONV)
719 if (JITDATA_HAS_FLAG_IFCONV(jd)) {
720 if (!ifconv_static(jd))
722 jit_renumber_basicblocks(jd);
725 RT_TIMING_GET_TIME(time_ifconv);
729 #if defined(ENABLE_INLINING)
730 if (JITDATA_HAS_FLAG_INLINE(jd)) {
731 if (!inline_inline(jd))
736 #if defined(ENABLE_PROFILING)
737 /* Basic block reordering. I think this should be done after
738 if-conversion, as we could lose the ability to do the
741 if (JITDATA_HAS_FLAG_REORDER(jd)) {
744 jit_renumber_basicblocks(jd);
748 #if defined(ENABLE_PM_HACKS)
749 #include "vm/jit/jit_pm_2.inc"
751 DEBUG_JIT_COMPILEVERBOSE("Allocating registers: ");
753 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
754 /* allocate registers */
759 STATISTICS(count_methods_allocated_by_lsra++);
762 # endif /* defined(ENABLE_LSRA) && !defined(ENABLE_SSA) */
763 #if defined(ENABLE_SSA)
764 /* allocate registers */
765 if ((opt_lsra) && (jd->exceptiontablelength == 0)) {
766 jd->ls = DNEW(lsradata);
769 /*lsra(jd);*/ regalloc(jd);
771 STATISTICS(count_methods_allocated_by_lsra++);
774 # endif /* defined(ENABLE_SSA) */
776 STATISTICS(count_locals_conflicts += (jd->maxlocals - 1) * (jd->maxlocals));
781 STATISTICS(simplereg_make_statistics(jd));
783 DEBUG_JIT_COMPILEVERBOSE("Allocating registers done: ");
784 # if defined(ENABLE_INTRP)
787 #endif /* defined(ENABLE_JIT) */
788 RT_TIMING_GET_TIME(time_alloc);
790 #if defined(ENABLE_PROFILING)
791 /* Allocate memory for basic block profiling information. This
792 _must_ be done after loop optimization and register allocation,
793 since they can change the basic block count. */
795 if (JITDATA_HAS_FLAG_INSTRUMENT(jd))
796 code->bbfrequency = MNEW(u4, jd->basicblockcount);
799 DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
801 /* now generate the machine code */
803 #if defined(ENABLE_JIT)
804 # if defined(ENABLE_INTRP)
806 #if defined(ENABLE_VERIFIER)
808 DEBUG_JIT_COMPILEVERBOSE("Typechecking (stackbased): ");
810 if (!typecheck_stackbased(jd)) {
811 DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking (stackbased): ");
816 if (!intrp_codegen(jd)) {
817 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
824 if (!codegen_generate(jd)) {
825 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
831 if (!intrp_codegen(jd)) {
832 DEBUG_JIT_COMPILEVERBOSE("Exception while generating code: ");
837 RT_TIMING_GET_TIME(time_codegen);
839 DEBUG_JIT_COMPILEVERBOSE("Generating code done: ");
841 #if !defined(NDEBUG) && defined(ENABLE_REPLACEMENT)
842 /* activate replacement points inside newly created code */
844 if (opt_TestReplacement)
845 replace_activate_replacement_points(code, false);
849 #if defined(ENABLE_DEBUG_FILTER)
850 if (jd->m->filtermatches & SHOW_FILTER_FLAG_SHOW_METHOD)
853 /* intermediate and assembly code listings */
855 if (JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd)) {
856 show_method(jd, SHOW_CODE);
858 else if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
859 # if defined(ENABLE_DISASSEMBLER)
860 DISASSEMBLE(code->entrypoint,
861 code->entrypoint + (code->mcodelength - cd->dseglen));
865 if (opt_showddatasegment)
870 /* switch to the newly generated code */
873 assert(code->entrypoint);
875 /* add the current compile version to the methodinfo */
877 code->prev = m->code;
880 RT_TIMING_TIME_DIFF(time_start,time_checks,RT_TIMING_JIT_CHECKS);
881 RT_TIMING_TIME_DIFF(time_checks,time_parse,RT_TIMING_JIT_PARSE);
882 RT_TIMING_TIME_DIFF(time_parse,time_stack,RT_TIMING_JIT_STACK);
883 RT_TIMING_TIME_DIFF(time_stack,time_typecheck,RT_TIMING_JIT_TYPECHECK);
884 RT_TIMING_TIME_DIFF(time_typecheck,time_loop,RT_TIMING_JIT_LOOP);
885 RT_TIMING_TIME_DIFF(time_loop,time_alloc,RT_TIMING_JIT_ALLOC);
886 RT_TIMING_TIME_DIFF(time_alloc,time_codegen,RT_TIMING_JIT_CODEGEN);
887 RT_TIMING_TIME_DIFF(time_start,time_codegen,RT_TIMING_JIT_TOTAL);
889 /* return pointer to the methods entry point */
891 return code->entrypoint;
895 /* jit_invalidate_code *********************************************************
897 Mark the compiled code of the given method as invalid and take care that
898 it is replaced if necessary.
900 XXX Not fully implemented, yet.
902 *******************************************************************************/
904 void jit_invalidate_code(methodinfo *m)
910 if (code == NULL || code_is_invalid(code))
913 code_flag_invalid(code);
915 /* activate mappable replacement points */
917 #if defined(ENABLE_REPLACEMENT)
918 replace_activate_replacement_points(code, true);
920 vm_abort("invalidating code only works with ENABLE_REPLACEMENT");
925 /* jit_request_optimization ****************************************************
927 Request optimization of the given method. If the code of the method is
928 unoptimized, it will be invalidated, so the next jit_get_current_code(m)
929 triggers an optimized recompilation.
930 If the method is already optimized, this function does nothing.
933 m................the method
935 *******************************************************************************/
937 void jit_request_optimization(methodinfo *m)
943 if (code && code->optlevel == 0)
944 jit_invalidate_code(m);
948 /* jit_get_current_code ********************************************************
950 Get the currently valid code for the given method. If there is no valid
951 code, (re)compile the method.
954 m................the method
957 the codeinfo* for the current code, or
958 NULL if an exception has been thrown during recompilation.
960 *******************************************************************************/
962 codeinfo *jit_get_current_code(methodinfo *m)
966 /* if we have valid code, return it */
968 if (m->code && !code_is_invalid(m->code))
971 /* otherwise: recompile */
973 if (!jit_recompile(m))
982 /* jit_asm_compile *************************************************************
984 This method is called from asm_vm_call_method and does:
986 - create stackframe info for exceptions
988 - patch the entrypoint of the method into the calculated address in
990 - flushes the instruction cache.
992 *******************************************************************************/
994 #if defined(ENABLE_JIT)
995 #if !defined(JIT_COMPILER_VIA_SIGNAL)
996 u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra)
998 stackframeinfo_t sfi;
1003 /* create the stackframeinfo (subtract 1 from RA as it points to the */
1004 /* instruction after the call) */
1006 stacktrace_stackframeinfo_add(&sfi, NULL, sp, ra, ra-1);
1008 /* actually compile the method */
1010 entrypoint = jit_compile(m);
1012 /* remove the stackframeinfo */
1014 stacktrace_stackframeinfo_remove(&sfi);
1016 /* there was a problem during compilation */
1018 if (entrypoint == NULL)
1021 /* get the method patch address */
1023 pa = md_jit_method_patch_address(sfi.pv, (void *) ra, mptr);
1025 /* patch the method entry point */
1029 *p = (ptrint) entrypoint;
1031 /* flush the instruction cache */
1033 md_icacheflush(pa, SIZEOF_VOID_P);
1039 /* jit_compile_handle **********************************************************
1041 This method is called from the appropriate signal handler which
1042 handles compiler-traps and does the following:
1044 - compile the method
1045 - patch the entrypoint of the method into the calculated address in
1047 - flush the instruction cache
1049 *******************************************************************************/
1051 void *jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr)
1053 void *newpv; /* new compiled method PV */
1054 void *pa; /* patch address */
1055 uintptr_t *p; /* convenience pointer */
1057 /* Compile the method. */
1059 newpv = jit_compile(m);
1061 /* There was a problem during compilation. */
1066 /* Get the method patch address. */
1068 pa = md_jit_method_patch_address(pv, ra, mptr);
1070 /* Patch the method entry point. */
1072 p = (uintptr_t *) pa;
1074 *p = (uintptr_t) newpv;
1076 /* Flush both caches. */
1078 md_cacheflush(pa, SIZEOF_VOID_P);
1082 #endif /* defined(ENABLE_JIT) */
1085 /* jit_complement_condition ****************************************************
1087 Returns the complement of the passed conditional instruction.
1089 We use the order of the different conditions, e.g.:
1094 If the passed opcode is odd, we simply add 1 to get the complement.
1095 If the opcode is even, we subtract 1.
1102 *******************************************************************************/
1104 s4 jit_complement_condition(s4 opcode)
1108 return ICMD_IFNONNULL;
1110 case ICMD_IFNONNULL:
1114 /* check if opcode is odd */
1124 /* jit_renumber_basicblocks ****************************************************
1126 Set the ->nr of all blocks so it increases when traversing ->next.
1129 jitdata..........the current jitdata
1131 *******************************************************************************/
1133 void jit_renumber_basicblocks(jitdata *jd)
1139 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1143 /* we have one block more than jd->basicblockcount (the end marker) */
1145 assert(nr == jd->basicblockcount + 1);
1149 /* jit_check_basicblock_numbers ************************************************
1151 Assert that the ->nr of the first block is zero and increases by 1 each
1152 time ->next is traversed.
1153 This function should be called before any analysis that relies on
1154 the basicblock numbers.
1157 jitdata..........the current jitdata
1159 NOTE: Aborts with an assertion if the condition is not met!
1161 *******************************************************************************/
1163 #if !defined(NDEBUG)
1164 void jit_check_basicblock_numbers(jitdata *jd)
1170 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next) {
1171 assert(bptr->nr == nr);
1175 /* we have one block more than jd->basicblockcount (the end marker) */
1177 assert(nr == jd->basicblockcount + 1);
1179 #endif /* !defined(NDEBUG) */
1181 methoddesc *instruction_call_site(const instruction *iptr) {
1182 if (iptr->opc == ICMD_BUILTIN) {
1183 return iptr->sx.s23.s3.bte->md;
1184 } else if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1185 return iptr->sx.s23.s3.um->methodref->parseddesc.md;
1187 return iptr->sx.s23.s3.fmiref->p.method->parseddesc;
1192 * These are local overrides for various environment variables in Emacs.
1193 * Please do not remove this and leave it at the end of the file, where
1194 * Emacs will automagically detect them.
1195 * ---------------------------------------------------------------------
1198 * indent-tabs-mode: t
1202 * vim:noexpandtab:sw=4:ts=4: