00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #define VMSYMBOLS(template) \
00026 template(smi_overflow, "SmallIntegerOverflow") \
00027 template(division_by_zero, "DivisionByZero") \
00028 template(receiver_has_wrong_type, "ReceiverHasWrongType") \
00029 template(division_not_exact, "DivisionNotExact") \
00030 template(first_argument_has_wrong_type, "FirstArgumentHasWrongType") \
00031 template(second_argument_has_wrong_type, "SecondArgumentHasWrongType") \
00032 template(third_argument_has_wrong_type, "ThirdArgumentHasWrongType") \
00033 template(fourth_argument_has_wrong_type, "FourthArgumentHasWrongType") \
00034 template(fifth_argument_has_wrong_type, "FifthArgumentHasWrongType") \
00035 template(sixth_argument_has_wrong_type, "SixthArgumentHasWrongType") \
00036 template(seventh_argument_has_wrong_type,"SixthArgumentHasWrongType") \
00037 template(eighth_argument_has_wrong_type, "SeventhArgumentHasWrongType")\
00038 template(ninth_argument_has_wrong_type, "EighthArgumentHasWrongType") \
00039 template(tenth_argument_has_wrong_type, "NinthArgumentHasWrongType") \
00040 template(argument_has_wrong_type, "ArgumentHasWrongType") \
00041 template(argument_is_invalid, "ArgumentIsInvalid") \
00042 template(conversion_failed, "ConversionFailed") \
00043 template(not_found, "NotFound") \
00044 template(plus, "+") \
00045 template(minus, "-") \
00046 template(multiply, "*") \
00047 template(divide, "//") \
00048 template(mod, "\\\\") \
00049 template(point_at, "@") \
template(equal, "=") \
00050 template(not_equal, "~=") \
00051 template(less_than, "<") \
00052 template(less_than_or_equal, "<=") \
00053 template(greater_than, ">") \
00054 template(greater_than_or_equal, ">=") \
00055 template(bitAnd_, "bitAnd:") \
00056 template(bitOr_, "bitOr:") \
00057 template(bitXor_, "bitXor:") \
00058 template(bitShift_, "bitShift:") \
00059 template(bitInvert, "bitInvert") \
00060 template(and_, "and:") \
00061 template(or_, "or:") \
00062 template(and, "&&") \
00063 template(or, "||") \
00064 template(and1, "&") \
00065 template(or1, "|") \
00066 template(not, "not") \
00067 template(xor_, "xor:") \
00068 template(eqv_, "eqv:") \
00069 template(at, "at:") \
00070 template(at_put, "at:put:") \
00071 template(size , "size") \
00072 template(double_equal, "==") \
00073 template(double_tilde, "~~") \
00074 template(out_of_bounds, "OutOfBounds") \
00075 template(index_not_valid, "IndexNotValid") \
00076 template(not_yet_implemented, "NotYetImplemented") \
00077 template(indexable, "Indexable") \
00078 template(not_oops, "ReceiverNotOops") \
00079 template(not_clonable, "ReceiverNotClonable") \
00080 template(value_out_of_range, "ValueOutOfRange") \
00081 template(method_construction_failed, "MethodConstructionFailed") \
00082 template(primitive_not_defined, "PrimitiveNotDefined") \
00083 template(smi_conversion_failed, "SmallIntegerConversionFailed") \
00084 template(not_klass, "NotAClass") \
00085 template(selector_for_blockMethod, "block") \
00086 template(not_indexable, "NotIndexable") \
00087 template(to_by_do, "to:by:do:") \
00088 template(value, "value") \
00089 template(value_, "value:") \
00090 template(if_true, "ifTrue:") \
00091 template(if_true_false, "ifTrue:ifFalse:") \
00092 template(if_false, "ifFalse:") \
00093 template(if_false_true, "ifFalse:ifTrue:") \
00094 template(while_true, "whileTrue") \
00095 template(while_true_, "whileTrue:") \
00096 template(while_false, "whileFalse") \
00097 template(while_false_, "whileFalse:") \
00098 template(empty_queue, "EmptyQueue:") \
00099 template(is_absent, "IsAbsent") \
00100 template(in_scheduler, "InScheduler") \
00101 template(in_async_dll, "InAsyncDLL") \
00102 template(not_in_scheduler, "NotInScheduler") \
00103 template(initialized, "Initialized") \
00104 template(yielded, "Yielded") \
00105 template(running, "Running") \
00106 template(stopped, "Stopped") \
00107 template(preempted, "Preempted") \
00108 template(completed, "Completed") \
00109 template(dead, "Dead") \
00110 template(aborted, "Aborted") \
00111 template(boolean_error, "BooleanError") \
00112 template(lookup_error, "LookupError") \
00113 template(primitive_lookup_error, "PrimitiveLookupError") \
00114 template(DLL_lookup_error, "DLLLookupError") \
00115 template(NLR_error, "NLRError") \
00116 template(float_error, "FloatError") \
00117 template(stack_overflow, "StackOverflow") \
00118 template(is_installed, "IsInstalled") \
00119 template(failed, "Failed") \
00120 template(abs, "abs") \
00121 template(negated, "negated") \
00122 template(squared, "squared") \
00123 template(sqrt, "sqrt") \
00124 template(sin, "sin") \
00125 template(cos, "cos") \
00126 template(tan, "tan") \
00127 template(exp, "exp") \
00128 template(ln, "ln") \
00129 template(as_float, "asFloat") \
00130 template(as_float_value, "asFloatValue") \
00131 template(negative_size, "NegativeSize") \
00132 template(not_active, "NotActive") \
00133 template(primitive_disabled_in_product,"PrimitiveDisabledInProduct") \
00134 template(activation_is_invalid, "ActivationIsInvalid") \
00135 template(external_activation, "ExternalActivation") \
00136 template(mem_klass, "Oops") \
00137 template(association_klass, "GlobalAssociation") \
00138 template(blockClosure_klass, "Block") \
00139 template(byteArray_klass, "ByteArray") \
00140 template(symbol_klass, "Symbol") \
00141 template(context_klass, "Context") \
00142 template(doubleByteArray_klass, "DoubleByteArray") \
00143 template(doubleValueArray_klass, "FloatValueArray") \
00144 template(double_klass, "Float") \
00145 template(klass_klass, "Class") \
00146 template(method_klass, "Method") \
00147 template(mixin_klass, "Mixin") \
00148 template(objArray_klass, "Array") \
00149 template(weakArray_klass, "WeakArray") \
00150 template(process_klass, "Process") \
00151 template(vframe_klass, "Activation") \
00152 template(proxy_klass, "Proxy") \
00153 template(smi_klass, "SmallInteger") \
00154 \
00155 \
00156 template(error, "error") \
00157 template(error_, "error:") \
00158 template(subclassResponsibility, "subclassResponsibility") \
00159
00160
00161 #define VMSYMBOL_POSTFIX _enum
00162 #define VMSYMBOL_ENUM_NAME(name) name##VMSYMBOL_POSTFIX
00163
00164 #define VMSYMBOL_ENUM(name,string) VMSYMBOL_ENUM_NAME(name),
00165
00166 enum {
00167 VMSYMBOLS(VMSYMBOL_ENUM)
00168 terminating_enum
00169 };
00170
00171 #define VMSYMBOL_DECL(name, string) \
00172 static symbolOop name () { return vm_symbols[VMSYMBOL_ENUM_NAME(name)]; }
00173
00174 extern "C" symbolOop vm_symbols[];
00175
00176 class vmSymbols : AllStatic {
00177 friend void vmSymbols_init();
00178 public:
00179 static void initialize();
00180 VMSYMBOLS(VMSYMBOL_DECL)
00181
00182
00183 static void follow_contents();
00184 static void switch_pointers(oop from, oop to);
00185 static void relocate();
00186 static void verify();
00187 };
00188
00189 #undef VMSYMBOL_DECL
00190 #undef VMSYMBOL_ENUM
00191
00192
00193 inline oop markSymbol(symbolOop sym) {
00194 assert(sym->is_mem(), "must have mem tag");
00195 return oop((char*) sym - Mem_Tag + Mark_Tag);
00196 }
00197
00198 inline symbolOop unmarkSymbol(oop sym) {
00199 assert(sym->is_mark(), "must have mark tag");
00200 oop res = oop((char*) sym - Mark_Tag + Mem_Tag);
00201 assert(res->is_symbol(), "must be symbol");
00202 return symbolOop(res);
00203 }
00204