1 /* src/vm/jit/inline/inline.c - code inliner
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Edwin Steiner
31 $Id: inline.c 4736 2006-04-05 11:32:52Z edwin $
44 #include "mm/memory.h"
45 #include "toolbox/logging.h"
46 #include "vm/global.h"
47 #include "vm/options.h"
48 #include "vm/statistics.h"
49 #include "vm/jit/jit.h"
50 #include "vm/jit/parse.h"
51 #include "vm/jit/inline/inline.h"
52 #include "vm/jit/loop/loop.h"
55 #include "vm/initialize.h"
56 #include "vm/method.h"
57 #include "vm/jit/jit.h"
59 #include "vm/jit/reg.h"
60 #include "vm/jit/stack.h"
62 #include "vm/jit/verify/typecheck.h"
64 #if defined(USE_THREADS)
65 # if defined(NATIVE_THREADS)
66 # include "threads/native/threads.h"
68 # include "threads/green/threads.h"
73 bool inline_debug_log = 0;
74 bool inline_debug_log_names = 0;
75 int inline_debug_start_counter = 0;
76 int inline_debug_max_size = INT_MAX;
77 int inline_debug_min_size = 0;
78 int inline_debug_end_counter = INT_MAX;
79 int inline_count_methods = 0;
80 #define DOLOG(code) do{ if (inline_debug_log) { code; } }while(0)
85 typedef struct inline_node inline_node;
86 typedef struct inline_target_ref inline_target_ref;
87 typedef struct inline_context inline_context;
88 typedef struct inline_stack_translation inline_stack_translation;
89 typedef struct inline_block_map inline_block_map;
95 inline_node *children;
100 /* info about the call site (if depth > 0)*/
102 basicblock *callerblock;
103 instruction *callerins;
105 stackptr n_callerstack;
106 int n_callerstackdepth;
107 stackptr o_callerstack;
108 exceptiontable **o_handlers;
110 /* info about the callee */
112 int prolog_instructioncount;
113 int epilog_instructioncount;
114 int extra_instructioncount;
115 int instructioncount;
118 basicblock *handler_monitorexit;
120 /* cumulative values */
121 int cumul_instructioncount;
122 int cumul_stackcount;
123 int cumul_basicblockcount;
126 int cumul_exceptiontablelength;
129 instruction *inlined_iinstr;
130 instruction *inlined_iinstr_cursor;
131 stackptr n_inlined_stack;
132 stackptr n_inlined_stack_cursor;
133 basicblock *inlined_basicblocks;
134 basicblock *inlined_basicblocks_cursor;
137 registerdata *regdata;
140 inline_target_ref *refs;
141 instruction *inline_start_instruction;
144 struct inline_target_ref {
145 inline_target_ref *next;
150 struct inline_stack_translation {
155 struct inline_block_map {
161 struct inline_context {
164 int next_block_number;
165 inline_block_map *blockmap;
170 stackptr o_translationlimit; /* if a stackptr is smaller than this, look it up in the table */
171 stackptr n_debug_stackbase;
172 inline_stack_translation *stacktranslationstart;
174 inline_stack_translation stacktranslation[1]; /* XXX VARIABLE LENGTH! */
177 static int stack_depth(stackptr sp)
188 #include "inline_debug.c"
190 void inline_print_stats()
192 printf("inlined callers: %d\n",inline_count_methods);
196 static bool inline_jit_compile_intern(jitdata *jd)
202 /* XXX initialize the static function's class */
205 m->isleafmethod = true;
207 /* call the compiler passes ***********************************************/
209 /* call parse pass */
211 DOLOG( log_message_class("Parsing ", m->class) );
216 /* call stack analysis pass */
218 if (!stack_analyse(jd)) {
225 static bool inline_jit_compile(inline_node *iln)
236 #if defined(USE_THREADS)
237 /* enter a monitor on the method */
238 builtin_monitorenter((java_objectheader *) m);
241 /* XXX dont parse these a second time because parse is not idempotent */
242 for (i=0; i<m->jcodelength; ++i) {
243 if (m->jcode[i] == JAVA_TABLESWITCH || m->jcode[i] == JAVA_LOOKUPSWITCH) {
249 /* allocate jitdata structure and fill it */
254 jd->cd = DNEW(codegendata);
255 jd->rd = DNEW(registerdata);
256 #if defined(ENABLE_LOOP)
257 jd->ld = DNEW(loopdata);
261 /* Allocate codeinfo memory from the heap as we need to keep them. */
263 jd->code = code_codeinfo_new(m); /* XXX check allocation */
265 #if defined(ENABLE_JIT)
266 # if defined(ENABLE_INTRP)
269 /* initialize the register allocator */
273 /* setup the codegendata memory */
277 /* now call internal compile function */
279 r = inline_jit_compile_intern(jd);
282 iln->regdata = jd->rd;
285 /* free some memory */
289 #if defined(ENABLE_JIT)
290 # if defined(ENABLE_INTRP)
299 #if defined(USE_THREADS)
300 /* leave the monitor */
301 builtin_monitorexit((java_objectheader *) m );
305 stack_show_method(jd);
311 static void insert_inline_node(inline_node *parent,inline_node *child)
316 assert(parent && child);
318 child->parent = parent;
320 first = parent->children;
322 /* insert as only node */
323 parent->children = child;
329 /* {there is at least one child already there} */
332 while (succ->callerpc < child->callerpc) {
335 /* insert as last node */
336 child->prev = first->prev;
338 child->prev->next = child;
339 child->next->prev = child;
344 assert(succ->callerpc > child->callerpc);
346 /* insert before succ */
348 child->prev = succ->prev;
350 child->prev->next = child;
351 child->next->prev = child;
354 static stackptr relocate_stack_ptr_intern(inline_node *iln,stackptr o_link,ptrint curreloc)
356 inline_stack_translation *tr;
359 /* XXX should limit range in both directions */
360 if (o_link < iln->ctx->o_translationlimit) {
361 /* this stack slot is from an earlier chunk, we must look it up */
362 tr = iln->ctx->stacktranslationstart;
363 while (tr >= iln->ctx->stacktranslation) {
364 if (o_link == tr->o_sp) {
365 DOLOG(printf("\t\t\ttable lookup %p -> %d\n",(void*)o_link,DEBUG_SLOT(tr->n_sp)));
370 DOLOG(debug_dump_inline_context(iln));
371 DOLOG(printf("\t\tFAILED TO TRANSLATE: %p\n",(void*)o_link));
375 /* this stack slot it in the most recent chunk */
377 DOLOG( printf("\t\t\toffset %d\n",(int)curreloc) );
378 return (stackptr) ((u1*)o_link + curreloc);
381 return iln->n_callerstack;
384 /* XXX for debugging */
385 static stackptr relocate_stack_ptr(inline_node *iln,stackptr o_link,ptrint curreloc)
389 new = relocate_stack_ptr_intern(iln,o_link,curreloc);
391 printf("\t\treloc %p -> %d (%p)\t(translimit=%p)\n",
392 (void*)o_link,DEBUG_SLOT(new),(void*)new,(void*)iln->ctx->o_translationlimit)
397 static void emit_instruction(inline_node *iln,instruction *ins,ptrint curreloc,stackptr o_curstack)
402 inline_target_ref *ref;
406 for (i=0; i<iln->depth; ++i)
410 n_ins = (iln->inlined_iinstr_cursor++);
411 assert((n_ins - iln->inlined_iinstr) < iln->cumul_instructioncount);
415 switch (n_ins[0].opc) {
416 /****************************************/
417 /* VARIABLE ACCESS */
431 n_ins[0].op1 += iln->localsoffset;
464 ref = DNEW(inline_target_ref);
465 ref->ref = (basicblock **) &(n_ins[0].target);
466 ref->next = iln->refs;
470 /****************************************/
475 n_ins[0].opc = ICMD_GOTO;
487 n_ins[0].opc = ICMD_INLINE_GOTO;
488 n_ins[0].dst = o_curstack;
490 n_ins[0].target = (void *) (ptrint) (iln->depth + 0x333); /* XXX */
491 ref = DNEW(inline_target_ref);
492 ref->ref = (basicblock **) &(n_ins[0].target);
493 ref->next = iln->refs;
499 n_ins[0].dst = relocate_stack_ptr(iln,n_ins[0].dst,curreloc);
502 static stackptr inline_new_stackslot(inline_node *iln,stackptr n_curstack,s4 type)
506 n_sp = iln->n_inlined_stack_cursor++;
507 assert((n_sp - iln->n_inlined_stack) < iln->cumul_stackcount);
509 n_sp->prev = n_curstack;
511 n_sp->varkind = TEMPVAR;
512 n_sp->varnum = stack_depth(n_curstack); /* XXX inefficient */
515 n_sp->regoff = (IS_FLT_DBL_TYPE(type)) ? -1 : INT_ARG_CNT;
521 static stackptr emit_inlining_prolog(inline_node *iln,inline_node *callee,stackptr n_curstack,instruction *o_iptr)
531 insinfo_inline *insinfo;
533 assert(iln && callee && o_iptr);
536 md = calleem->parseddesc;
537 isstatic = (calleem->flags & ACC_STATIC);
539 localindex = callee->localsoffset + md->paramslots;
540 depth = stack_depth(n_curstack) - 1; /* XXX inefficient */
541 for (i=md->paramcount-1; i>=0; --i) {
544 n_ins = (iln->inlined_iinstr_cursor++);
545 assert((n_ins - iln->inlined_iinstr) < iln->cumul_instructioncount);
547 type = md->paramtypes[i].type;
549 localindex -= IS_2_WORD_TYPE(type) ? 2 : 1;
550 assert(callee->regdata);
552 DOLOG( printf("prologlocal %d type=%d lofs=%d in ",
553 localindex - callee->localsoffset,
554 callee->regdata->locals[localindex - callee->localsoffset][type].type,callee->localsoffset);
555 method_println(callee->m); );
557 if ((callee->regdata->locals[localindex - callee->localsoffset][type].type >= 0)
559 (i==0 && callee->synchronize && !isstatic))
561 n_ins->opc = ICMD_ISTORE + type;
562 n_ins->op1 = localindex;
565 n_ins->opc = IS_2_WORD_TYPE(type) ? ICMD_POP2 : ICMD_POP; /* XXX is POP2 correct? */
567 n_ins->line = o_iptr->line;
569 if (n_curstack->varkind == ARGVAR) {
570 n_curstack->varkind = TEMPVAR;
571 n_curstack->varnum = depth;
572 n_curstack->flags &= ~INMEMORY;
574 n_curstack = n_curstack->prev;
575 n_ins->dst = n_curstack;
579 /* INLINE_START instruction */
581 n_ins = (iln->inlined_iinstr_cursor++);
582 assert((n_ins - iln->inlined_iinstr) < iln->cumul_instructioncount);
584 insinfo = DNEW(insinfo_inline);
585 insinfo->method = callee->m;
586 insinfo->outer = iln->m;
587 /* XXX using local 0 only works if it is read-only!! */
588 insinfo->synclocal = callee->localsoffset;
589 insinfo->synchronize = callee->synchronize;
591 n_ins->opc = ICMD_INLINE_START;
592 n_ins->dst = n_curstack;
593 n_ins->target = insinfo;
594 n_ins->line = o_iptr->line;
595 iln->inline_start_instruction = n_ins;
600 static void emit_inlining_epilog(inline_node *iln,inline_node *callee,stackptr n_curstack,instruction *o_iptr)
604 assert(iln && callee && o_iptr);
605 assert(iln->inline_start_instruction);
607 n_ins = (iln->inlined_iinstr_cursor++);
608 assert((n_ins - iln->inlined_iinstr) < iln->cumul_instructioncount);
610 n_ins->opc = ICMD_INLINE_END;
611 n_ins->dst = n_curstack;
612 n_ins->target = iln->inline_start_instruction->target; /* insinfo_inline * */
613 n_ins->line = o_iptr->line;
616 static void rewrite_stack(inline_node *iln,stackptr o_first,stackptr o_last,ptrint curreloc)
626 DOLOG(printf("rewrite_stack: no stack slots\n"));
632 assert(o_first <= o_last);
634 n = o_last - o_first + 1;
638 n_sp = iln->n_inlined_stack_cursor;
641 printf("rewrite_stack: rewriting %d stack slots (%p,%p) -> (%d,%d)\n",
642 n,(void*)o_first,(void*)o_last,DEBUG_SLOT(n_sp),
643 DEBUG_SLOT(n_sp+n-1))
646 DOLOG( printf("o_first = "); debug_dump_stack(o_first); printf("\n") );
647 DOLOG( printf("o_last = "); debug_dump_stack(o_last); printf("\n") );
649 while (o_sp <= o_last) {
652 n_sp->prev = relocate_stack_ptr(iln,n_sp->prev,curreloc);
653 switch (n_sp->varkind) {
654 case STACKVAR: n_sp->varnum += iln->n_callerstackdepth; break;
655 case LOCALVAR: n_sp->varnum += iln->localsoffset; break;
661 DOLOG( printf("n_sp = "); debug_dump_stack(n_sp-1); printf("\n") );
663 iln->n_inlined_stack_cursor = n_sp;
664 assert((n_sp - iln->n_inlined_stack) <= iln->cumul_stackcount);
667 static void inline_resolve_block_refs(inline_target_ref **refs,basicblock *o_bptr,basicblock *n_bptr)
669 inline_target_ref *ref;
670 inline_target_ref *prev;
675 if (*(ref->ref) == o_bptr) {
677 if ((ptrint) o_bptr < (0x333+100)) { /* XXX */
678 printf("resolving RETURN block reference %p -> new L%03d (%p)\n",
679 (void*)o_bptr,n_bptr->debug_nr,(void*)n_bptr);
682 printf("resolving block reference old L%03d (%p) -> new L%03d (%p)\n",
683 o_bptr->debug_nr,(void*)o_bptr,n_bptr->debug_nr,(void*)n_bptr);
687 *(ref->ref) = n_bptr;
689 prev->next = ref->next;
702 static basicblock * create_block(inline_node *iln,basicblock *o_bptr,inline_target_ref **refs,int indepth)
711 n_bptr = iln->inlined_basicblocks_cursor++;
713 assert((n_bptr - iln->inlined_basicblocks) < iln->cumul_basicblockcount);
716 temp = iln->m->c_debug_nr;
717 BASICBLOCK_INIT(n_bptr,iln->m);
718 iln->m->c_debug_nr = temp;
720 n_bptr->iinstr = iln->inlined_iinstr_cursor;
721 n_bptr->next = n_bptr+1;
722 n_bptr->debug_nr = iln->ctx->next_block_number++;
723 n_bptr->indepth = indepth;
726 /* allocate stackslots */
727 iln->n_inlined_stack_cursor += indepth;
728 n_sp = iln->n_inlined_stack_cursor - 1;
729 n_bptr->instack = n_sp;
731 assert((n_sp - iln->n_inlined_stack) < iln->cumul_stackcount);
733 /* link the stack elements */
734 for (i=indepth-1; i>=0; --i) {
735 n_sp->varkind = STACKVAR;
737 n_sp->prev = (i) ? n_sp-1 : NULL;
738 n_sp->flags = 0; /* XXX */
745 inline_resolve_block_refs(refs,o_bptr,n_bptr);
751 static void fill_translation_table(inline_node *iln,stackptr o_sp,stackptr n_sp,int n_depth)
756 printf("fill_translation_table (newdepth=%d):\n",n_depth);
757 printf("\tos_sp = "); debug_dump_stack(o_sp); printf("\n");
758 printf("\tns_sp = "); debug_dump_stack(n_sp); printf("\n");
761 /* we must translate all stack slots that were present before the call XXX */
762 /* and the instack of the block */
763 iln->ctx->stacktranslationstart = iln->ctx->stacktranslation + (n_depth - 1);
765 /* fill the translation table */
772 iln->ctx->stacktranslation[i].o_sp = o_sp;
773 iln->ctx->stacktranslation[i].n_sp = n_sp;
774 n_sp->flags |= (o_sp->flags & SAVEDVAR); /* XXX correct? */
775 n_sp->type = o_sp->type; /* XXX we overwrite this anyway with STACKVAR, right? */
783 assert(iln->ctx->stacktranslation[i].o_sp);
784 iln->ctx->stacktranslation[i].n_sp = n_sp;
785 n_sp->flags |= SAVEDVAR; /* XXX this is too conservative */
794 static void rewrite_method(inline_node *iln)
804 stackptr o_nexttorewrite;
805 stackptr o_lasttorewrite;
806 inline_node *nextcall;
809 inline_block_map *bm;
816 nextcall = iln->children;
818 /* set memory cursors */
819 iln->inlined_iinstr_cursor = iln->inlined_iinstr;
820 iln->n_inlined_stack_cursor = iln->n_inlined_stack;
821 iln->inlined_basicblocks_cursor = iln->inlined_basicblocks;
823 /* loop over basic blocks */
824 o_bptr = iln->m->basicblocks;
825 for (; o_bptr; o_bptr = o_bptr->next) {
827 if (o_bptr->flags < BBREACHED) {
829 printf("skipping old L%03d (flags=%d,type=%d,os=%p,oid=%d,ois=%p,cursor=%d,callerstack=%d) of ",
830 o_bptr->debug_nr,o_bptr->flags,o_bptr->type,
831 (void*)o_bptr->stack,o_bptr->indepth,(void*)o_bptr->instack,
832 DEBUG_SLOT(iln->n_inlined_stack_cursor),
833 DEBUG_SLOT(iln->n_callerstack));
834 method_println(iln->m);
837 n_bptr = create_block(iln,o_bptr,&(iln->refs),o_bptr->indepth + iln->n_callerstackdepth);
838 n_bptr->type = o_bptr->type;
839 /* enter it in the blockmap */
840 iln->ctx->blockmap[iln->ctx->blockmap_index].iln = iln;
841 iln->ctx->blockmap[iln->ctx->blockmap_index].o_block = o_bptr;
842 iln->ctx->blockmap[iln->ctx->blockmap_index++].n_block = n_bptr;
843 n_bptr->flags = o_bptr->flags;
847 assert(o_bptr->stack);
849 len = o_bptr->icount;
850 o_iptr = o_bptr->iinstr;
853 printf("rewriting old L%03d (flags=%d,type=%d,os=%p,oid=%d,ois=%p,cursor=%d,callerstack=%d) of ",
854 o_bptr->debug_nr,o_bptr->flags,o_bptr->type,
855 (void*)o_bptr->stack,o_bptr->indepth,(void*)o_bptr->instack,
856 DEBUG_SLOT(iln->n_inlined_stack_cursor),
857 DEBUG_SLOT(iln->n_callerstack));
858 method_println(iln->m);
859 printf("o_instack: ");debug_dump_stack(o_bptr->instack);printf("\n");
860 printf("o_callerstack: ");debug_dump_stack(iln->o_callerstack);printf("\n");
863 o_curstack = o_bptr->instack;
865 /* create an inlined clone of this block */
866 n_bptr = create_block(iln,o_bptr,&(iln->refs),o_bptr->indepth + iln->n_callerstackdepth);
867 n_bptr->type = o_bptr->type;
868 n_bptr->flags = o_bptr->flags;
870 /* enter it in the blockmap */
871 iln->ctx->blockmap[iln->ctx->blockmap_index].iln = iln;
872 iln->ctx->blockmap[iln->ctx->blockmap_index].o_block = o_bptr;
873 iln->ctx->blockmap[iln->ctx->blockmap_index++].n_block = n_bptr;
875 DOLOG( debug_dump_inline_context(iln) );
877 if (iln->n_callerstackdepth)
878 iln->n_callerstack = n_bptr->instack-o_bptr->indepth;
880 iln->n_callerstack = NULL;
881 fill_translation_table(iln,iln->o_callerstack,iln->n_callerstack,iln->n_callerstackdepth);
882 fill_translation_table(iln,o_bptr->instack,n_bptr->instack,n_bptr->indepth);
883 iln->ctx->o_translationlimit = o_bptr->stack;
885 DOLOG( debug_dump_inline_context(iln) );
887 /* calculate the stack element relocation */
888 curreloc = (u1*)iln->n_inlined_stack_cursor - (u1*)o_bptr->stack;
889 DOLOG( printf("curreloc <- %d = %p - %p\n",(int)curreloc,(void*)iln->n_inlined_stack_cursor,(void*)(u1*)o_bptr->stack) );
891 o_nexttorewrite = o_bptr->stack;
892 o_lasttorewrite = o_bptr->stack-1;
893 assert(o_nexttorewrite);
900 DOLOG( printf("o_curstack = "); debug_dump_stack(o_curstack); stack_show_icmd(o_iptr,false); printf(", dst = "); debug_dump_stack(o_dst); printf("\n") );
902 if (nextcall && o_iptr == nextcall->callerins) {
904 /* rewrite stack elements produced so far in this block */
905 if (o_nexttorewrite <= o_lasttorewrite) {
906 rewrite_stack(iln, o_nexttorewrite, o_lasttorewrite, curreloc);
909 /* write the inlining prolog */
910 n_sp = emit_inlining_prolog(iln,nextcall,relocate_stack_ptr(iln,o_curstack,curreloc),o_iptr);
911 icount += nextcall->m->parseddesc->paramcount + 1; /* XXX prolog instructions */
913 /* find the first stack slot under the arguments of the invocation */
915 for (i=0; i < nextcall->m->parseddesc->paramcount; ++i) {
919 nextcall->o_callerstack = o_sp;
921 /* see how deep the new stack is after the arguments have been removed */
922 i = stack_depth(n_sp);
923 assert(i == stack_depth(nextcall->o_callerstack) + iln->n_callerstackdepth);
925 /* end current block */
926 n_bptr->icount = icount;
927 n_bptr->outstack = n_sp;
928 n_bptr->outdepth = i;
930 /* caller stack depth for the callee */
931 assert(nextcall->n_callerstackdepth == i);
933 /* set memory pointers in the callee */
934 nextcall->inlined_iinstr = iln->inlined_iinstr_cursor;
935 nextcall->n_inlined_stack = iln->n_inlined_stack_cursor;
936 nextcall->inlined_basicblocks = iln->inlined_basicblocks_cursor;
939 DOLOG( printf("entering inline "); stack_show_icmd(o_iptr,false); printf("\n") );
940 rewrite_method(nextcall);
941 DOLOG( printf("leaving inline "); stack_show_icmd(o_iptr,false); printf("\n") );
943 /* skip stack slots used by the inlined callee */
944 curreloc += (u1*)nextcall->n_inlined_stack_cursor - (u1*)iln->n_inlined_stack_cursor;
946 /* update memory cursors */
947 assert(nextcall->inlined_iinstr_cursor == iln->inlined_iinstr_cursor + nextcall->cumul_instructioncount);
948 /* XXX m->stackcount seems to be a conservative estimate */
949 assert(nextcall->n_inlined_stack_cursor <= iln->n_inlined_stack_cursor + nextcall->cumul_stackcount);
950 assert(nextcall->inlined_basicblocks_cursor == iln->inlined_basicblocks_cursor + nextcall->cumul_basicblockcount);
951 iln->inlined_iinstr_cursor = nextcall->inlined_iinstr_cursor;
952 iln->n_inlined_stack_cursor = nextcall->n_inlined_stack_cursor;
953 iln->inlined_basicblocks_cursor = nextcall->inlined_basicblocks_cursor;
955 /* start new block */
956 i = (nextcall->m->parseddesc->returntype.type == TYPE_VOID) ? 0 : 1; /* number of return slots */
957 assert(i == 0 || i == 1);
958 n_bptr = create_block(iln,(void*) (ptrint) (nextcall->depth + 0x333) /*XXX*/,
959 &(nextcall->refs),nextcall->n_callerstackdepth + i);
960 n_bptr->flags = o_bptr->flags;
963 /* skip allocated stack slots */
964 curreloc += sizeof(stackelement) * (n_bptr->indepth - i);
966 /* fill the translation table for the slots present before the call */
967 n_sp = n_bptr->instack;
968 fill_translation_table(iln,nextcall->o_callerstack,(i) ? n_sp->prev : n_sp,nextcall->n_callerstackdepth);
970 /* the return slot */
974 fill_translation_table(iln,o_dst,n_sp,nextcall->n_callerstackdepth + 1);
976 o_nexttorewrite = o_dst + 1;
977 o_lasttorewrite = o_dst;
980 /* the next chunk of stack slots start with (including) the slots produced */
981 /* by the invocation */
982 o_nexttorewrite = o_lasttorewrite + 1;
983 o_lasttorewrite = o_nexttorewrite - 1;
986 DOLOG( debug_dump_inline_context(iln) );
987 iln->ctx->o_translationlimit = o_nexttorewrite;
989 /* emit inlining epilog */
990 emit_inlining_epilog(iln,nextcall,n_sp,o_iptr);
991 icount++; /* XXX epilog instructions */
993 /* proceed to next call */
994 nextcall = nextcall->next;
997 printf("resuming old L%03d (flags=%d,type=%d,os=%p,oid=%d,ois=%p,cursor=%d,curreloc=%d,callerstack=%d) of ",
998 o_bptr->debug_nr,o_bptr->flags,o_bptr->type,
999 (void*)o_bptr->stack,o_bptr->indepth,(void*)o_bptr->instack,
1000 DEBUG_SLOT(iln->n_inlined_stack_cursor),(int)curreloc,
1001 DEBUG_SLOT(iln->n_callerstack));
1002 method_println(iln->m);
1006 emit_instruction(iln,o_iptr,curreloc,o_curstack);
1009 if (o_dst > o_lasttorewrite)
1010 o_lasttorewrite = o_dst;
1013 DOLOG( printf("o_dst = %p\n",(void*)o_dst) );
1018 /* end of basic block */
1019 /* rewrite stack after last call */
1020 if (o_nexttorewrite <= o_lasttorewrite) {
1021 rewrite_stack(iln,o_nexttorewrite,o_lasttorewrite,curreloc);
1023 n_bptr->outstack = relocate_stack_ptr(iln,o_bptr->outstack,curreloc);
1024 n_bptr->outdepth = iln->n_callerstackdepth + o_bptr->outdepth;
1025 assert(n_bptr->outdepth == stack_depth(n_bptr->outstack));
1027 if (n_bptr->outstack) {
1029 n_bptr->outstack += curreloc;
1032 n_bptr->icount = icount;
1034 n_iptr = iln->inlined_iinstr_cursor - 1;
1035 if (n_iptr->opc == ICMD_INLINE_GOTO) {
1036 DOLOG( printf("creating stack slot for ICMD_INLINE_GOTO\n") );
1037 n_sp = iln->n_inlined_stack_cursor++;
1038 assert(n_iptr->dst);
1039 *n_sp = *n_iptr->dst;
1040 n_sp->prev = iln->n_callerstack;
1043 n_bptr->outdepth = iln->n_callerstackdepth + 1;
1044 n_bptr->outstack = n_sp;
1048 bm = iln->ctx->blockmap;
1049 for (i=0; i<iln->ctx->blockmap_index; ++i, ++bm) {
1050 assert(bm->iln && bm->o_block && bm->n_block);
1053 inline_resolve_block_refs(&(iln->refs),iln->ctx->blockmap[i].o_block,iln->ctx->blockmap[i].n_block);
1058 inline_target_ref *ref;
1061 if (!iln->depth || *(ref->ref) != (void*) (ptrint) (0x333 + iln->depth) /* XXX */) {
1062 DOLOG( printf("XXX REMAINING REF at depth %d: %p\n",iln->depth,(void*)*(ref->ref)) );
1071 static basicblock * inline_map_block(inline_node *iln,basicblock *o_block,inline_node *targetiln)
1073 inline_block_map *bm;
1074 inline_block_map *bmend;
1082 bm = iln->ctx->blockmap;
1083 bmend = bm + iln->ctx->blockmap_index;
1085 while (bm < bmend) {
1086 assert(bm->iln && bm->o_block && bm->n_block);
1087 if (bm->o_block == o_block && bm->iln == targetiln)
1093 return NULL; /* not reached */
1096 static exceptiontable * inline_exception_tables(inline_node *iln,exceptiontable *n_extable,exceptiontable **prevextable)
1104 assert(prevextable);
1106 child = iln->children;
1109 n_extable = inline_exception_tables(child,n_extable,prevextable);
1110 child = child->next;
1111 } while (child != iln->children);
1114 et = iln->m->exceptiontable;
1115 for (i=0; i<iln->m->exceptiontablelength; ++i) {
1117 memset(n_extable,0,sizeof(exceptiontable));
1118 n_extable->startpc = et->startpc;
1119 n_extable->endpc = et->endpc;
1120 n_extable->handlerpc = et->handlerpc;
1121 n_extable->start = inline_map_block(iln,et->start,iln);
1122 n_extable->end = inline_map_block(iln,et->end,iln);
1123 n_extable->handler = inline_map_block(iln,et->handler,iln);
1124 n_extable->catchtype = et->catchtype;
1127 (*prevextable)->down = n_extable;
1129 *prevextable = n_extable;
1135 if (iln->handler_monitorexit) {
1136 exceptiontable **activehandlers;
1138 memset(n_extable,0,sizeof(exceptiontable));
1139 n_extable->startpc = 0; /* XXX */
1140 n_extable->endpc = 0; /* XXX */
1141 n_extable->handlerpc = 0; /* XXX */
1142 n_extable->start = iln->inlined_basicblocks;
1143 n_extable->end = iln->inlined_basicblocks_cursor;
1144 n_extable->handler = iln->handler_monitorexit;
1145 n_extable->catchtype.any = NULL; /* finally */
1148 (*prevextable)->down = n_extable;
1150 *prevextable = n_extable;
1154 activehandlers = iln->o_handlers;
1155 while (*activehandlers) {
1157 assert(iln->parent);
1159 memset(n_extable,0,sizeof(exceptiontable));
1160 n_extable->startpc = 0; /* XXX */
1161 n_extable->endpc = 0; /* XXX */
1162 n_extable->handlerpc = 0; /* XXX */
1163 n_extable->start = iln->handler_monitorexit;
1164 n_extable->end = iln->handler_monitorexit + 1;
1165 n_extable->handler = inline_map_block(iln->parent,(*activehandlers)->handler,iln->parent);
1166 n_extable->catchtype = (*activehandlers)->catchtype;
1169 (*prevextable)->down = n_extable;
1171 *prevextable = n_extable;
1182 static void inline_locals(inline_node *iln,registerdata *rd)
1191 child = iln->children;
1194 inline_locals(child,rd);
1195 child = child->next;
1196 } while (child != iln->children);
1199 assert(iln->regdata);
1201 for (i=0; i<iln->m->maxlocals; ++i) {
1202 for (t=TYPE_INT; t<=TYPE_ADR; ++t) {
1203 DOLOG( printf("local %d type=%d in ",i,iln->regdata->locals[i][t].type); method_println(iln->m); );
1204 if (iln->regdata->locals[i][t].type >= 0) {
1205 rd->locals[iln->localsoffset + i][t].type = iln->regdata->locals[i][t].type;
1206 rd->locals[iln->localsoffset + i][t].flags |= iln->regdata->locals[i][t].flags;
1211 if (iln->regdata->memuse > rd->memuse)
1212 rd->memuse = iln->regdata->memuse;
1213 if (iln->regdata->argintreguse > rd->argintreguse)
1214 rd->argintreguse = iln->regdata->argintreguse;
1215 if (iln->regdata->argfltreguse > rd->argfltreguse)
1216 rd->argfltreguse = iln->regdata->argfltreguse;
1219 static void inline_stack_interfaces(inline_node *iln,registerdata *rd)
1228 assert(rd->interfaces);
1230 bptr = iln->inlined_basicblocks;
1231 for (i=0; i<iln->cumul_basicblockcount; ++i, ++bptr) {
1232 DOLOG( printf("INLINE STACK INTERFACE block L%03d\n",bptr->debug_nr) );
1233 DOLOG( printf("\toutstack = ");debug_dump_stack(bptr->outstack);printf("\n") );
1234 DOLOG( printf("\tinstack = ");debug_dump_stack(bptr->outstack);printf("\n") );
1236 assert(bptr->outdepth == stack_depth(bptr->outstack));
1237 assert(bptr->indepth == stack_depth(bptr->instack));
1239 sp = bptr->outstack;
1240 d = bptr->outdepth - 1;
1242 if ((sp->varkind == STACKVAR) && (sp->varnum > d)) {
1243 sp->varkind = TEMPVAR;
1246 sp->varkind = STACKVAR;
1249 DOLOG( printf("INLINE STACK INTERFACE L%03d outstack d=%d varkind=%d varnum=%d type=%d flags=%01x\n",
1250 bptr->debug_nr,d,sp->varkind,sp->varnum,sp->type,sp->flags) );
1251 rd->interfaces[d][sp->type].type = sp->type;
1252 rd->interfaces[d][sp->type].flags |= sp->flags;
1258 d = bptr->indepth - 1;
1260 rd->interfaces[d][sp->type].type = sp->type;
1261 if (sp->varkind == STACKVAR && (sp->flags & SAVEDVAR)) {
1262 rd->interfaces[d][sp->type].flags |= SAVEDVAR;
1264 DOLOG( printf("INLINE STACK INTERFACE L%03d instack d=%d varkind=%d varnum=%d type=%d flags=%01x\n",
1265 bptr->debug_nr,d,sp->varkind,sp->varnum,sp->type,sp->flags) );
1272 static bool inline_inline_intern(methodinfo *m,jitdata *jd, inline_node *iln)
1278 stackptr o_curstack;
1279 int opcode; /* invocation opcode */
1281 inline_node *calleenode;
1282 inline_node *active;
1286 exceptiontable **handlers;
1292 /* initialize cumulative counters */
1294 iln->cumul_maxstack = iln->n_callerstackdepth + m->maxstack + 1 /* XXX builtins */;
1295 iln->cumul_maxlocals = iln->localsoffset + m->maxlocals;
1296 iln->cumul_exceptiontablelength += m->exceptiontablelength;
1298 /* iterate over basic blocks */
1300 bptr = m->basicblocks;
1301 for (; bptr; bptr = bptr->next) {
1303 iln->cumul_basicblockcount++;
1305 /* extra stackslots */
1306 iln->cumul_stackcount += iln->n_callerstackdepth;
1308 if (bptr->flags < BBREACHED)
1311 /* allocate the buffer of active exception handlers */
1312 /* XXX this wastes some memory, but probably it does not matter */
1314 handlers = DMNEW(exceptiontable*, m->exceptiontablelength + 1);
1316 /* determine the active exception handlers for this block */
1317 /* XXX maybe the handlers of a block should be part of our IR */
1319 for (i = 0; i < m->exceptiontablelength; ++i) {
1320 if ((m->exceptiontable[i].start <= bptr) && (m->exceptiontable[i].end > bptr)) {
1321 handlers[nhandlers++] = m->exceptiontable + i;
1324 handlers[nhandlers] = NULL;
1326 assert(bptr->stack);
1329 iptr = bptr->iinstr;
1330 o_curstack = bptr->instack;
1332 iln->instructioncount += len;
1333 iln->cumul_instructioncount += len;
1336 printf("ADD INSTRUCTIONS [%d]: %d, count=%d, cumulcount=%d\n",
1337 iln->depth,len,iln->instructioncount,iln->cumul_instructioncount);
1340 while (--len >= 0) {
1347 /* XXX we cannot deal with IINC's stack hacking */
1350 case ICMD_LOOKUPSWITCH:
1351 case ICMD_TABLESWITCH:
1352 /* XXX these are not implemented, yet. */
1355 /****************************************/
1358 case ICMD_INVOKEVIRTUAL:
1359 case ICMD_INVOKESPECIAL:
1360 case ICMD_INVOKESTATIC:
1361 case ICMD_INVOKEINTERFACE:
1362 callee = (methodinfo *) iptr[0].val.a;
1365 if ((callee->flags & (ACC_STATIC | ACC_FINAL | ACC_PRIVATE) || opcode == ICMD_INVOKESPECIAL)
1366 && !(callee->flags & (ACC_NATIVE)))
1368 if (iln->depth < 3) {
1369 for (active = iln; active; active = active->parent) {
1370 if (callee == active->m) {
1371 DOLOG( printf("RECURSIVE!\n") );
1376 calleenode = DNEW(inline_node);
1377 memset(calleenode,0,sizeof(inline_node));
1379 calleenode->ctx = iln->ctx;
1380 calleenode->m = callee;
1381 calleenode->synchronize = (callee->flags & ACC_SYNCHRONIZED);
1382 isstatic = (callee->flags & ACC_STATIC);
1384 if (!inline_jit_compile(calleenode))
1387 /* info about the call site */
1388 calleenode->depth = iln->depth+1;
1389 calleenode->callerblock = bptr;
1390 calleenode->callerins = iptr;
1391 calleenode->callerpc = iptr - m->basicblocks->iinstr;
1392 calleenode->o_handlers = handlers;
1394 /* info about the callee */
1395 calleenode->localsoffset = iln->localsoffset + m->maxlocals;
1396 calleenode->prolog_instructioncount = callee->parseddesc->paramcount;
1397 calleenode->epilog_instructioncount = 0;
1398 calleenode->extra_instructioncount = 0;
1400 if (calleenode->synchronize) {
1402 builtintable_entry *bte;
1404 /* and exception handler */
1405 /* ALOAD, builtin_monitorexit, ATHROW */
1406 calleenode->extra_instructioncount += 3;
1407 /* stack elements used in handler */
1408 iln->cumul_stackcount += 2;
1410 /* exception table entries */
1411 iln->cumul_exceptiontablelength += 1 + nhandlers;
1413 bte = builtintable_get_internal(BUILTIN_monitorenter);
1415 if (md->memuse > calleenode->regdata->memuse)
1416 calleenode->regdata->memuse = md->memuse;
1417 if (md->argintreguse > calleenode->regdata->argintreguse)
1418 calleenode->regdata->argintreguse = md->argintreguse;
1421 bte = builtintable_get_internal(BUILTIN_staticmonitorenter);
1423 if (md->memuse > calleenode->regdata->memuse)
1424 calleenode->regdata->memuse = md->memuse;
1425 if (md->argintreguse > calleenode->regdata->argintreguse)
1426 calleenode->regdata->argintreguse = md->argintreguse;
1429 bte = builtintable_get_internal(BUILTIN_monitorexit);
1431 if (md->memuse > calleenode->regdata->memuse)
1432 calleenode->regdata->memuse = md->memuse;
1433 if (md->argintreguse > calleenode->regdata->argintreguse)
1434 calleenode->regdata->argintreguse = md->argintreguse;
1436 iln->ctx->calls_others = true;
1439 calleenode->stackcount = callee->stackcount;
1440 calleenode->cumul_stackcount = callee->stackcount;
1442 /* see how deep the stack is below the arguments */
1444 for (i=0; sp; sp = sp->prev)
1446 calleenode->n_callerstackdepth = iln->n_callerstackdepth + i - callee->parseddesc->paramcount;
1448 insert_inline_node(iln,calleenode);
1450 if (!inline_inline_intern(callee,jd,calleenode))
1453 if (calleenode->synchronize) {
1454 /* add exception handler block */
1455 iln->ctx->master->cumul_basicblockcount++;
1458 iln->cumul_instructioncount += calleenode->prolog_instructioncount;
1459 iln->cumul_instructioncount += calleenode->epilog_instructioncount;
1460 iln->cumul_instructioncount += calleenode->extra_instructioncount;
1461 iln->cumul_instructioncount += calleenode->cumul_instructioncount - 1/*invoke*/ + 2 /*INLINE_START|END*/;
1462 iln->cumul_stackcount += calleenode->cumul_stackcount;
1464 /* XXX extra block after inlined call */
1465 iln->cumul_stackcount += calleenode->n_callerstackdepth;
1466 iln->cumul_basicblockcount += 1;
1468 iln->cumul_basicblockcount += calleenode->cumul_basicblockcount;
1469 iln->cumul_exceptiontablelength += calleenode->cumul_exceptiontablelength;
1470 if (calleenode->cumul_maxstack > iln->cumul_maxstack)
1471 iln->cumul_maxstack = calleenode->cumul_maxstack;
1472 if (calleenode->cumul_maxlocals > iln->cumul_maxlocals)
1473 iln->cumul_maxlocals = calleenode->cumul_maxlocals;
1486 /* end of basic block */
1492 static void inline_write_exception_handlers(inline_node *master,inline_node *iln)
1495 stackptr n_curstack;
1498 builtintable_entry *bte;
1500 child = iln->children;
1503 inline_write_exception_handlers(master,child);
1504 child = child->next;
1505 } while (child != iln->children);
1508 if (iln->synchronize) {
1509 /* create the monitorexit handler */
1510 n_bptr = create_block(master,NULL,NULL,1 /*XXX*/);
1511 n_bptr->type = BBTYPE_EXH;
1512 n_bptr->flags = BBFINISHED;
1514 iln->handler_monitorexit = n_bptr;
1516 n_curstack = n_bptr->instack;
1518 /* ACONST / ALOAD */
1520 n_curstack = inline_new_stackslot(master,n_curstack,TYPE_ADR);
1522 n_ins = master->inlined_iinstr_cursor++;
1523 if (iln->m->flags & ACC_STATIC) {
1524 n_ins->opc = ICMD_ACONST;
1525 n_ins->val.a = iln->m->class;
1526 n_ins->target = class_get_self_classref(iln->m->class);
1529 n_ins->opc = ICMD_ALOAD;
1530 n_ins->op1 = iln->localsoffset; /* XXX */
1532 n_ins->dst = n_curstack;
1537 n_curstack = n_curstack->prev;
1539 bte = builtintable_get_internal(BUILTIN_monitorexit);
1541 n_ins = master->inlined_iinstr_cursor++;
1542 n_ins->opc = ICMD_BUILTIN;
1544 n_ins->dst = n_curstack;
1549 n_curstack = n_curstack->prev;
1551 n_ins = master->inlined_iinstr_cursor++;
1552 n_ins->opc = ICMD_ATHROW;
1553 n_ins->dst = n_curstack;
1556 /* close basic block */
1558 n_bptr->outstack = n_curstack;
1559 n_bptr->outdepth = stack_depth(n_curstack); /* XXX */
1564 static bool test_inlining(inline_node *iln,jitdata *jd,
1565 methodinfo **resultmethod, jitdata **resultjd)
1570 methodinfo *n_method;
1571 exceptiontable *n_ext;
1572 exceptiontable *prevext;
1578 static int debug_verify_inlined_code = 1;
1580 static int debug_compile_inlined_code_counter = 0;
1583 assert(iln && jd && resultmethod && resultjd);
1585 *resultmethod = iln->m;
1589 if (debug_compile_inlined_code_counter >5)
1593 n_ins = DMNEW(instruction,iln->cumul_instructioncount);
1594 iln->inlined_iinstr = n_ins;
1596 n_stack = DMNEW(stackelement,iln->cumul_stackcount);
1597 iln->n_inlined_stack = n_stack;
1598 iln->ctx->n_debug_stackbase = n_stack;
1600 n_bb = DMNEW(basicblock,iln->cumul_basicblockcount);
1601 iln->inlined_basicblocks = n_bb;
1603 iln->ctx->blockmap = DMNEW(inline_block_map,iln->cumul_basicblockcount);
1605 rewrite_method(iln);
1606 inline_write_exception_handlers(iln,iln);
1608 /* end of basic blocks */
1609 if (iln->inlined_basicblocks_cursor > iln->inlined_basicblocks) {
1610 iln->inlined_basicblocks_cursor[-1].next = NULL;
1613 if (iln->cumul_exceptiontablelength) {
1614 exceptiontable *tableend;
1616 n_ext = DMNEW(exceptiontable,iln->cumul_exceptiontablelength);
1618 tableend = inline_exception_tables(iln,n_ext,&prevext);
1619 assert(tableend == n_ext + iln->cumul_exceptiontablelength);
1621 prevext->down = NULL;
1627 /*******************************************************************************/
1629 n_method = NEW(methodinfo);
1630 memcpy(n_method,iln->m,sizeof(methodinfo));
1631 n_method->maxstack = iln->cumul_maxstack; /* XXX put into cd,rd */
1632 n_method->maxlocals = iln->cumul_maxlocals;
1633 n_method->basicblockcount = iln->cumul_basicblockcount;
1634 n_method->basicblocks = iln->inlined_basicblocks;
1635 n_method->basicblockindex = NULL;
1636 n_method->instructioncount = iln->cumul_instructioncount;
1637 n_method->instructions = iln->inlined_iinstr;
1638 n_method->stackcount = iln->cumul_stackcount;
1639 n_method->stack = iln->n_inlined_stack;
1641 n_method->exceptiontablelength = iln->cumul_exceptiontablelength;
1642 n_method->exceptiontable = n_ext;
1643 n_method->linenumbercount = 0;
1645 n_jd = DNEW(jitdata);
1649 if (iln->ctx->calls_others) {
1650 n_method->isleafmethod = false;
1653 n_jd->code = code_codeinfo_new(n_method);
1655 n_cd = DNEW(codegendata);
1657 memcpy(n_cd,jd->cd,sizeof(codegendata));
1658 n_cd->method = n_method;
1659 n_cd->maxstack = n_method->maxstack;
1660 n_cd->maxlocals = n_method->maxlocals;
1661 n_cd->exceptiontablelength = n_method->exceptiontablelength;
1662 n_cd->exceptiontable = n_method->exceptiontable;
1664 n_rd = DNEW(registerdata);
1668 iln->regdata = jd->rd;
1669 inline_locals(iln,n_rd);
1670 DOLOG( printf("INLINING STACK INTERFACES FOR "); method_println(iln->m) );
1671 inline_stack_interfaces(iln,n_rd);
1673 if (debug_verify_inlined_code) {
1674 debug_verify_inlined_code = 0;
1675 DOLOG( printf("VERIFYING INLINED RESULT...\n") );
1676 if (!typecheck(n_jd)) {
1677 *exceptionptr = NULL;
1678 DOLOG( printf("XXX INLINED RESULT DID NOT PASS VERIFIER XXX\n") );
1682 DOLOG( printf("VERIFICATION PASSED.\n") );
1684 debug_verify_inlined_code = 1;
1689 if (n_method->instructioncount >= inline_debug_min_size && n_method->instructioncount <= inline_debug_max_size) {
1690 if (debug_compile_inlined_code_counter >= inline_debug_start_counter
1691 && debug_compile_inlined_code_counter <= inline_debug_end_counter)
1694 (strcmp(n_method->class->name->text,"java/lang/reflect/Array") == 0 &&
1695 strcmp(n_method->name->text,"<clinit>") == 0 &&
1696 strcmp(n_method->descriptor->text,"()V") == 0)
1698 (strcmp(n_method->class->name->text,"java/lang/VMClassLoader") == 0 &&
1699 strcmp(n_method->name->text,"getSystemClassLoader") == 0 &&
1700 strcmp(n_method->descriptor->text,"()Ljava/lang/ClassLoader;") == 0)
1707 *resultmethod = n_method;
1711 inline_count_methods++;
1712 if (inline_debug_log_names)
1713 method_println(n_method);
1716 printf("==== %d.INLINE ==================================================================\n",debug_compile_inlined_code_counter);
1717 method_println(n_method);
1718 stack_show_method(jd);
1719 dump_inline_tree(iln);
1720 stack_show_method(n_jd);
1721 debug_dump_inlined_code(iln,n_method,n_cd,n_rd);
1722 printf("-------- DONE -----------------------------------------------------------\n");
1729 debug_compile_inlined_code_counter++;
1735 bool inline_inline(jitdata *jd, methodinfo **resultmethod,
1747 printf("==== INLINE ==================================================================\n");
1749 stack_show_method(jd);
1752 iln = DNEW(inline_node);
1753 memset(iln,0,sizeof(inline_node));
1755 iln->ctx = (inline_context *) DMNEW(u1,sizeof(inline_context) + sizeof(inline_stack_translation) * 1000 /* XXX */);
1756 memset(iln->ctx,0,sizeof(inline_context));
1757 iln->ctx->master = iln;
1758 iln->ctx->stacktranslationstart = iln->ctx->stacktranslation - 1;
1759 iln->ctx->calls_others = false;
1762 /* we cannot use m->instructioncount because it may be greater than
1763 * the actual number of instructions in the basic blocks. */
1764 iln->instructioncount = 0;
1765 iln->cumul_instructioncount = 0;
1767 iln->stackcount = m->stackcount;
1768 iln->cumul_stackcount = m->stackcount;
1770 if (inline_inline_intern(m,jd,iln)) {
1773 printf("==== TEST INLINE =============================================================\n");
1778 test_inlining(iln,jd,resultmethod,resultjd);
1782 printf("-------- DONE -----------------------------------------------------------\n");
1790 * These are local overrides for various environment variables in Emacs.
1791 * Please do not remove this and leave it at the end of the file, where
1792 * Emacs will automagically detect them.
1793 * ---------------------------------------------------------------------
1796 * indent-tabs-mode: t
1800 * vim:noexpandtab:sw=4:ts=4: