Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/interp_masm_x86.cpp @ 23614:32b682649973 jdk8u75-b04
8132051: Better byte behavior
Reviewed-by: coleenp, roland
author | kevinw |
---|---|
date | Fri, 15 Jan 2016 22:33:15 +0000 |
parents | ce9fd31ffd14 |
children | b5f3a471e646 |
comparison
equal
deleted
inserted
replaced
23613:b374548dcb48 | 23614:32b682649973 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 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. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
24 | 24 |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "interp_masm_x86.hpp" | 26 #include "interp_masm_x86.hpp" |
27 #include "interpreter/interpreter.hpp" | 27 #include "interpreter/interpreter.hpp" |
28 #include "oops/methodData.hpp" | 28 #include "oops/methodData.hpp" |
29 | |
30 | |
31 // 8u does not have InterpreterMacroAssembler::load_earlyret_value here | |
32 | |
33 void InterpreterMacroAssembler::narrow(Register result) { | |
34 | |
35 // Get method->_constMethod->_result_type | |
36 movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); | |
37 movptr(rcx, Address(rcx, Method::const_offset())); | |
38 load_unsigned_byte(rcx, Address(rcx, ConstMethod::result_type_offset())); | |
39 | |
40 Label done, notBool, notByte, notChar; | |
41 | |
42 // common case first | |
43 cmpl(rcx, T_INT); | |
44 jcc(Assembler::equal, done); | |
45 | |
46 // mask integer result to narrower return type. | |
47 cmpl(rcx, T_BOOLEAN); | |
48 jcc(Assembler::notEqual, notBool); | |
49 andl(result, 0x1); | |
50 jmp(done); | |
51 | |
52 bind(notBool); | |
53 cmpl(rcx, T_BYTE); | |
54 jcc(Assembler::notEqual, notByte); | |
55 LP64_ONLY(movsbl(result, result);) | |
56 NOT_LP64(shll(result, 24);) // truncate upper 24 bits | |
57 NOT_LP64(sarl(result, 24);) // and sign-extend byte | |
58 jmp(done); | |
59 | |
60 bind(notByte); | |
61 cmpl(rcx, T_CHAR); | |
62 jcc(Assembler::notEqual, notChar); | |
63 LP64_ONLY(movzwl(result, result);) | |
64 NOT_LP64(andl(result, 0xFFFF);) // truncate upper 16 bits | |
65 jmp(done); | |
66 | |
67 bind(notChar); | |
68 // cmpl(rcx, T_SHORT); // all that's left | |
69 // jcc(Assembler::notEqual, done); | |
70 LP64_ONLY(movswl(result, result);) | |
71 NOT_LP64(shll(result, 16);) // truncate upper 16 bits | |
72 NOT_LP64(sarl(result, 16);) // and sign-extend short | |
73 | |
74 // Nothing to do for T_INT | |
75 bind(done); | |
76 } | |
29 | 77 |
30 #ifndef CC_INTERP | 78 #ifndef CC_INTERP |
31 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) { | 79 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) { |
32 Label update, next, none; | 80 Label update, next, none; |
33 | 81 |