void InterpreterStubs::generate_interpreter_timer_tick() { comment_section("Interpreter call timer_tick"); entry("interpreter_timer_tick"); interpreter_call_vm(Constant("timer_tick"), T_VOID); dispatch_next(); entry_end(); // interpreter_timer_tick #if ENABLE_PAGE_PROTECTION stop_code_segment(); start_data_segment(); if (GenerateGNUCode || GenerateInlineAsm) { align(PROTECTED_PAGE_SIZE); define_array_begin("unsigned char", "_protected_page"); for (int i = 0; i < PROTECTED_PAGE_SIZE; i++) { define_byte_element(Constant(0)); } define_array_end(); } else { // MASM doesn't allow 4096-byte alignment, // so surround the protected area with 4K padding. // This will certainly add 8K of static footprint, // but who cares about the size of win32_i386 binary! define_byte(Constant(0), PROTECTED_PAGE_SIZE); define_long(Constant(0), PROTECTED_PAGE_SIZE / BytesPerWord, "_protected_page"); define_byte(Constant(0), PROTECTED_PAGE_SIZE); } stop_data_segment(); start_code_segment(); #endif }
void NativeGenerator::generate_native_math_entries() { comment_section("Native entry points for math functions"); int offset = 0; #if ENABLE_FLOAT stop_code_segment(); start_data_segment(); stop_data_segment(); start_code_segment(); // Generate sinus entry. offset = 0; rom_linkable_entry("native_math_sin_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_sin")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_sin_entry // Generate cosinus entry. offset = 0; rom_linkable_entry("native_math_cos_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_cos")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_cos_entry // Generate tangent entry. offset = 0; rom_linkable_entry("native_math_tan_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_tan")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_tan_entry // Generate square root entry. offset = 0; rom_linkable_entry("native_math_sqrt_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_sqrt")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_sqrt_entry // Generate ceil entry. offset = 0; rom_linkable_entry("native_math_ceil_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_ceil")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_ceil_entry // Generate floor entry. offset = 0; rom_linkable_entry("native_math_floor_entry"); comment("store return address"); popl(edi); pop_double(eax, ecx); pushl(ecx); pushl(eax); call(Constant("jvm_floor")); addl(esp, Constant(8)); push_from_fpu_stack(double_tag, offset, true); jmp(edi); rom_linkable_entry_end(); // native_math_floor_entry #endif /* ENABLE_FLOAT */ }