hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp
author okutsu
Fri, 27 Nov 2009 16:20:36 +0900
changeset 4381 951e4b7557dc
parent 2534 08dac9ce0cd7
child 5416 5f6377fcfd3e
permissions -rw-r--r--
6904997: (tz) Windows-only: tzmappings needs update for KB976098 Reviewed-by: peytoia
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2534
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     1
/*
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     2
 * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     4
 *
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     7
 * published by the Free Software Foundation.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     8
 *
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    13
 * accompanied this code).
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    14
 *
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    18
 *
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    21
 * have any questions.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    22
 *
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    23
 */
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    24
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    25
#include "incls/_precompiled.incl"
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    26
#include "incls/_methodHandles_sparc.cpp.incl"
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    27
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    28
#define __ _masm->
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    29
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    30
address MethodHandleEntry::start_compiled_entry(MacroAssembler* _masm,
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    31
                                                address interpreted_entry) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    32
  __ align(wordSize);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    33
  address target = __ pc() + sizeof(Data);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    34
  while (__ pc() < target) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    35
    __ nop();
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    36
    __ align(wordSize);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    37
  }
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    38
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    39
  MethodHandleEntry* me = (MethodHandleEntry*) __ pc();
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    40
  me->set_end_address(__ pc());         // set a temporary end_address
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    41
  me->set_from_interpreted_entry(interpreted_entry);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    42
  me->set_type_checking_entry(NULL);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    43
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    44
  return (address) me;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    45
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    46
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    47
MethodHandleEntry* MethodHandleEntry::finish_compiled_entry(MacroAssembler* _masm,
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    48
                                                address start_addr) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    49
  MethodHandleEntry* me = (MethodHandleEntry*) start_addr;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    50
  assert(me->end_address() == start_addr, "valid ME");
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    51
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    52
  // Fill in the real end_address:
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    53
  __ align(wordSize);
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    54
  me->set_end_address(__ pc());
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    55
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    56
  return me;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    57
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    58
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    59
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    60
// Code generation
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    61
address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    62
  ShouldNotReachHere(); //NYI, 6815692
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    63
  return NULL;
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    64
}
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    65
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    66
// Generate an "entry" field for a method handle.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    67
// This determines how the method handle will respond to calls.
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    68
void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    69
  ShouldNotReachHere(); //NYI, 6815692
08dac9ce0cd7 6655638: dynamic languages need method handles
jrose
parents:
diff changeset
    70
}