* src/vm/global.h [ENABLE_ESCAPE_CHECK] add additional fields to java_object_t for escape analysis verification.
* src/vm/jit/asmpart.h,
src/vm/jit/i386/asmpart.S [ENABLE_ESCAPE_CHECK] (asm_escape_check): new symbol.
* src/vm/jit/i386/codegen.c [ENABLE_ESCAPE_CHECK] (codegen_emit): First stetps of annotating all objects with escape information and checking that information upon every access to an object.
* src/vm/jit/i386/emit.c,
src/vm/jit/i386/emit.h (emit_escape_check): New symbol.
* src/vm/jit/optimizing/escape.c (escape_analysis_escape_check): New symbol.
AC_MSG_RESULT(${ENABLE_SSA})
AM_CONDITIONAL([ENABLE_SSA], test x"${ENABLE_SSA}" = "xyes")
AM_CONDITIONAL([ENABLE_ESCAPE], test x"${ENABLE_SSA}" = "xyes")
+AM_CONDITIONAL([ENABLE_ESCAPE_CHECK], test x"${ENABLE_SSA}" = "xyes")
if test x"${ENABLE_SSA}" = "xyes"; then
AC_DEFINE([ENABLE_SSA], 1, [enable lsra with ssa])
AC_DEFINE([ENABLE_ESCAPE], 1, [enable escape analysis with ssa])
+ AC_DEFINE([ENABLE_ESCAPE_CHECK], 1, [enable generating code to validate escape analysis results])
ENABLE_LSRA="no"
fi
#if defined(ENABLE_GC_CACAO)
uintptr_t hdrflags; /* word containing the GC bits */
#endif
+#if defined(ENABLE_ESCAPE_CHECK)
+ void *method;
+ void *thread;
+ uintptr_t escape;
+#endif
};
void *md_asm_codegen_get_pv_from_pc(void *ra);
+#if defined(ENABLE_ESCAPE_CHECK)
+void asm_escape_check(java_object_t *obj);
+#endif
+
#endif /* _ASMPART_H */
.globl asm_get_cycle_count
+#if defined(ENABLE_ESCAPE_CHECK)
+ .globl asm_escape_check
+#endif
+
/* asm_md_init *****************************************************************
rdtsc
ret
+#if defined(ENABLE_ESCAPE_CHECK)
+asm_escape_check:
+ sub $24,%esp
+
+ mov t0, 4(%esp)
+ mov itmp1, 8(%esp)
+ mov itmp2, 12(%esp)
+ mov itmp3, 16(%esp)
+
+ mov 28(%esp), itmp1
+ mov itmp1, (%esp)
+
+ call escape_analysis_escape_check
+
+ mov 4(%esp), t0
+ mov 8(%esp), itmp1
+ mov 12(%esp), itmp2
+ mov 16(%esp), itmp3
+
+ add $24,sp
+ ret
+#endif
+
/* disable exec-stacks ********************************************************/
.section .note.GNU-stack,"",%progbits
#endif
-
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
emit_nullpointer_check(cd, iptr, s1);
+#if defined(ENABLE_ESCAPE_CHECK)
+ emit_escape_check(cd, s1);
+#endif
+
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
uf = iptr->sx.s23.s3.uf;
fieldtype = uf->fieldref->parseddesc.fd->type;
M_MOV_IMM(bte->stub, REG_ITMP1);
}
M_CALL(REG_ITMP1);
+
+#if defined(ENABLE_ESCAPE_CHECK)
+ if (bte->opcode == ICMD_NEW || bte->opcode == ICMD_NEWARRAY) {
+ emit_esape_annotate_object(cd, m);
+ }
+#endif
break;
case ICMD_INVOKESPECIAL:
*(cd->mcodeptr++) = 0xf7;
}
+#if defined(ENABLE_ESCAPE_CHECK)
+void emit_escape_check(codegendata *cd, s4 reg) {
+ M_PUSH(reg);
+ M_MOV_IMM(asm_escape_check, REG_ITMP3);
+ M_CALL(REG_ITMP3);
+ M_IADD_IMM(4, REG_SP);
+}
+#endif
/*
* These are local overrides for various environment variables in Emacs.
void emit_fdecstp(codegendata *cd);
void emit_fincstp(codegendata *cd);
+#if defined(ENABLE_ESCAPE_CHECK)
+void emit_escape_check(codegendata *cd, s4 reg);
+void emit_esape_annotate_object(codegendata *cd, methodinfo *m);
+#endif
+
#endif /* _EMITFUNCS_H */
jd->m->flags &= ~ACC_METHOD_EA;
}
+void escape_analysis_escape_check(void *vp) {
+}