< prev index next >

make/jdk/src/classes/build/tools/charsetmapping/SBCS.java

Print this page
rev 56460 : 8231717: Improve performance of charset decoding when charset is always compactable

*** 1,7 **** /* ! * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 44,53 **** --- 44,54 ---- String clzName = cs.clzName; String csName = cs.csName; String hisName = cs.hisName; String pkgName = cs.pkgName; boolean isASCII = cs.isASCII; + boolean isAlwaysCompactable = true; StringBuilder b2cSB = new StringBuilder(); StringBuilder b2cNRSB = new StringBuilder(); StringBuilder c2bNRSB = new StringBuilder();
*** 67,76 **** --- 68,80 ---- sb[e.bs] = (char)e.cp; if (c2bIndex[e.cp>>8] == UNMAPPABLE_DECODING) { c2bOff += 0x100; c2bIndex[e.cp>>8] = 1; } + if (e.cp > 0xFF) { + isAlwaysCompactable = false; + } } Formatter fm = new Formatter(b2cSB); fm.format("%n");
*** 176,185 **** --- 180,192 ---- line = " return (cs instanceof " + clzName + ");"; } if (line.indexOf("$ASCIICOMPATIBLE$") != -1) { line = line.replace("$ASCIICOMPATIBLE$", isASCII ? "true" : "false"); } + if (line.indexOf("$ALWAYSCOMPACTABLE$") != -1) { + line = line.replace("$ALWAYSCOMPACTABLE$", isAlwaysCompactable ? "true" : "false"); + } if (line.indexOf("$B2CTABLE$") != -1) { line = line.replace("$B2CTABLE$", b2c); } if (line.indexOf("$C2BLENGTH$") != -1) { line = line.replace("$C2BLENGTH$", "0x" + Integer.toString(c2bOff, 16));
< prev index next >