1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
285 }
286
287 void double_at_put(int which, jdouble d) {
288 tag_at_put(which, JVM_CONSTANT_Double);
289 // *double_at_addr(which) = d;
290 // u8 temp = *(u8*) &d;
291 Bytes::put_native_u8((address) double_at_addr(which), *((u8*) &d));
292 }
293
294 Symbol** symbol_at_addr(int which) const {
295 assert(is_within_bounds(which), "index out of bounds");
296 return (Symbol**) &base()[which];
297 }
298
299 void symbol_at_put(int which, Symbol* s) {
300 assert(s->refcount() != 0, "should have nonzero refcount");
301 tag_at_put(which, JVM_CONSTANT_Utf8);
302 *symbol_at_addr(which) = s;
303 }
304
305 void string_at_put(int which, int obj_index, oop str) {
306 resolved_references()->obj_at_put(obj_index, str);
307 }
308
309 // For temporary use while constructing constant pool
310 void string_index_at_put(int which, int string_index) {
311 tag_at_put(which, JVM_CONSTANT_StringIndex);
312 *int_at_addr(which) = string_index;
313 }
314
315 void field_at_put(int which, int class_index, int name_and_type_index) {
316 tag_at_put(which, JVM_CONSTANT_Fieldref);
317 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
318 }
319
320 void method_at_put(int which, int class_index, int name_and_type_index) {
321 tag_at_put(which, JVM_CONSTANT_Methodref);
322 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
323 }
324
325 void interface_method_at_put(int which, int class_index, int name_and_type_index) {
326 tag_at_put(which, JVM_CONSTANT_InterfaceMethodref);
327 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index; // Not so nice
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
285 }
286
287 void double_at_put(int which, jdouble d) {
288 tag_at_put(which, JVM_CONSTANT_Double);
289 // *double_at_addr(which) = d;
290 // u8 temp = *(u8*) &d;
291 Bytes::put_native_u8((address) double_at_addr(which), *((u8*) &d));
292 }
293
294 Symbol** symbol_at_addr(int which) const {
295 assert(is_within_bounds(which), "index out of bounds");
296 return (Symbol**) &base()[which];
297 }
298
299 void symbol_at_put(int which, Symbol* s) {
300 assert(s->refcount() != 0, "should have nonzero refcount");
301 tag_at_put(which, JVM_CONSTANT_Utf8);
302 *symbol_at_addr(which) = s;
303 }
304
305 void string_at_put(int which, int obj_index, oop str);
306
307 // For temporary use while constructing constant pool
308 void string_index_at_put(int which, int string_index) {
309 tag_at_put(which, JVM_CONSTANT_StringIndex);
310 *int_at_addr(which) = string_index;
311 }
312
313 void field_at_put(int which, int class_index, int name_and_type_index) {
314 tag_at_put(which, JVM_CONSTANT_Fieldref);
315 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
316 }
317
318 void method_at_put(int which, int class_index, int name_and_type_index) {
319 tag_at_put(which, JVM_CONSTANT_Methodref);
320 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
321 }
322
323 void interface_method_at_put(int which, int class_index, int name_and_type_index) {
324 tag_at_put(which, JVM_CONSTANT_InterfaceMethodref);
325 *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index; // Not so nice
|