22
22
import com .oracle .truffle .api .profiles .InlinedLoopConditionProfile ;
23
23
import com .oracle .truffle .api .strings .AbstractTruffleString ;
24
24
import com .oracle .truffle .api .strings .TruffleString ;
25
+ import org .graalvm .shadowed .org .joni .MultiRegion ;
25
26
import org .graalvm .shadowed .org .joni .NameEntry ;
26
27
import org .graalvm .shadowed .org .joni .Regex ;
27
- import org .graalvm .shadowed .org .joni .Region ;
28
28
import org .graalvm .shadowed .org .joni .exception .ValueException ;
29
29
import org .truffleruby .annotations .CoreMethod ;
30
30
import org .truffleruby .builtins .CoreMethodArrayArgumentsNode ;
@@ -104,20 +104,20 @@ private static void forceLazyMatchData(RubyMatchData matchData, InteropLibrary i
104
104
}
105
105
106
106
@ TruffleBoundary
107
- private static Region getCharOffsetsManyRegs (RubyMatchData matchData , AbstractTruffleString source ,
107
+ private static MultiRegion getCharOffsetsManyRegs (RubyMatchData matchData , AbstractTruffleString source ,
108
108
RubyEncoding encoding ) {
109
109
// Taken from org.jruby.RubyMatchData
110
110
111
111
assert !encoding .isSingleByte : "Should be checked by callers" ;
112
112
113
- final Region regs = matchData .region ;
113
+ final MultiRegion regs = matchData .region ;
114
114
int numRegs = regs .getNumRegs ();
115
115
116
116
if (matchData .tRegexResult != null ) {
117
117
forceLazyMatchData (matchData , InteropLibrary .getUncached (matchData .tRegexResult ));
118
118
}
119
119
120
- final Region charOffsets = Region . newRegion (numRegs );
120
+ final MultiRegion charOffsets = new MultiRegion (numRegs );
121
121
122
122
final Pair [] pairs = new Pair [numRegs * 2 ];
123
123
for (int i = 0 ; i < pairs .length ; i ++) {
@@ -170,15 +170,16 @@ private static void updatePairs(AbstractTruffleString source, RubyEncoding encod
170
170
}
171
171
172
172
@ TruffleBoundary
173
- private static Region createCharOffsets (RubyMatchData matchData , AbstractTruffleString source ,
173
+ private static MultiRegion createCharOffsets (RubyMatchData matchData , AbstractTruffleString source ,
174
174
RubyEncoding encoding ) {
175
- final Region charOffsets = getCharOffsetsManyRegs (matchData , source , encoding );
175
+ final MultiRegion charOffsets = getCharOffsetsManyRegs (matchData , source , encoding );
176
176
matchData .charOffsets = charOffsets ;
177
177
return charOffsets ;
178
178
}
179
179
180
- private static Region getCharOffsets (RubyMatchData matchData , AbstractTruffleString source , RubyEncoding encoding ) {
181
- final Region charOffsets = matchData .charOffsets ;
180
+ private static MultiRegion getCharOffsets (RubyMatchData matchData , AbstractTruffleString source ,
181
+ RubyEncoding encoding ) {
182
+ final MultiRegion charOffsets = matchData .charOffsets ;
182
183
if (charOffsets != null ) {
183
184
return charOffsets ;
184
185
} else {
@@ -189,7 +190,7 @@ private static Region getCharOffsets(RubyMatchData matchData, AbstractTruffleStr
189
190
@ TruffleBoundary
190
191
private static void fixupMatchDataForStart (RubyMatchData matchData , int startPos ) {
191
192
assert startPos != 0 ;
192
- Region regs = matchData .region ;
193
+ MultiRegion regs = matchData .region ;
193
194
for (int i = 0 ; i < regs .getNumRegs (); i ++) {
194
195
assert regs .getBeg (i ) != RubyMatchData .LAZY && regs
195
196
.getEnd (i ) != RubyMatchData .LAZY : "Group bounds must be computed before fixupMatchDataForStart()" ;
@@ -223,7 +224,7 @@ public abstract static class MatchDataCreateSingleGroupNode extends PrimitiveArr
223
224
224
225
@ Specialization
225
226
Object create (Object regexp , Object string , int start , int end ) {
226
- final Region region = Region . newRegion (start , end );
227
+ final MultiRegion region = new MultiRegion (start , end );
227
228
RubyMatchData matchData = new RubyMatchData (
228
229
coreLibrary ().matchDataClass ,
229
230
getLanguage ().matchDataShape ,
@@ -255,7 +256,7 @@ Object getIndex(RubyMatchData matchData, int index, NotProvided length,
255
256
@ Cached @ Exclusive InlinedConditionProfile hasValueProfile ,
256
257
@ Cached TruffleString .SubstringByteIndexNode substringNode ) {
257
258
258
- final Region region = matchData .region ;
259
+ final MultiRegion region = matchData .region ;
259
260
if (normalizedIndexProfile .profile (this , index < 0 )) {
260
261
index += region .getNumRegs ();
261
262
}
@@ -544,7 +545,7 @@ Object[] getValues(RubyMatchData matchData,
544
545
@ Cached InlinedLoopConditionProfile loopProfile ,
545
546
@ Cached TruffleString .SubstringByteIndexNode substringNode ) {
546
547
final Object source = matchData .source ;
547
- final Region region = matchData .region ;
548
+ final MultiRegion region = matchData .region ;
548
549
final Object [] values = new Object [region .getNumRegs ()];
549
550
550
551
int n = 0 ;
0 commit comments