You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mf...@apache.org on 2008/01/30 14:50:45 UTC

svn commit: r616763 - in /harmony/enhanced/drlvm/trunk/vm: include/ jitrino/config/em64t/ jitrino/config/ia32/ jitrino/src/codegenerator/ia32/ vmcore/build/ vmcore/src/class_support/

Author: mfursov
Date: Wed Jan 30 05:50:42 2008
New Revision: 616763

URL: http://svn.apache.org/viewvc?rev=616763&view=rev
Log:
Fix for HARMONY-5084 [drlvm][jit][opt] LightJNI optimization
Light JNI optimization was added to all modes, but turned off by default.

+I fixed osr_path alias -> made HIR cleaning sequence to clean after the optimization but not before. Now its save to turn it off in all modes.
+I added LIR api_magic optimization to EM64T files where it was missed


Added:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/include/jit_import.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/client.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/client.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/opt.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_static.emconf
    harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_import.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_import.h?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/jit_import.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/jit_import.h Wed Jan 30 05:50:42 2008
@@ -28,6 +28,7 @@
 #include "open/types.h"
 #include "open/vm.h"
 #include "jit_import_rt.h"
+#include "vm_core_types.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -582,6 +583,15 @@
  */
 
 VMEXPORT const void  *class_get_const_addr(Class_Handle ch, unsigned idx);
+
+/**
+* Looks for a method in native libraries of a class loader.
+*
+* @param[in] method - a searching native-method structure
+* @return The pointer to found a native function.
+* @note The function raises <code>UnsatisfiedLinkError</code> with a method name
+*       in an exception message, if the specified method is not found.*/
+VMEXPORT void* method_get_native_func_addr(Method_Handle method);
 
 /**
  * @return The JIT handle for a the current compilation. 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/client.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/client.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/client.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/client.emconf Wed Jan 30 05:50:42 2008
@@ -56,7 +56,7 @@
 -XX:jit.CD_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
 -XX:jit.CD_OPT.path.optimizer=ssa,devirt,inline,purge,simplify,dce,uce,memopt,simplify,dce,uce,lower,dessa,statprof
--XX:jit.CD_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.CD_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,light_jni-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.CD_OPT.path.dce1=cg_dce
 -XX:jit.CD_OPT.path.dce2=cg_dce
 -XX:jit.CD_OPT.path.regalloc=bp_regalloc1,bp_regalloc2

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/opt.emconf Wed Jan 30 05:50:42 2008
@@ -24,10 +24,10 @@
 
 -XX:jit.CS_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.CS_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,osr_path-,escape_path,dce,uce,memopt,simplify,dce,uce,lower,dessa,statprof
--XX:jit.CS_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.CS_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,escape_path,dce,uce,memopt,simplify,dce,uce,lower,dessa,statprof
+-XX:jit.CS_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.CS_OPT.path.escape_path=hvn,simplify,dce,uce,escape
--XX:jit.CS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.CS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,light_jni-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.CS_OPT.path.dce1=cg_dce
 -XX:jit.CS_OPT.path.dce2=cg_dce
 -XX:jit.CS_OPT.path.regalloc=bp_regalloc1,bp_regalloc2

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf Wed Jan 30 05:50:42 2008
@@ -66,7 +66,7 @@
 
 -XX:jit.SD1_OPT.path.optimizer=ssa,simplify,dce,uce,vp_instrument,devirt_virtual,edge_instrument,dessa,statprof
 -XX:jit.SD1_OPT.path.devirt_virtual=devirt
--XX:jit.SD1_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SD1_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,light_jni-,early_prop-,itrace-,native,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SD1_OPT.path.dce1=cg_dce
 -XX:jit.SD1_OPT.path.dce2=cg_dce
 
@@ -77,11 +77,11 @@
 #enable profiling of all virtual calls
 -XX:jit.SD1_OPT.arg.optimizer.vp_instrument.profile_abstract=true
 
--XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic,inline,purge,osr_path-,escape_path,dce,uce,hvn,dce,uce,inline_helpers,purge,simplify,uce,dce,uce,abce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
--XX:jit.SD2_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,escape_path,dce,uce,hvn,dce,uce,inline_helpers,purge,simplify,uce,dce,uce,abce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
+-XX:jit.SD2_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.SD2_OPT.path.escape_path=hvn,simplify,dce,uce,escape
 -XX:jit.SD2_OPT.path.abce=classic_abcd,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,memopt,dce,uce,dessa,fastArrayFill,ssa,statprof,dabce,dce,uce
--XX:jit.SD2_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SD2_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,light_jni-,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SD2_OPT.path.dce1=cg_dce
 -XX:jit.SD2_OPT.path.dce2=cg_dce
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server_static.emconf Wed Jan 30 05:50:42 2008
@@ -32,11 +32,11 @@
 
 -XX:jit.SS_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,statprof,devirt_virtual,unguard,devirt_intf,hlo_api_magic,inline,purge,osr_path-,escape_path,dce,uce,hvn,dce,uce,inline_helpers-,purge,simplify,uce,dce,uce,abce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
--XX:jit.SS_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,statprof,devirt_virtual,unguard,devirt_intf,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,escape_path,dce,uce,hvn,dce,uce,inline_helpers-,purge,simplify,uce,dce,uce,abce,lower,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
+-XX:jit.SS_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.SS_OPT.path.escape_path=hvn,simplify,dce,uce,escape
 -XX:jit.SS_OPT.path.abce=classic_abcd,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,memopt,dce,uce,dessa,fastArrayFill,ssa,statprof,dabce,dce,uce
--XX:jit.SS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SS_OPT.path.codegen=lock_method,bbp,gcpoints,cafl,dce1,i8l-,api_magic,light_jni-,early_prop-,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,layout,copy,rce-,stack,break-,iprof-,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SS_OPT.path.dce1=cg_dce
 -XX:jit.SS_OPT.path.dce2=cg_dce
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/client.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/client.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/client.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/client.emconf Wed Jan 30 05:50:42 2008
@@ -54,7 +54,7 @@
 -XX:jit.CD_OPT.path=opt_init,lock_method,translator,optimizer,hir2lir,codegen,unlock_method
 
 -XX:jit.CD_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,simplify,dce,uce,lazyexc,throwopt,memopt,simplify,dce,uce,lower,statprof,unroll,ssa,simplify,dce,uce,dessa,statprof
--XX:jit.CD_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
+-XX:jit.CD_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,light_jni-,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
 -XX:jit.CD_OPT.path.dce1=cg_dce
 -XX:jit.CD_OPT.path.dce2=cg_dce
 -XX:jit.CD_OPT.path.regalloc=bp_regalloc1,bp_regalloc2

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/opt.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/opt.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/opt.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/opt.emconf Wed Jan 30 05:50:42 2008
@@ -24,10 +24,10 @@
 
 -XX:jit.CS_OPT.path=opt_init,lock_method,translator,optimizer,hir2lir,codegen,unlock_method
 
--XX:jit.CS_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,osr_path-,simplify,dce,uce,lazyexc,throwopt,escape_path,dce,uce,memopt,simplify,dce,uce,lower,statprof,unroll,ssa,simplify,dce,uce,dessa,statprof
--XX:jit.CS_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.CS_OPT.path.optimizer=ssa,devirt,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,lazyexc,throwopt,escape_path,dce,uce,memopt,simplify,dce,uce,lower,statprof,unroll,ssa,simplify,dce,uce,dessa,statprof
+-XX:jit.CS_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.CS_OPT.path.escape_path=hvn,simplify,dce,uce,escape
--XX:jit.CS_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
+-XX:jit.CS_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,light_jni-,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
 -XX:jit.CS_OPT.path.dce1=cg_dce
 -XX:jit.CS_OPT.path.dce2=cg_dce
 -XX:jit.CS_OPT.path.regalloc=bp_regalloc1,bp_regalloc2

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf Wed Jan 30 05:50:42 2008
@@ -66,7 +66,7 @@
 
 -XX:jit.SD1_OPT.path.optimizer=ssa,simplify,dce,uce,vp_instrument,devirt_virtual,edge_instrument,dessa,statprof
 -XX:jit.SD1_OPT.path.devirt_virtual=devirt
--XX:jit.SD1_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
+-XX:jit.SD1_OPT.path.codegen=bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,light_jni-,early_prop,peephole,itrace-,native,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info
 -XX:jit.SD1_OPT.path.dce1=cg_dce
 -XX:jit.SD1_OPT.path.dce2=cg_dce
 
@@ -79,11 +79,11 @@
 
 -XX:jit.SD2_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic,inline,purge,osr_path-,simplify,dce,uce,lazyexc,throwopt,escape_path,inline_helpers,purge,simplify,uce,dce,uce,abce,lower,dce,uce,statprof,unroll,ssa,simplify,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
--XX:jit.SD2_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,edge_annotate,unguard,devirt_intf,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,lazyexc,throwopt,escape_path,inline_helpers,purge,simplify,uce,dce,uce,abce,lower,dce,uce,statprof,unroll,ssa,simplify,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
+-XX:jit.SD2_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.SD2_OPT.path.escape_path=hvn,simplify,dce,uce,escape
 -XX:jit.SD2_OPT.path.abce=classic_abcd,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,memopt,dce,uce,dessa,fastArrayFill,ssa,statprof,dabce,dce,uce
--XX:jit.SD2_OPT.path.codegen=lock_method,bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,early_prop,peephole,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SD2_OPT.path.codegen=lock_method,bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,light_jni-,early_prop,peephole,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SD2_OPT.path.dce1=cg_dce
 -XX:jit.SD2_OPT.path.dce2=cg_dce
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_static.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_static.emconf?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_static.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_static.emconf Wed Jan 30 05:50:42 2008
@@ -32,11 +32,11 @@
 
 -XX:jit.SS_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
 
--XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,statprof,unguard,devirt_intf,hlo_api_magic,inline,purge,osr_path-,simplify,dce,uce,lazyexc,throwopt,escape_path,inline_helpers-,purge,simplify,uce,dce,uce,abce,lower,dce,uce,statprof,unroll,ssa,simplify,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
--XX:jit.SS_OPT.path.osr_path=simplify,dce,uce,gcm,osr
+-XX:jit.SS_OPT.path.optimizer=ssa,simplify,dce,uce,devirt_virtual,statprof,unguard,devirt_intf,hlo_api_magic,inline,purge,simplify,dce,uce,osr_path-,lazyexc,throwopt,escape_path,inline_helpers-,purge,simplify,uce,dce,uce,abce,lower,dce,uce,statprof,unroll,ssa,simplify,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,gcm,dessa,statprof
+-XX:jit.SS_OPT.path.osr_path=gcm,osr,simplify,dce,uce
 -XX:jit.SS_OPT.path.escape_path=hvn,simplify,dce,uce,escape
 -XX:jit.SS_OPT.path.abce=classic_abcd,dce,uce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,memopt,dce,uce,dessa,fastArrayFill,ssa,statprof,dabce,dce,uce
--XX:jit.SS_OPT.path.codegen=lock_method,bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,early_prop,peephole,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info,unlock_method
+-XX:jit.SS_OPT.path.codegen=lock_method,bbp,btr,gcpoints,cafl,dce1,i8l,api_magic,light_jni-,early_prop,peephole,itrace-,native,cg_fastArrayFill,constraints,dce2,regalloc,spillgen,copy,i586,layout,rce+,stack,break-,iprof-,peephole,emitter!,si_insts,gcmap,info,unlock_method
 -XX:jit.SS_OPT.path.dce1=cg_dce
 -XX:jit.SS_OPT.path.dce2=cg_dce
 

Added: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp?rev=616763&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp Wed Jan 30 05:50:42 2008
@@ -0,0 +1,259 @@
+/*
+*  Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  See the NOTICE file distributed with
+*  this work for additional information regarding copyright ownership.
+*  The ASF licenses this file to You under the Apache License, Version 2.0
+*  (the "License"); you may not use this file except in compliance with
+*  the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*/
+
+/**
+* @author Yuri Kashnikov
+*/
+
+#include "PMFAction.h"
+#include "Ia32Inst.h"
+#include "Ia32IRManager.h"
+#include "methodtable.h"
+
+
+#define PRAGMA_UNINTERRUPTIBLE "org/vmmagic/pragma/Uninterruptible"
+
+namespace Jitrino {
+namespace Ia32{
+
+        
+
+class LightJNIAction: public Action {
+public:
+    LightJNIAction():_myMM("LightJNIAction"){}
+    void init();
+    Method_Table* getOFTable() { return lightJNIMethodTable;}
+protected:
+    MemoryManager _myMM;
+    Method_Table* lightJNIMethodTable;    
+};
+
+
+
+class LightJNISession : public SessionAction { 
+protected: 
+    void runImpl(); 
+    uint32 getSideEffects()const{ return 0; }
+    const char* getName() { return "light_jni"; } 
+    bool isInOptimizationTable(Method_Table* table, MethodDesc* mmd);
+    void derefIfObject(CallInst* callInst, Opnd* origRetOpnd);
+    
+    CompilationContext* cc;
+    IRManager* lirm;
+    ControlFlowGraph* fg;
+
+};
+
+ActionFactory<LightJNISession, LightJNIAction> light_jni("light_jni");
+
+void LightJNIAction::init() 
+{
+    const char* lightJNIMethods = getStringArg("light_jni_methods", NULL);
+    lightJNIMethodTable = new (_myMM) Method_Table(_myMM, lightJNIMethods, "LIGHTJNI_METHODS", false);
+    Method_Table::Decision des = Method_Table::mt_accepted;
+        
+    
+    // java/lang/Math
+    lightJNIMethodTable->add_method_record("java/lang/Math","cos","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","asin","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","acos","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","atan","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","atan2","(DD)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","cbrt","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","ceil","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","cos","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","cosh","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","exp","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","expm1","(D)D", des, false);
+
+    lightJNIMethodTable->add_method_record("java/lang/Math","floor","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","hypot","(DD)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","IEEEremainder","(DD)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","log","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","log10","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","log1p","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","pow","(DD)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","rint","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","sin","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","sinh","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","sqrt","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","tan","(D)D", des, false);
+    lightJNIMethodTable->add_method_record("java/lang/Math","tanh","(D)D", des, false);
+
+}
+
+
+bool LightJNISession::isInOptimizationTable(Method_Table* table, MethodDesc * mmd)
+{
+    
+    const char* className = mmd->getParentType()->getName();
+    const char* methodName = mmd->getName();
+    const char* sigName = mmd->getSignatureString();
+    bool optResult = table->accept_this_method(className,methodName, sigName);
+    return optResult;
+}
+
+
+void LightJNISession::derefIfObject(CallInst* callInst, Opnd* origRetOpnd)
+{
+    Node* node = callInst->getNode();
+    Type* origRetType = origRetOpnd->getType();
+    Opnd* retOpnd = callInst->getOpnd(0);
+    if (callInst != node->getLastInst()) {
+        fg->splitNodeAtInstruction(callInst, true, true, NULL);
+    }
+   
+    node = callInst->getNode();
+    Node* nextNode = node->getUnconditionalEdgeTarget();    
+    assert(nextNode!=NULL);
+    fg->removeEdge(node->getUnconditionalEdge());
+
+    Node* zeroObject = fg->createBlockNode();                                
+    Node* nonZeroObject = fg->createBlockNode();
+
+    //TODO: EM64T!
+    Inst* cmpZeroInst = lirm->newInst(Mnemonic_CMP, retOpnd, lirm->newImmOpnd(retOpnd->getType(), 0));
+    Inst* jumpZeroInst = lirm->newBranchInst(Mnemonic_JE, zeroObject, nonZeroObject);
+    // cmp eax, 0 ; eax = retOpnd
+    // je @zeroObject
+    cmpZeroInst->insertAfter(callInst);
+    jumpZeroInst->insertAfter(cmpZeroInst);
+
+    // @zeroObject:
+    // mov eax,(NullObject)0 ; eax = retOpnd
+    Inst* movResZero = lirm->newInst(Mnemonic_MOV, origRetOpnd, lirm->newImmOpnd(lirm->getTypeManager().getNullObjectType(), 0));
+    zeroObject->appendInst(movResZero);                                
+
+    // @nonZeroObject:
+    // mov eax, [eax] ; eax = retOpnd
+    Inst* movResRes = lirm->newInst(Mnemonic_MOV, origRetOpnd, lirm->newMemOpndAutoKind(origRetType, retOpnd));
+    nonZeroObject->appendInst(movResRes);
+
+    // link nodes
+    fg->addEdge(node, nonZeroObject, 0.9);
+    fg->addEdge(node, zeroObject, 0.1);
+    fg->addEdge(zeroObject, nextNode);
+    fg->addEdge(nonZeroObject, nextNode);
+}
+
+void LightJNISession::runImpl() {
+    LightJNIAction* action = (LightJNIAction*)getAction();
+    Method_Table* tmpT = action->getOFTable();
+    cc = getCompilationContext();
+    MemoryManager tmpMM("tmp_lightjni_session");
+    lirm = cc->getLIRManager();
+    fg = lirm->getFlowGraph();
+    NamedType* uninterruptiblePragma = NULL;
+    TypeManager& tm = lirm->getTypeManager();
+
+    // @Uninterruptible pragma
+    uninterruptiblePragma = lirm->getCompilationInterface().findClassUsingBootstrapClassloader(PRAGMA_UNINTERRUPTIBLE);
+
+    StlVector<CallInst*> callsToOptimize(tmpMM);
+    const Nodes& nodes = fg->getNodesPostOrder();//process checking only reachable nodes.
+    for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
+        Node* node = *it;
+        if (node->isBlockNode()) {
+            for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst()) {
+                if (!inst->hasKind(Inst::Kind_CallInst) || !((CallInst*)inst)->isDirect()) {
+                    continue;
+                }
+
+                CallInst* callInst = (CallInst*)inst;
+                Opnd * targetOpnd=callInst->getOpnd(callInst->getTargetOpndIndex());
+
+                assert(targetOpnd->isPlacedIn(OpndKind_Imm));
+                Opnd::RuntimeInfo * ri=targetOpnd->getRuntimeInfo();
+                if( !ri || ri->getKind() != Opnd::RuntimeInfo::Kind_MethodDirectAddr) { 
+                    continue; 
+                };
+
+                MethodDesc * md = (MethodDesc*)ri->getValue(0);
+
+                if (!md->isNative()) {
+                    continue;
+                }
+                if (!isInOptimizationTable(tmpT, md)) {
+                     if (uninterruptiblePragma==NULL || !md->hasAnnotation(uninterruptiblePragma)){
+                        continue;
+                     }
+                }
+                callsToOptimize.push_back(callInst);
+            }
+        }
+    }
+
+
+    for (StlVector<CallInst*>::const_iterator it = callsToOptimize.begin(), end = callsToOptimize.end(); it!=end; ++it) {
+        CallInst* callInst = *it;
+
+        Opnd * targetOpnd=callInst->getOpnd(callInst->getTargetOpndIndex());
+        assert(targetOpnd->isPlacedIn(OpndKind_Imm));
+        Opnd::RuntimeInfo * ri=targetOpnd->getRuntimeInfo();
+        assert( ri && ri->getKind() == Opnd::RuntimeInfo::Kind_MethodDirectAddr);
+        MethodDesc * md = (MethodDesc*)ri->getValue(0);
+
+//        printf("optimize %s::%s %s\n", md->getParentType()->getName(), md->getName(), md->getSignatureString());
+
+        void* tmpPoint = method_get_native_func_addr(md->getMethodHandle());
+        Opnd* tmpZero = lirm->newImmOpnd(lirm->getTypeManager().getIntPtrType(), 0);
+        uint32 tmpNumArgs = callInst->getOpndCount();
+        CallInst* newCallInst = NULL;
+        Opnd* origRetOpnd = callInst->getOpnd(0);
+        //const char* mmthName = md->getName();
+        Opnd* newRetOpnd = origRetOpnd;
+        bool deref = origRetOpnd->getType()->isObject();
+        if (deref) {
+            newRetOpnd = lirm->newOpnd(tm.getUnmanagedPtrType(tm.getUInt8Type()));
+        }
+        if (md->isInstance()){
+            Opnd ** tmpOpnds = new (tmpMM) Opnd*[tmpNumArgs-1];
+            Opnd* newTargetOpnd = lirm->newImmOpnd(tm.getIntPtrType(), ((POINTER_SIZE_INT)tmpPoint));
+
+            tmpOpnds[0] = tmpZero;
+            for (uint32 i = 2; i<tmpNumArgs; i++) {
+                tmpOpnds[i-1] = callInst->getOpnd(i);
+            }
+            newCallInst = lirm->newCallInst(newTargetOpnd, &CallingConvention_STDCALL, tmpNumArgs - 1, tmpOpnds, newRetOpnd);
+        } else  {
+            assert(md->isStatic());
+            Opnd ** tmpOpnds = new (tmpMM) Opnd*[tmpNumArgs];
+            Opnd* newTargetOpnd = lirm->newImmOpnd(tm.getIntPtrType(), ((POINTER_SIZE_INT)tmpPoint));
+            Opnd* tmpClassName = lirm->newImmOpnd(tm.getIntPtrType(), (POINTER_SIZE_INT)(md->getParentHandle()));
+            tmpOpnds[0] = tmpZero;
+            tmpOpnds[1] = tmpClassName;
+            for (uint32 i = 2; i<tmpNumArgs; i++){
+                tmpOpnds[i] = callInst->getOpnd(i);
+            }
+            newCallInst = lirm->newCallInst(newTargetOpnd, &CallingConvention_STDCALL, tmpNumArgs, tmpOpnds, newRetOpnd);
+        }
+
+        newCallInst->setBCOffset(callInst->getBCOffset());
+        newCallInst->insertBefore(callInst);
+        callInst->unlink();
+
+        if (deref) {
+            derefIfObject(newCallInst, origRetOpnd);
+        }
+
+        if (Log::isEnabled()) {
+            Log::out() << "changing for method"  << md->getParentType()->getName() << "_" << md->getName() << "_" << md->getSignatureString() << std::endl;
+        }
+      }
+}
+}} //namespace
+

Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32LightJNI.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp Wed Jan 30 05:50:42 2008
@@ -508,6 +508,7 @@
     method_get_max_stack;
     method_get_method_jit;
     method_get_name;
+    method_get_native_func_addr;
     method_get_next_method_jit;
     method_get_num_handlers;
     method_get_offset;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=616763&r1=616762&r2=616763&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Wed Jan 30 05:50:42 2008
@@ -927,6 +927,9 @@
 } //class_get_const_addr
 
 
+void* method_get_native_func_addr(Method_Handle method) {
+    return (void*)classloader_find_native(method);
+}
 
 Arg_List_Iterator method_get_argument_list(Method_Handle m)
 {