hotspot/src/share/vm/adlc/adlc.hpp
author xdono
Mon, 09 Mar 2009 13:28:46 -0700
changeset 2105 347008ce7984
parent 775 d9c9b9cd55fb
child 2129 e810a33b5c67
permissions -rw-r--r--
6814575: Update copyright year Summary: Update copyright for files that have been modified in 2009, up to 03/09 Reviewed-by: katleman, tbell, ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// Standard include file for ADLC parser
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// standard library constants
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
#include "stdio.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#include "stdlib.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#include <iostream>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
#include "string.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#include "ctype.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
#include "stdarg.h"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
#include <sys/types.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
#if _MSC_VER >= 1300
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
using namespace std;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// make sure the MSC_VER and _MSC_VER settings make sense
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#if _MSC_VER != MSC_VER && (_MSC_VER != 1400 || MSC_VER != 1399)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
#error "Something is wrong with the detection of MSC_VER in the makefiles"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
#if _MSC_VER >= 1400 && !defined(_WIN64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
#define strdup _strdup
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
/* Make sure that we have the intptr_t and uintptr_t definitions */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
#ifdef _WIN32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
#ifndef _INTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
typedef __int64 intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
typedef int intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
#define _INTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#ifndef _UINTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
typedef unsigned __int64 uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
typedef unsigned int uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
#define _UINTPTR_T_DEFINED
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
#endif // _WIN32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#ifdef LINUX
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  #include <inttypes.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#endif // LINUX
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
// Macros
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
#define uint32 unsigned int
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#define uint   unsigned int
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// Macros
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// Debugging note:  Put a breakpoint on "abort".
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define assert(cond, msg) { if (!(cond)) { fprintf(stderr, "assert fails %s %d: %s\n", __FILE__, __LINE__, msg); abort(); }}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
#define max(a, b)   (((a)>(b)) ? (a) : (b))
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// VM components
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#include "opcodes.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// ADLC components
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#include "arena.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
#include "adlcVMDeps.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
#include "filebuff.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
#include "dict2.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
#include "forms.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
#include "formsopt.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#include "formssel.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
#include "archDesc.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
#include "adlparse.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
// globally define ArchDesc for convenience.  Alternatively every form
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// could have a backpointer to the AD but it's too complicated to pass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// it everywhere it needs to be available.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
extern ArchDesc* globalAD;