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 SourceAssembler::start() {
  _current_segment = NO_SEGMENT;

  // Emit the header.
  emit_comment("Copyright  1990-2009 Sun Microsystems, Inc. All Rights Reserved.");
  emit_comment("DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER");
  emit_comment("");
  emit_comment("This program is free software; you can redistribute it and/or");
  emit_comment("modify it under the terms of the GNU General Public License version");
  emit_comment("2 only, as published by the Free Software Foundation.");
  emit_comment("");
  emit_comment("This program is distributed in the hope that it will be useful, but");
  emit_comment("WITHOUT ANY WARRANTY; without even the implied warranty of");
  emit_comment("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU");
  emit_comment("General Public License version 2 for more details (a copy is");
  emit_comment("included at /legal/license.txt).");
  emit_comment("");
  emit_comment("You should have received a copy of the GNU General Public License");
  emit_comment("version 2 along with this work; if not, write to the Free Software");
  emit_comment("Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA");
  emit_comment("02110-1301 USA");
  emit_comment("");
  emit_comment("Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa");
  emit_comment("Clara, CA 95054 or visit www.sun.com if you need additional");
  emit_comment("information or have any questions.");
  emit("\n");

  if (GenerateInlineAsm) {
      if (1) {                  // visual c++
          emit("#define __DECLSPEC_ALIGN(x)\n");
      } else {
          emit("#define __DECLSPEC_ALIGN(x) __declspec(align(x))\n");
      }
  }
  // Make sure people know that this file shouldn't be edited.
  comment_section("Generated assembly file -- do *not* edit");
  emit("\n");
 
  // Emit the platform and model specifiers.
  if (!GenerateGNUCode) {
    if (!GenerateInlineAsm) {
      emit("\t.486P\n");
      emit("\t.MODEL flat, C\n\n");
    }
  } else {
    emit("\t.arch i486\n");
  }
  start_code_segment();
}
Exemplo n.º 3
0
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 */
}