comparison src/share/vm/c1x/c1x_Compiler.cpp @ 1407:09e7826ecf01

Can now call to Java code from the VM. Need to specify a JAR file with the classes from the Maxine subprojects C1X, CRI, and HotSpotVM in the bootclasspath. See HotSpotVM/README.txt in the Maxine sources for details.
author Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
date Tue, 11 May 2010 19:24:14 +0200
parents 35069ca331f2
children b30a2cd5e3a2
comparison
equal deleted inserted replaced
1406:35069ca331f2 1407:09e7826ecf01
32 TRACE_C1X_1("initialize"); 32 TRACE_C1X_1("initialize");
33 } 33 }
34 34
35 // Compilation entry point for methods 35 // Compilation entry point for methods
36 void C1XCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { 36 void C1XCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
37 37 VM_ENTRY_MARK;
38
38 ResourceMark rm; 39 ResourceMark rm;
39 HandleMark hm; 40 HandleMark hm;
40 41
41 TRACE_C1X_1("compile_method"); 42 TRACE_C1X_1("compile_method");
42 43
43 methodOop method = (methodOop)target->get_oop(); 44 methodHandle method(Thread::current(), (methodOop)target->get_oop());
44 methodHandle m(Thread::current(), method); 45 TRACE_C1X_1("name = %s", method->name_and_sig_as_C_string());
45 TRACE_C1X_1("name = %s", m->name_and_sig_as_C_string()); 46
47 JavaValue result(T_VOID);
48 symbolHandle syKlass = oopFactory::new_symbol("com/sun/hotspot/c1x/VMExits", CHECK);
49
50
51 Handle nullh;
52 KlassHandle k = SystemDictionary::resolve_or_null(syKlass, nullh, nullh, CHECK);
53 if (k.is_null()) {
54 tty->print_cr("not found");
55 return;//fatal("Could not find class com.sun.hotspot.c1x.VMExits");
56 }
57 symbolHandle syName = oopFactory::new_symbol("compileMethod", CHECK);
58 symbolHandle sySig = oopFactory::new_symbol("(Lcom/sun/cri/ri/RiMethod;I)V", CHECK);
59 JavaCallArguments args;
60 args.push_oop(method());
61 args.push_int(entry_bci);
62 JavaCalls::call_static(&result, k, syName, sySig, &args, CHECK);
46 } 63 }
47 64
48 // Print compilation timers and statistics 65 // Print compilation timers and statistics
49 void C1XCompiler::print_timers() { 66 void C1XCompiler::print_timers() {
50 TRACE_C1X_1("print_timers"); 67 TRACE_C1X_1("print_timers");