harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfur...@apache.org
Subject svn commit: r595607 - in /harmony/enhanced/drlvm/trunk/vm: gc_cc/src/ gc_gen/src/common/ include/ jitrino/config/em64t/ jitrino/config/ia32/ jitrino/src/dynopt/ jitrino/src/jet/ jitrino/src/optimizer/ vmcore/build/ vmcore/src/init/ vmcore/src/jit/ vmco...
Date Fri, 16 Nov 2007 09:23:51 GMT
Author: mfursov
Date: Fri Nov 16 01:23:49 2007
New Revision: 595607

URL: http://svn.apache.org/viewvc?rev=595607&view=rev
Log:
Fix for HARMONY-5024 [drlvm][helper] Registry for magic helpers
Fix for HARMONY-4980 [drlvm][jit] server emconf with aggressive optimizations parameters
Minor fix in JET to avoid exact type comparison for magic->not magic moves.


Added:
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf
Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/EdgeProfiler.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java

Modified: harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp Fri Nov 16 01:23:49 2007
@@ -28,6 +28,7 @@
 #include "open/vm_gc.h"
 #include "open/gc.h"
 #include "jit_intf.h"
+#include "jit_runtime_support.h"
 #include <assert.h>
 #include "gc_types.h"
 #include "cxxlog.h"
@@ -291,6 +292,13 @@
     assert(mark_bits != MEM_FAILURE);
 }
 
+static void init_gc_helpers()
+{
+    set_property("vm.component.classpath.gc_cc", "gc_cc.jar", VM_PROPERTIES);
+    vm_helper_register_magic_helper(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "org/apache/harmony/drlvm/gc_cc/GCHelper", "alloc");
+    vm_helper_register_magic_helper(VM_RT_NEW_VECTOR_USING_VTABLE, "org/apache/harmony/drlvm/gc_cc/GCHelper", "allocArray");
+}
+
 int gc_init() {
     INFO2("gc.init", "GC init called\n");
 
@@ -310,6 +318,8 @@
     init_select_gc();
     gc_end = apr_time_now();
     timer_init();
+
+    init_gc_helpers();
 
     return JNI_OK;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Fri Nov 16 01:23:49 2007
@@ -22,6 +22,7 @@
 #include <cxxlog.h>
 #include "port_sysinfo.h"
 #include "vm_threads.h"
+#include "jit_runtime_support.h"
 #include "compressed_ref.h"
 
 #include "../gen/gen.h"
@@ -53,6 +54,13 @@
   SPACE_ALLOC_UNIT = max(gc->_system_alloc_unit, GC_BLOCK_SIZE_BYTES);
 }
 
+static void init_gc_helpers()
+{
+    set_property("vm.component.classpath.gc_gen", "gc_gen.jar", VM_PROPERTIES);
+    vm_helper_register_magic_helper(VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "org/apache/harmony/drlvm/gc_gen/GCHelper", "alloc");
+    vm_helper_register_magic_helper(VM_RT_NEW_VECTOR_USING_VTABLE,  "org/apache/harmony/drlvm/gc_gen/GCHelper", "allocArray");
+}
+
 int gc_init() 
 {
   INFO2("gc.process", "GC: call GC init...\n");
@@ -103,6 +111,8 @@
   collector_initialize(gc);
   
   gc_init_heap_verification(gc);
+
+  init_gc_helpers();
   
   mutator_need_block = FALSE;
 

Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/jit_runtime_support.h Fri Nov 16 01:23:49 2007
@@ -19,6 +19,7 @@
 #define _JIT_RUNTIME_SUPPORT_H_
 
 #include "open/types.h"
+#include "jni_types.h"
 
 /**
  * This is a complete set of functions used by the code generated by the JIT.
@@ -774,6 +775,18 @@
 * If the helperName is unknown, then VM_RT_UNKNOWN is returned.
 */
 VMEXPORT VM_RT_SUPPORT vm_helper_get_by_name(const char* name);
+
+#ifndef Global_Env
+struct Global_Env;
+#endif
+
+jint helper_magic_init(Global_Env * vm_env);
+
+VMEXPORT jint vm_helper_register_magic_helper(VM_RT_SUPPORT id, 
+                                   const char* class_name, 
+                                   const char* method_name);
+
+VMEXPORT Method_Handle vm_helper_get_magic_helper(VM_RT_SUPPORT id);
 
 #ifdef __cplusplus
 }

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=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf Fri Nov 16 01:23:49 2007
@@ -99,40 +99,26 @@
 -XX:jit.SD2_OPT.SD2_OPT_helper_inliner_pipeline.path=ssa
 -XX:jit.SD2_OPT.arg.optimizer.inline_helpers.pipeline=SD2_OPT_helper_inliner_pipeline
 
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj=off
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_className=org/apache/harmony/drlvm/gc_cc/GCHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_methodName=alloc
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray=off
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_className=org/apache/harmony/drlvm/gc_cc/GCHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_methodName=allocArray
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_className=org/apache/harmony/drlvm/thread/ThreadHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_methodName=monitorEnterUseReservation
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_className=org/apache/harmony/drlvm/thread/ThreadHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_methodName=monitorExit
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface=off
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_methodName=getInterfaceVTable3
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast=off
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_methodName=checkCast
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf=off
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_methodName=instanceOf
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_hotnessPercent=1
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE=off
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE=off
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0=off
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST=off
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF=off
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF_hotnessPercent=1
 
 
 -XX:jit.SD2_OPT.arg.codegen.dce1.early=yes
@@ -140,16 +126,3 @@
 
 #system properties
 -Djava.compiler=server
-
-#GC magics support
--Dvm.components.gc_cc.startupclass=org.apache.harmony.drlvm.gc_cc.GCHelper
--XX:vm.component.classpath.gc_cc=gc_cc.jar
-
-#TM properties
--Dvm.components.hythr.startupclass=org.apache.harmony.drlvm.thread.ThreadHelper
--XX:vm.component.classpath.hythr=hythr.jar
-
-#VM helpers
--Dvm.components.vmcore1.startupclass=org.apache.harmony.drlvm.VMHelper
--Dvm.components.vmcore2.startupclass=org.apache.harmony.drlvm.VMHelperFastPath
-

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=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf Fri Nov 16 01:23:49 2007
@@ -100,40 +100,26 @@
 -XX:jit.SD2_OPT.SD2_OPT_helper_inliner_pipeline.path=ssa
 -XX:jit.SD2_OPT.arg.optimizer.inline_helpers.pipeline=SD2_OPT_helper_inliner_pipeline
 
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_className=org/apache/harmony/drlvm/gc_gen/GCHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_methodName=alloc
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newObj_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_className=org/apache/harmony/drlvm/gc_gen/GCHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_methodName=allocArray
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.newArray_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_className=org/apache/harmony/drlvm/thread/ThreadHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_methodName=monitorEnterUseReservation
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonEnter_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_className=org/apache/harmony/drlvm/thread/ThreadHelper
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_methodName=monitorExit
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.objMonExit_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_methodName=getInterfaceVTable3
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.ldInterface_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_methodName=checkCast
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.checkCast_hotnessPercent=1
-
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf=on
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_className=org/apache/harmony/drlvm/VMHelperFastPath
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_methodName=instanceOf
--XX:jit.SD2_OPT.arg.optimizer.inline_helpers.instanceOf_hotnessPercent=1
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF_hotnessPercent=1
 
 -XX:jit.SD2_OPT.arg.codegen.dce1.early=yes
 -XX:jit.SD2_OPT.arg.codegen.btr.insertCMOVs=no
@@ -142,16 +128,3 @@
 
 #system properties
 -Djava.compiler=server
-
-#GC magics support
--Dvm.components.gc_gen.startupclass=org.apache.harmony.drlvm.gc_gen.GCHelper
--XX:vm.component.classpath.gc_gen=gc_gen.jar
-
-#TM properties
--Dvm.components.hythr.startupclass=org.apache.harmony.drlvm.thread.ThreadHelper
--XX:vm.component.classpath.hythr=hythr.jar
-
-#VM helpers
--Dvm.components.vmcore1.startupclass=org.apache.harmony.drlvm.VMHelper
--Dvm.components.vmcore2.startupclass=org.apache.harmony.drlvm.VMHelperFastPath
-

Added: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf?rev=595607&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf Fri Nov 16 01:23:49 2007
@@ -0,0 +1,154 @@
+# 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.
+
+#EM configuration for 'server' mode of Jitrino
+chains=chain1,chain2
+chain1.jits=JET_CLINIT
+chain2.jits=SD1_OPT,SD2_OPT
+
+chain1.filter=+::<clinit>
+chain1.filter=-
+
+JET_CLINIT.file=jitrino
+SD1_OPT.file=jitrino
+SD2_OPT.file=jitrino
+
+# Edge profiler and recompilation parameters
+EDGE_PROF.profilerType=EDGE_PROFILER
+EDGE_PROF.entryThreshold=40000
+EDGE_PROF.backedgeThreshold=150000
+EDGE_PROF.tbsTimeout=10
+EDGE_PROF.tbsInitialTimeout=0
+
+VALUE_PROF.profilerType=VALUE_PROFILER
+VALUE_PROF.vpalgo=TNV_FIRST_N
+VALUE_PROF.vpSteadySize=4
+SD1_OPT.genProfile=EDGE_PROF,VALUE_PROF
+SD2_OPT.useProfile=EDGE_PROF,VALUE_PROF
+
+#options for JIT
+
+-XX:jit.JET_CLINIT.path=
+
+#register allocator configuration
+-XX:jit.RA2.filter=-
+-XX:jit.RA2.path=bp_regalloc1,bp_regalloc2
+-XX:jit.RA2.path.bp_regalloc1=bp_regalloc
+-XX:jit.RA2.path.bp_regalloc2=bp_regalloc
+-XX:jit.RA2.arg.bp_regalloc1.regs=ALL_GP
+-XX:jit.RA2.arg.bp_regalloc2.regs=ALL_XMM
+-XX:jit.RA3.filter=-
+-XX:jit.RA3.path=webmaker,cg_regalloc,spillgen
+-XX:jit.RA3.arg.webmaker.calc=true
+-XX:jit.arg.codegen.regalloc.opnds=5000
+
+-XX:jit.SD1_OPT.path=opt_init,lock_method,translator,optimizer,hir2lir,codegen,unlock_method
+
+
+-XX:jit.SD1_OPT.path.optimizer=ssa,simplify,dce,uce,vp_instrument,edge_instrument,dessa,statprof
+-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.dce1=cg_dce
+-XX:jit.SD1_OPT.path.dce2=cg_dce
+
+-XX:jit.SD1_OPT.arg.codegen.dce1.early=yes
+-XX:jit.SD1_OPT.arg.codegen.btr.insertCMOVs=no
+-XX:jit.SD1_OPT.arg.codegen.btr.removeConstCompare=yes
+
+#enable profiling of all virtual calls
+-XX:jit.SD1_OPT.arg.optimizer.vp_instrument.profile_all_virtual=true
+
+
+-XX:jit.SD2_OPT.path=opt_init,translator,optimizer,hir2lir,codegen
+
+-XX:jit.SD2_OPT.path.optimizer=ssa,simplify,dce,uce,edge_annotate,devirt,inline,purge,simplify,dce,uce,lazyexc,throwopt,so2-,simplify,dce,uce,escape,inline_helpers,purge,simplify,uce,dce,dessa,statprof,peel,ssa,hvn,simplify,dce,uce,lower,dce,uce,statprof,unroll,ssa,simplify,dce,uce,memopt,reassoc,dce,uce,hvn,dce,uce,classic_abcd,dce,uce,gcm,dessa,fastArrayFill,statprof,markglobals
+-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.dce1=cg_dce
+-XX:jit.SD2_OPT.path.dce2=cg_dce
+
+#devirt configuration
+-XX:jit.SD2_OPT.arg.optimizer.devirt.devirt_intf_calls=true
+-XX:jit.SD2_OPT.arg.optimizer.devirt.devirt_abstract_calls=true
+-XX:jit.SD2_OPT.arg.optimizer.devirt.devirt_virtual_calls=true
+-XX:jit.SD2_OPT.arg.optimizer.devirt.devirt_using_profile=true
+
+#inliner configuration
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.filter=-
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.path=ssa,simplify,dce,uce,edge_annotate,devirt
+-XX:jit.SD2_OPT.arg.optimizer.inline.pipeline=SD2_OPT_inliner_pipeline
+-XX:jit.SD2_OPT.arg.optimizer.inline.connect_early=false
+#devirt configuration for inliner pipeline
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.arg.devirt.devirt_intf_calls=true
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.arg.devirt.devirt_abstract_calls=true
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.arg.devirt.devirt_virtual_calls=true
+-XX:jit.SD2_OPT.SD2_OPT_inliner_pipeline.arg.devirt.devirt_using_profile=true
+
+#helper inliner configuration
+-XX:jit.SD2_OPT.SD2_OPT_helper_inliner_pipeline.filter=-
+-XX:jit.SD2_OPT.SD2_OPT_helper_inliner_pipeline.path=ssa
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.pipeline=SD2_OPT_helper_inliner_pipeline
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_NEW_VECTOR_USING_VTABLE_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_ENTER_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_MONITOR_EXIT_NON_NULL_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_GET_INTERFACE_VTABLE_VER0_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_CHECKCAST_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF=on
+-XX:jit.SD2_OPT.arg.optimizer.inline_helpers.VM_RT_INSTANCEOF_hotnessPercent=1
+
+-XX:jit.SD2_OPT.arg.codegen.dce1.early=yes
+-XX:jit.SD2_OPT.arg.codegen.btr.insertCMOVs=no
+-XX:jit.SD2_OPT.arg.codegen.btr.removeConstCompare=yes
+-XX:jit.arg.codegen.emitter.align=4
+
+#system properties
+-Djava.compiler=server
+
+-XDjit.arg.optimizer.inline.growth_factor=210
+-XDjit.arg.optimizer.inline.min_stop=280
+-XDjit.arg.optimizer.inline.min_benefit_threshold=70
+-XDjit.arg.optimizer.inline.inline_small_method_max_size=67
+-XDjit.arg.optimizer.inline.inline_small_method_bonus=780
+-XDjit.arg.optimizer.inline.medium_method_max_size=1200
+-XDjit.arg.optimizer.inline.medium_method_bonus=770
+-XDjit.arg.optimizer.inline.large_method_min_size=1360
+-XDjit.arg.optimizer.inline.large_method_penalty=480
+-XDjit.arg.optimizer.inline.loop_bonus=140
+-XDjit.arg.optimizer.inline.leaf_bonus=2680
+-XDjit.arg.optimizer.inline.synch_bonus=50
+-XDjit.arg.optimizer.inline.recursion_penalty=730
+-XDjit.arg.optimizer.inline.exact_single_parameter_bonus=120
+-XDjit.arg.optimizer.inline.exact_all_parameter_bonus=170
+-XDjit.arg.optimizer.inline.skip_exception_path=true
+-XDjit.arg.optimizer.inline.connect_early=true
+-XDjit.arg.optimizer.inline.skip_api_magics=true
+-XDjit.arg.optimizer.inline.sync_optcatch=false
+-XDjit.arg.optimizer.inline.sync_optimistic=true
+	
+
+-XX:jit.arg.lazyResolution=off
+

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/EdgeProfiler.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/EdgeProfiler.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/EdgeProfiler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/dynopt/EdgeProfiler.cpp Fri Nov 16 01:23:49 2007
@@ -287,7 +287,7 @@
         Edge* edge = *it;
         uint32 key = genKey(n, edge, bcLevelProfiling, debug);
         uint32* counterAddr = profile->getCounter(key);
-        assert(bcLevelProfiling || counterAddr!=NULL);
+        //assert(bcLevelProfiling || counterAddr!=NULL); -> TODO: hits in lazy resolution mode
         uint32 freq = 0;
         if (counterAddr == NULL) {
             if (!bcLevelProfiling) { //avoid crash, use static profiler for a method

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp Fri Nov 16 01:23:49 2007
@@ -76,7 +76,7 @@
         c->vpush(dst); //push result
     } else { // expansion
         assert(srcSize<dstSize);
-        c->do_mov(dst, src); //fill lower part -> dst
+        c->do_mov(dst, src, true); //fill lower part -> dst
         Opnd hi(jt, c->g_iconst_0); //fill hi part with 0
         c->vpop(); //pop old value
         c->vpush2(dst, hi); //push new value

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp Fri Nov 16 01:23:49 2007
@@ -1528,7 +1528,7 @@
     if(Log::isEnabled()) {
         Type* srcType = src->getType();
         bool convOk = retType == srcType;
-        convOk = convOk || (retType->isObject() && srcType->isObject());
+        convOk = convOk || (retType->isObject() && (srcType->isObject() || srcType->isUnmanagedPtr()));
         if (!convOk){
             assert(!typeManager->isLazyResolutionMode());
             Log::out() << "ERROR   !!!!  IRBuilder: unimplemented: ret typecheck !!!\n";

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Fri Nov 16 01:23:49 2007
@@ -28,34 +28,29 @@
 
 namespace Jitrino {
 
+class HelperConfig {
+public:
+    HelperConfig(VM_RT_SUPPORT id) : helperId(id), doInlining(true), hotnessPercentToInline(0) {}
+    VM_RT_SUPPORT helperId;
+    bool          doInlining;
+    uint32        hotnessPercentToInline;
+};    
+
 struct HelperInlinerFlags {
-    const char* inlinerPipelineName;
+    HelperInlinerFlags(MemoryManager& mm) 
+        : inlinerPipelineName(NULL), opcodeToHelperMapping(mm), helperConfigs(mm){}
 
-    bool insertInitilizers;
-    bool doInlining;
+    const char* inlinerPipelineName;
 
-#define DECLARE_STANDARD_HELPER_FLAGS(name) \
-    bool  name##_doInlining;\
-    uint32   name##_hotnessPercentToInline;\
-    const char* name##_className;\
-    const char* name##_methodName;\
-    const char* name##_signature;\
-
-DECLARE_STANDARD_HELPER_FLAGS(newObj);
-DECLARE_STANDARD_HELPER_FLAGS(newArray);
-DECLARE_STANDARD_HELPER_FLAGS(objMonEnter);
-DECLARE_STANDARD_HELPER_FLAGS(objMonExit);
-DECLARE_STANDARD_HELPER_FLAGS(wb);
-DECLARE_STANDARD_HELPER_FLAGS(ldInterface);
-DECLARE_STANDARD_HELPER_FLAGS(checkCast);
-DECLARE_STANDARD_HELPER_FLAGS(instanceOf);
-    
+    StlMap<Opcode, VM_RT_SUPPORT> opcodeToHelperMapping;
+    StlMap<VM_RT_SUPPORT, HelperConfig*> helperConfigs;
 };
 
 class HelperInlinerAction: public Action {
 public:
-    HelperInlinerAction() {}
+    HelperInlinerAction() : flags(Jitrino::getGlobalMM()) {}
     void init();
+    void registerHelper(Opcode opcode, VM_RT_SUPPORT helperId);
     HelperInlinerFlags& getFlags() {return flags;}
 protected:
     HelperInlinerFlags flags;
@@ -65,59 +60,35 @@
 
 void HelperInlinerAction::init() {
     flags.inlinerPipelineName = getStringArg("pipeline", "inliner_pipeline");
-    flags.insertInitilizers = getBoolArg("insertInitilizers", false);
-    flags.doInlining = true;
-    
-    
-#define READ_STANDARD_HELPER_FLAGS(name)\
-    flags.name##_doInlining = getBoolArg(#name, false);\
-    if (flags.name##_doInlining) {\
-    flags.name##_className = getStringArg(#name"_className", NULL);\
-    flags.name##_methodName = getStringArg(#name"_methodName", NULL);\
-    flags.name##_hotnessPercentToInline = getIntArg(#name"_hotnessPercent", 0);\
-        if (flags.name##_className == NULL || flags.name##_methodName == NULL) {\
-            if (Log::isEnabled()) {\
-                Log::out()<<"Invalid fast path helper name:"<<flags.name##_className<<"::"<<flags.name##_methodName<<std::endl;\
-            }\
-            flags.name##_doInlining = false;\
-        }\
-    }\
-    if (!flags.name##_doInlining){\
-        flags.name##_className = NULL;\
-        flags.name##_methodName = NULL;\
-    }\
-
-    READ_STANDARD_HELPER_FLAGS(newObj);
-    flags.newObj_signature = "(II)Lorg/vmmagic/unboxed/Address;";
-
-    READ_STANDARD_HELPER_FLAGS(newArray);
-    flags.newArray_signature = "(III)Lorg/vmmagic/unboxed/Address;";
-
-    READ_STANDARD_HELPER_FLAGS(objMonEnter);
-    flags.objMonEnter_signature = "(Ljava/lang/Object;)V";
-
-    READ_STANDARD_HELPER_FLAGS(objMonExit);
-    flags.objMonExit_signature = "(Ljava/lang/Object;)V";
-
-    READ_STANDARD_HELPER_FLAGS(wb);
-    flags.wb_signature = "(Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Address;)V";
-
-    READ_STANDARD_HELPER_FLAGS(ldInterface);
-    flags.ldInterface_signature = "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;)Lorg/vmmagic/unboxed/Address;";
     
-    READ_STANDARD_HELPER_FLAGS(checkCast);
-    flags.checkCast_signature = "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;ZZZI)Ljava/lang/Object;";
-    
-    READ_STANDARD_HELPER_FLAGS(instanceOf);
-    flags.instanceOf_signature = "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;ZZZI)Z";
+    registerHelper(Op_NewObj, VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE);
+    registerHelper(Op_NewArray, VM_RT_NEW_VECTOR_USING_VTABLE);
+    registerHelper(Op_TauMonitorEnter, VM_RT_MONITOR_ENTER_NON_NULL);
+    registerHelper(Op_TauMonitorExit, VM_RT_MONITOR_EXIT_NON_NULL);
+    registerHelper(Op_TauStRef, VM_RT_GC_HEAP_WRITE_REF);
+    registerHelper(Op_TauLdIntfcVTableAddr, VM_RT_GET_INTERFACE_VTABLE_VER0);
+    registerHelper(Op_TauCheckCast, VM_RT_CHECKCAST);
+    registerHelper(Op_TauInstanceOf, VM_RT_INSTANCEOF);
+}
+
+void HelperInlinerAction::registerHelper(Opcode opcode, VM_RT_SUPPORT helperId) {
+    MemoryManager& globalMM = getJITInstanceContext().getGlobalMemoryManager();
+    assert(flags.opcodeToHelperMapping.find(opcode)==flags.opcodeToHelperMapping.end()); 
+    flags.opcodeToHelperMapping[opcode] = helperId; 
+    if (flags.helperConfigs.find(helperId)== flags.helperConfigs.end()) {
+        std::string helperName = vm_helper_get_name(helperId);
+        HelperConfig* h = new (globalMM) HelperConfig(helperId);
+        h->doInlining = getBoolArg(helperName.c_str(), false);
+        h->hotnessPercentToInline = getIntArg((helperName + "_hotnessPercent").c_str(), 0);
+        flags.helperConfigs[helperId] = h; 
+    }
 }
 
-
 class HelperInliner {
 public:
-    HelperInliner(HelperInlinerSession* _sessionAction, MemoryManager& tmpMM, CompilationContext* _cc, Inst* _inst, uint32 _hotness)  
+    HelperInliner(HelperInlinerSession* _sessionAction, MemoryManager& tmpMM, CompilationContext* _cc, Inst* _inst, uint32 _hotness, MethodDesc* _helperMethod, VM_RT_SUPPORT _helperId)  
         : flags(((HelperInlinerAction*)_sessionAction->getAction())->getFlags()), localMM(tmpMM), 
-        cc(_cc), inst(_inst), session(_sessionAction), method(NULL)
+        cc(_cc), inst(_inst), session(_sessionAction), method(_helperMethod), helperId(_helperId)
     {
         hotness=_hotness;
         irm = cc->getHIRManager();
@@ -127,15 +98,15 @@
         cfg = &irm->getFlowGraph();
     }
 
-    virtual ~HelperInliner(){};
-    
-    virtual void run()=0;
+    ~HelperInliner(){};
+
+    void run();
 
     uint32 hotness;
 
+    static MethodDesc* findHelperMethod(CompilationInterface* ci, VM_RT_SUPPORT helperId);
+
 protected:
-    MethodDesc* ensureClassIsResolvedAndInitialized(const char* className,  const char* methodName, const char* signature);
-    virtual void doInline() = 0;
     void inlineVMHelper(MethodCallInst* call);
     void finalizeCall(MethodCallInst* call);
 
@@ -145,13 +116,23 @@
     Inst* inst;
     HelperInlinerSession* session;
     MethodDesc*  method;
-    
-//these fields used by almost every subclass -> cache them
+    VM_RT_SUPPORT helperId;
+
+    //these fields used by almost every subclass -> cache them
     IRManager* irm;
     InstFactory* instFactory;
     OpndManager* opndManager;
     TypeManager* typeManager;
     ControlFlowGraph* cfg;
+private: 
+    void inline_NewObj();
+    void inline_NewArray();
+    void inline_TauLdIntfcVTableAddr();
+    void inline_TauCheckCast();
+    void inline_TauInstanceOf();
+    void inline_TauStRef();
+    void inline_TauMonitorEnter();
+    void inline_TauMonitorExit();
 };
 
 class HelperInlinerCompare {
@@ -159,33 +140,6 @@
     bool operator()(const HelperInliner* hi1, const HelperInliner* hi2) { return hi1->hotness < hi2->hotness; }
 };
 
-
-#define DECLARE_HELPER_INLINER(name, flagPrefix)\
-class name : public HelperInliner {\
-public:\
-    name (HelperInlinerSession* session, MemoryManager& tmpMM, CompilationContext* cc, Inst* inst, uint32 hotness)\
-        : HelperInliner(session, tmpMM, cc, inst, hotness){}\
-    \
-    virtual void run() { \
-        if (Log::isEnabled())  {\
-            Log::out() << "Processing inst:"; inst->print(Log::out()); Log::out()<<std::endl; \
-        }\
-        method = ensureClassIsResolvedAndInitialized(flags.flagPrefix##_className, flags.flagPrefix##_methodName, flags.flagPrefix##_signature);\
-        if (!method) return;\
-        doInline();\
-    }\
-    virtual void doInline();\
-};\
-
-DECLARE_HELPER_INLINER(NewObjHelperInliner, newObj)
-DECLARE_HELPER_INLINER(NewArrayHelperInliner, newArray)
-DECLARE_HELPER_INLINER(ObjMonitorEnterHelperInliner, objMonEnter)
-DECLARE_HELPER_INLINER(ObjMonitorExitHelperInliner, objMonExit)
-DECLARE_HELPER_INLINER(WriteBarrierHelperInliner, wb)
-DECLARE_HELPER_INLINER(LdInterfaceHelperInliner, ldInterface)
-DECLARE_HELPER_INLINER(CheckCastHelperInliner, checkCast)
-DECLARE_HELPER_INLINER(InstanceOfHelperInliner, instanceOf)
-
 void HelperInlinerSession::_run(IRManager& irm) {
     CompilationContext* cc = getCompilationContext();
     MemoryManager tmpMM("Inline VM helpers");
@@ -202,6 +156,10 @@
     uint32 maxNodeCount = irm.getOptimizerFlags().hir_node_threshold;
     StlPriorityQueue<HelperInliner*, StlVector<HelperInliner*>, HelperInlinerCompare> *helperInlineCandidates = 
         new (tmpMM) StlPriorityQueue<HelperInliner*, StlVector<HelperInliner*>, HelperInlinerCompare>(tmpMM);
+
+    const StlMap<Opcode, VM_RT_SUPPORT>& opcodeToHelper = flags.opcodeToHelperMapping;
+    const StlMap<VM_RT_SUPPORT, HelperConfig*>& configs = flags.helperConfigs;
+
     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;
@@ -211,49 +169,26 @@
         if (node->isBlockNode()) {
             for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst()) {
                 Opcode opcode = inst->getOpcode();
-                switch(opcode) {
-                    case Op_NewObj:
-                        if (flags.newObj_doInlining && nodePercent >= flags.newObj_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) NewObjHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_NewArray:
-                        if (flags.newArray_doInlining && nodePercent >= flags.newArray_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) NewArrayHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauMonitorEnter:
-                        if (flags.objMonEnter_doInlining && nodePercent >= flags.objMonEnter_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) ObjMonitorEnterHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauMonitorExit:
-                        if (flags.objMonExit_doInlining && nodePercent >= flags.objMonExit_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) ObjMonitorExitHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauStRef:
-                        if (flags.wb_doInlining && nodePercent >= flags.wb_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) WriteBarrierHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauLdIntfcVTableAddr:
-                        if (flags.ldInterface_doInlining && nodePercent >= flags.ldInterface_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) LdInterfaceHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauCheckCast:
-                        if (flags.checkCast_doInlining && nodePercent >= flags.checkCast_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) CheckCastHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    case Op_TauInstanceOf:
-                        if (flags.instanceOf_doInlining && nodePercent >= flags.instanceOf_hotnessPercentToInline) {
-                            helperInlineCandidates->push(new (tmpMM) InstanceOfHelperInliner(this, tmpMM, cc, inst, nodePercent));
-                        }
-                        break;
-                    default: break;
+                StlMap<Opcode, VM_RT_SUPPORT>::const_iterator o2h = opcodeToHelper.find(opcode);
+                if (o2h == opcodeToHelper.end()) {
+                    continue;
                 }
+                VM_RT_SUPPORT helperId = o2h->second;
+                StlMap<VM_RT_SUPPORT, HelperConfig*>::const_iterator iconf = configs.find(helperId);
+                if (iconf == configs.end()) {
+                    continue;
+                }
+                HelperConfig* config = iconf->second;
+                if (!config->doInlining || config->hotnessPercentToInline >= nodePercent) {
+                    continue;
+                }
+                MethodDesc* md = HelperInliner::findHelperMethod(cc->getVMCompilationInterface(), helperId);
+                if (md == NULL) {
+                    continue;
+                }
+                HelperInliner* inliner = new (tmpMM) HelperInliner(this, tmpMM, cc, inst, nodePercent, md, helperId);
+                
+                helperInlineCandidates->push(inliner);
             }
         }
     }
@@ -266,36 +201,40 @@
     }
 }
 
+void HelperInliner::run()  {
+    if (Log::isEnabled())  {
+        Log::out() << "Processing inst:"; inst->print(Log::out()); Log::out()<<std::endl; 
+    }
+    assert(method);
+    switch(inst->getOpcode()) {
+        case Op_NewObj:                 inline_NewObj(); break;
+        case Op_NewArray:               inline_NewArray(); break;
+        case Op_TauLdIntfcVTableAddr:   inline_TauLdIntfcVTableAddr(); break;
+        case Op_TauCheckCast:           inline_TauCheckCast(); break;
+        case Op_TauInstanceOf:          inline_TauInstanceOf(); break;
+        case Op_TauStRef:               inline_TauStRef(); break;
+        case Op_TauMonitorEnter:        inline_TauMonitorEnter(); break;
+        case Op_TauMonitorExit:         inline_TauMonitorExit(); break;
+        default: assert(0);
+    }
+}
 
-MethodDesc* HelperInliner::ensureClassIsResolvedAndInitialized(const char* className, const char* methodName, const char* signature) 
+MethodDesc* HelperInliner::findHelperMethod(CompilationInterface* ci, VM_RT_SUPPORT helperId) 
 {
-    CompilationInterface* ci = cc->getVMCompilationInterface();
-    ObjectType* clazz = ci->resolveClassUsingBootstrapClassloader(className);
-    if (!clazz) {
-        if (Log::isEnabled()) Log::out()<<"Error: class not found:"<<className<<std::endl;
-        return NULL;
-    }
-    //helper class is resolved here -> check if initialized
-    if (clazz->needsInitialization()) {
-        if (flags.insertInitilizers) {
-            instFactory->makeInitType(clazz)->insertBefore(inst);
-        }
+    Method_Handle mh = vm_helper_get_magic_helper(helperId);
+    if (mh == NULL) {
+        if (Log::isEnabled()) Log::out()<<"WARN: helper's method is not resolved:"<<vm_helper_get_name(helperId)<<std::endl;
         return NULL;
     }
-    //helper class is initialized here -> inline it.
-    MethodDesc* method = ci->resolveMethod(clazz, methodName, signature);
-    if (!method) {
-        if (Log::isEnabled()) Log::out()<<"Error: method not found:"<<className<<"::"<<methodName<<signature<<std::endl;;
+    Class_Handle ch = method_get_class(mh);
+    if (!class_is_initialized(ch)) {
+        if (Log::isEnabled()) Log::out()<<"WARN: class is not initialized:"<<class_get_name(ch)<<std::endl;
         return NULL;
     }
-    assert (method->isStatic());
-    return method;
-
+    MethodDesc* md = ci->getMethodDesc(mh);
+    return md;
 }
 
-typedef StlVector<MethodCallInst*> InlineVector;
-
-
 void HelperInliner::inlineVMHelper(MethodCallInst* call) {
     if (Log::isEnabled()) {
         Log::out()<<"Inlining VMHelper:";call->print(Log::out());Log::out()<<std::endl;
@@ -329,7 +268,7 @@
 
 
 
-void NewObjHelperInliner::doInline() {
+void HelperInliner::inline_NewObj() {
 #if defined (_IPF_)
     return;
 #else
@@ -386,7 +325,7 @@
 #endif
 }
 
-void NewArrayHelperInliner::doInline() {
+void HelperInliner::inline_NewArray() {
 #if defined (_IPF_)
     return;
 #else
@@ -444,7 +383,7 @@
 }
 
 
-void ObjMonitorEnterHelperInliner::doInline() {
+void HelperInliner::inline_TauMonitorEnter() {
 #if defined (_IPF_)
     return;
 #else
@@ -480,7 +419,7 @@
 #endif
 }
 
-void ObjMonitorExitHelperInliner::doInline() {
+void HelperInliner::inline_TauMonitorExit() {
 #if defined (_IPF_)
     return;
 #else
@@ -504,7 +443,7 @@
 #endif
 }
 
-void WriteBarrierHelperInliner::doInline() {
+void HelperInliner::inline_TauStRef() {
 #if defined  (_EM64T_) || defined (_IPF_)
     return;
 #else
@@ -548,7 +487,7 @@
 #endif
 }
 
-void LdInterfaceHelperInliner::doInline() {
+void HelperInliner::inline_TauLdIntfcVTableAddr() {
 #if defined  (_EM64T_) || defined (_IPF_)
     return;
 #else
@@ -583,7 +522,7 @@
 
 
 
-void CheckCastHelperInliner::doInline() {
+void HelperInliner::inline_TauCheckCast() {
 #if defined  (_EM64T_) || defined (_IPF_)
     return;
 #else
@@ -649,7 +588,7 @@
 }
 
 
-void InstanceOfHelperInliner::doInline() {
+void HelperInliner::inline_TauInstanceOf() {
 #if defined  (_EM64T_) || defined (_IPF_)
     return;
 #else

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=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/build/vmcore.exp Fri Nov 16 01:23:49 2007
@@ -621,8 +621,10 @@
     vm_helper_get_by_name;
     vm_helper_get_calling_convention;
     vm_helper_get_interruptibility_kind;
+    vm_helper_get_magic_helper;
     vm_helper_get_name;
     vm_helper_get_numargs;
+    vm_helper_register_magic_helper;
     vm_hint_finalize;
     vm_instanceof_class;
     vm_iterate_object;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Fri Nov 16 01:23:49 2007
@@ -40,6 +40,7 @@
 #include "interpreter.h"
 #include "em_intf.h"
 #include "dll_jit_intf.h"
+#include "jit_runtime_support.h"
 #include "jni_utils.h"
 #include "platform_lowlevel.h"
 #include "verify_stack_enumeration.h"
@@ -874,6 +875,11 @@
 
     // We assume, that at this point VM supports exception objects creation.
     vm_env->ReadyForExceptions();
+
+    status = helper_magic_init(vm_env);
+    if(status != 0) {
+        return JNI_ERR;
+    }
 
     return JNI_OK;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp Fri Nov 16 01:23:49 2007
@@ -18,6 +18,9 @@
 #define LOG_DOMAIN "vm.helpers"
 #include "cxxlog.h"
 #include "jit_runtime_support.h"
+#include "Class.h"
+#include "environment.h"
+#include "exceptions.h"
 #include <map>
 
 #ifndef _WIN32
@@ -30,154 +33,241 @@
     HELPER_INTERRUPTIBILITY_KIND i_kind;
     HELPER_CALLING_CONVENTION cc_kind;
     int            number_of_args;
+    const char    *magic_class_name;
+    const char    *magic_method_name;
+    const char    *magic_method_descr;
+    Method_Handle  magic_mh;
 };
 
 typedef std::map<VM_RT_SUPPORT, JIT_RT_Function_Entry*> HelperInfoMap;
 
 static JIT_RT_Function_Entry _jit_rt_function_entries_base[] = {
     {VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE, "VM_RT_NEW_RESOLVED_USING_VTABLE_AND_SIZE",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   "(II)Lorg/vmmagic/unboxed/Address;",   NULL},
     {VM_RT_NEW_VECTOR_USING_VTABLE,            "VM_RT_NEW_VECTOR_USING_VTABLE",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   "(III)Lorg/vmmagic/unboxed/Address;",   NULL},
     {VM_RT_MULTIANEWARRAY_RESOLVED,            "VM_RT_MULTIANEWARRAY_RESOLVED",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_CDECL,                8},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_CDECL,                8,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LDC_STRING,                         "VM_RT_LDC_STRING",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_THROW,                              "VM_RT_THROW",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_THROW_LAZY,                         "VM_RT_THROW_LAZY",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_DRL,                  8},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_DRL,                  8,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_IDX_OUT_OF_BOUNDS,                  "VM_RT_IDX_OUT_OF_BOUNDS",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_NULL_PTR_EXCEPTION,                 "VM_RT_NULL_PTR_EXCEPTION",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_DIVIDE_BY_ZERO_EXCEPTION,           "VM_RT_DIVIDE_BY_ZERO_EXCEPTION",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_ARRAY_STORE_EXCEPTION,              "VM_RT_ARRAY_STORE_EXCEPTION",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_THROW_LINKING_EXCEPTION,            "VM_RT_THROW_LINKING_EXCEPTION",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_THROW_SET_STACK_TRACE,              "VM_RT_THROW_SET_STACK_TRACE",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_MONITOR_ENTER,                      "VM_RT_MONITOR_ENTER",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorEnterUseReservation",
+            "(Ljava/lang/Object;)V",   NULL},
+
     {VM_RT_MONITOR_ENTER_NON_NULL,             "VM_RT_MONITOR_ENTER_NON_NULL",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorEnterUseReservation",
+            "(Ljava/lang/Object;)V",   NULL},
+
     {VM_RT_MONITOR_EXIT,                       "VM_RT_MONITOR_EXIT",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorExit",
+            "(Ljava/lang/Object;)V",   NULL},
+
     {VM_RT_MONITOR_EXIT_NON_NULL,              "VM_RT_MONITOR_EXIT_NON_NULL",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorExit",
+            "(Ljava/lang/Object;)V",   NULL},
+
     {VM_RT_MONITOR_ENTER_STATIC,               "VM_RT_MONITOR_ENTER_STATIC",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorEnterUseReservation",
+            "(Ljava/lang/Object;)V",   NULL},
+
     {VM_RT_MONITOR_EXIT_STATIC,                "VM_RT_MONITOR_EXIT_STATIC",
-            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_SOMETIMES,           CALLING_CONVENTION_STDCALL,              1,
+            "org/apache/harmony/drlvm/thread/ThreadHelper",   "monitorExit",
+            "(Ljava/lang/Object;)V",   NULL},
 
     {VM_RT_CHECKCAST,                          "VM_RT_CHECKCAST",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            "org/apache/harmony/drlvm/VMHelperFastPath",   "checkCast",
+            "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;ZZZI)Ljava/lang/Object;",   NULL},
+
     {VM_RT_INSTANCEOF,                         "VM_RT_INSTANCEOF",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            "org/apache/harmony/drlvm/VMHelperFastPath",   "instanceOf",
+            "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;ZZZI)Z",   NULL},
+
     {VM_RT_AASTORE,                            "VM_RT_AASTORE",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              3},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              3,
+            NULL,   NULL,   NULL,   NULL},
+
     {VM_RT_AASTORE_TEST,                       "VM_RT_AASTORE_TEST",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
+
     {VM_RT_GET_INTERFACE_VTABLE_VER0,          "VM_RT_GET_INTERFACE_VTABLE_VER0",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            "org/apache/harmony/drlvm/VMHelperFastPath",   "getInterfaceVTable3",
+            "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;)Lorg/vmmagic/unboxed/Address;",   NULL},
 
     {VM_RT_INITIALIZE_CLASS,                   "VM_RT_INITIALIZE_CLASS",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_GC_HEAP_WRITE_REF,                  "VM_RT_GC_HEAP_WRITE_REF",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_CDECL,                3},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_CDECL,                3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GC_SAFE_POINT,                      "VM_RT_GC_SAFE_POINT",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GC_GET_TLS_BASE,                    "VM_RT_GET_TLS_BASE",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              0},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              0,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_JVMTI_METHOD_ENTER_CALLBACK,        "VM_RT_JVMTI_METHOD_ENTER_CALLBACK",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_JVMTI_METHOD_EXIT_CALLBACK,         "VM_RT_JVMTI_METHOD_EXIT_CALLBACK",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
-    {VM_RT_JVMTI_FIELD_ACCESS_CALLBACK,        "VM_RT_JVMTI_FIELD_ACCESS__CALLBACK",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              4},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
+    {VM_RT_JVMTI_FIELD_ACCESS_CALLBACK,        "VM_RT_JVMTI_FIELD_ACCESS_CALLBACK",
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              4,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_JVMTI_FIELD_MODIFICATION_CALLBACK,  "VM_RT_JVMTI_FIELD_MODIFICATION_CALLBACK",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              5},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              5,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_NEWOBJ_WITHRESOLVE,                      "VM_RT_NEWOBJ_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_NEWARRAY_WITHRESOLVE,                    "VM_RT_NEWARRAY_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_NONSTATIC_FIELD_OFFSET_WITHRESOLVE,  "VM_RT_GET_NONSTATIC_FIELD_OFFSET_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE,       "VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_CHECKCAST_WITHRESOLVE,                   "VM_RT_CHECKCAST_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_INSTANCEOF_WITHRESOLVE,                  "VM_RT_INSTANCEOF_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_INVOKESTATIC_ADDR_WITHRESOLVE,       "VM_RT_GET_INVOKESTATIC_ADDR_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_INVOKEINTERFACE_ADDR_WITHRESOLVE,    "VM_RT_GET_INVOKEINTERFACE_ADDR_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_INVOKEVIRTUAL_ADDR_WITHRESOLVE,      "VM_RT_GET_INVOKEVIRTUAL_ADDR_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         3,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_GET_INVOKE_SPECIAL_ADDR_WITHRESOLVE,     "VM_RT_GET_INVOKE_SPECIAL_ADDR_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_INITIALIZE_CLASS_WITHRESOLVE,           "VM_RT_INITIALIZE_CLASS_WITHRESOLVE",
-            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2},
+            INTERRUPTIBLE_ALWAYS,                   CALLING_CONVENTION_STDCALL,         2,
+            NULL,   NULL,   NULL,   NULL},
 
 
     {VM_RT_F2I,                                "VM_RT_F2I",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_F2L,                                "VM_RT_F2L",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_D2I,                                "VM_RT_D2I",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_D2L,                                "VM_RT_D2L",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LSHL,                               "VM_RT_LSHL",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LSHR,                               "VM_RT_LSHR",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LUSHR,                              "VM_RT_LUSHR",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LMUL,                               "VM_RT_LMUL",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
 #ifdef VM_LONG_OPT
     {VM_RT_LMUL_CONST_MULTIPLIER,              "VM_RT_LMUL_CONST_MULTIPLIER",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
 #endif // VM_LONG_OPT
     {VM_RT_LREM,                               "VM_RT_LREM",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_LDIV,                               "VM_RT_LDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_ULDIV,                              "VM_RT_ULDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_CONST_LDIV,                         "VM_RT_CONST_LDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_CONST_LREM,                         "VM_RT_CONST_LREM",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_IMUL,                               "VM_RT_IMUL",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_IREM,                               "VM_RT_IREM",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_IDIV,                               "VM_RT_IDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_FREM,                               "VM_RT_FREM",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_FDIV,                               "VM_RT_FDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_DREM,                               "VM_RT_DREM",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
     {VM_RT_DDIV,                               "VM_RT_DDIV",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_CHAR_ARRAYCOPY_NO_EXC,              "VM_RT_CHAR_ARRAYCOPY_NO_EXC",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              5},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              5,
+            NULL,   NULL,   NULL,   NULL},
 
     {VM_RT_WRITE_BARRIER_FASTCALL,             "VM_RT_WRITE_BARRIER_FASTCALL",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              2,
+            NULL,   NULL,   NULL,   NULL}
 };
 
 static JIT_RT_Function_Entry *jit_rt_function_entries = &(_jit_rt_function_entries_base[0]);
@@ -255,5 +345,98 @@
     } else {
         ASSERT(false, "Unexpected helper id " << id);
         return 0;
+    }
+}
+
+Class* load_magic_helper_class(Global_Env * vm_env, const char * class_name) {
+    return vm_env->LoadCoreClass(class_name);
+}
+
+void init_magic_helper_class(Class* magic_helper_class){
+    tmn_suspend_disable();
+    class_initialize(magic_helper_class);
+
+    if(exn_raised()){
+        DIE("Exception raised during "  << magic_helper_class->get_name()->bytes << " class initializing.");
+    }
+    tmn_suspend_enable();
+}
+
+Method_Handle resolve_magic_helper(Global_Env * vm_env, 
+                                   const char* class_name, 
+                                   const char* method_name, 
+                                   const char* method_descr) {
+    assert (class_name);
+    assert (method_name);
+    assert (method_descr);
+
+    Class* magic_helper_class = load_magic_helper_class(vm_env, class_name);
+    init_magic_helper_class(magic_helper_class);
+    return class_lookup_method_recursive(magic_helper_class, method_name, method_descr);
+}
+
+jint helper_magic_init(Global_Env * vm_env){
+    //init VMHelper class - utility class for all VMHelpers
+    Class* magic_helper_class = load_magic_helper_class(vm_env, "org/apache/harmony/drlvm/VMHelper");
+    init_magic_helper_class(magic_helper_class);
+    
+    //cache Method_Handle for all registered magic helpers
+    //init their classes
+    for (int i = 0;  i < num_jit_rt_function_entries;  i++) {
+        const char* class_name = jit_rt_function_entries[i].magic_class_name;
+        const char* method_name = jit_rt_function_entries[i].magic_method_name;
+        const char* method_descr = jit_rt_function_entries[i].magic_method_descr;
+    
+        if (method_name == NULL){
+            continue;
+        }
+
+        assert (class_name);
+        assert (method_name);
+        assert (method_descr);
+
+        Method_Handle method_handle = resolve_magic_helper(vm_env, class_name, method_name, method_descr);
+        if (!method_handle) {
+            ASSERT(method_handle, "Method " << class_name <<"."<< method_name << method_descr<<" not found.");
+            return JNI_ERR;
+        }
+        jit_rt_function_entries[i].magic_mh = method_handle;
+    }
+    return JNI_OK;
+}
+
+VMEXPORT
+jint vm_helper_register_magic_helper(VM_RT_SUPPORT id, 
+                          const char* class_name, 
+                          const char* method_name) {
+    assert (class_name);
+    assert (method_name);
+    
+    HelperInfoMap::const_iterator it = helper_map->find(id);
+    if (helper_map->end() != it) {
+        assert(it->second);
+        if (it->second->magic_method_name) {
+            ASSERT(it->second->magic_method_name == NULL, "Helper " << id << " is registered already.");
+            return JNI_ERR;
+        } else {
+            it->second->magic_class_name = class_name;
+            it->second->magic_method_name = method_name;
+            return JNI_OK;
+        }
+    } else {
+        ASSERT(VM_RT_UNKNOWN == id, "Unexpected helper id " << id);
+        return JNI_ERR;
+    }
+}
+
+VMEXPORT
+Method_Handle vm_helper_get_magic_helper(VM_RT_SUPPORT id) {
+    HelperInfoMap::const_iterator it = helper_map->find(id);
+    if (helper_map->end() != it) {
+        assert(it->second);
+        return it->second->magic_mh;
+    } else {
+        ASSERT(false, "Unexpected helper id " << id);
+        return NULL;
     }
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java?rev=595607&r1=595606&r2=595607&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java Fri Nov 16 01:23:49 2007
@@ -21,7 +21,14 @@
 package org.apache.harmony.drlvm;
 
 import org.vmmagic.unboxed.Address;
-
+/**
+    Core class for DRLVM's vmmagic based helpers.
+    Resolved and initilized during VM startup
+    
+    Note: All classes with vmmagic based helpers registred in VM are also resolved and initialized at VM startup
+    Note: If you need to initialize another DRLVM's specific utility class related to vmmagic infrastructure
+          refer to it from static section of this class: and it will also be automatically initialized
+*/
 public class VMHelper {
 
     private VMHelper() {}



Mime
View raw message