Skip to content

Commit 81e816f

Browse files
committed
[GR-17457] Remove unnecessary boundaries for Time methods
PullRequest: truffleruby/2696
2 parents 2d75a98 + 92f5442 commit 81e816f

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/main/java/org/truffleruby/core/time/TimeNodes.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ protected RubyTime allocate(RubyClass rubyClass) {
7474

7575
@CoreMethod(names = "initialize_copy", required = 1)
7676
public abstract static class InitializeCopyNode extends CoreMethodArrayArgumentsNode {
77-
7877
@Specialization
7978
protected RubyTime initializeCopy(RubyTime self, RubyTime from) {
8079
self.dateTime = from.dateTime;
@@ -84,7 +83,6 @@ protected RubyTime initializeCopy(RubyTime self, RubyTime from) {
8483
self.isUtc = from.isUtc;
8584
return self;
8685
}
87-
8886
}
8987

9088
@Primitive(name = "time_localtime")
@@ -140,7 +138,6 @@ private ZonedDateTime withZone(ZonedDateTime dateTime, ZoneId zone) {
140138

141139
@Primitive(name = "time_add")
142140
public abstract static class TimeAddNode extends PrimitiveArrayArgumentsNode {
143-
144141
@TruffleBoundary
145142
@Specialization
146143
protected RubyTime add(RubyTime time, long seconds, long nanoSeconds) {
@@ -229,54 +226,42 @@ private ZonedDateTime getDateTime(long seconds, int nanoseconds, ZoneId timeZone
229226

230227
@CoreMethod(names = { "to_i", "tv_sec" })
231228
public abstract static class TimeSecondsSinceEpochNode extends CoreMethodArrayArgumentsNode {
232-
233229
@TruffleBoundary
234230
@Specialization
235231
protected long timeSeconds(RubyTime time) {
236232
return time.dateTime.toInstant().getEpochSecond();
237233
}
238-
239234
}
240235

241236
@CoreMethod(names = { "usec", "tv_usec" })
242237
public abstract static class TimeMicroSecondsNode extends CoreMethodArrayArgumentsNode {
243-
244-
@TruffleBoundary
245238
@Specialization
246239
protected int timeUSec(RubyTime time) {
247240
return time.dateTime.getNano() / 1000;
248241
}
249-
250242
}
251243

252244
@CoreMethod(names = { "nsec", "tv_nsec" })
253245
public abstract static class TimeNanoSecondsNode extends CoreMethodArrayArgumentsNode {
254-
255-
@TruffleBoundary
256246
@Specialization
257247
protected int timeNSec(RubyTime time) {
258248
return time.dateTime.getNano();
259249
}
260-
261250
}
262251

263252
@Primitive(name = "time_set_nseconds", lowerFixnum = 1)
264253
public abstract static class TimeSetNSecondsPrimitiveNode extends PrimitiveArrayArgumentsNode {
265-
266254
@TruffleBoundary
267255
@Specialization
268256
protected long timeSetNSeconds(RubyTime time, int nanoseconds) {
269257
final ZonedDateTime dateTime = time.dateTime;
270258
time.dateTime = dateTime.plusNanos(nanoseconds - dateTime.getNano());
271259
return nanoseconds;
272260
}
273-
274261
}
275262

276263
@CoreMethod(names = { "utc_offset", "gmt_offset", "gmtoff" })
277264
public abstract static class TimeUTCOffsetNode extends CoreMethodArrayArgumentsNode {
278-
279-
@TruffleBoundary
280265
@Specialization
281266
protected int timeUTCOffset(RubyTime time) {
282267
return time.dateTime.getOffset().getTotalSeconds();
@@ -285,73 +270,54 @@ protected int timeUTCOffset(RubyTime time) {
285270

286271
@CoreMethod(names = "sec")
287272
public abstract static class TimeSecNode extends CoreMethodArrayArgumentsNode {
288-
289-
@TruffleBoundary
290273
@Specialization
291274
protected int timeSec(RubyTime time) {
292275
return time.dateTime.getSecond();
293276
}
294-
295277
}
296278

297279
@CoreMethod(names = "min")
298280
public abstract static class TimeMinNode extends CoreMethodArrayArgumentsNode {
299-
300-
@TruffleBoundary
301281
@Specialization
302282
protected int timeMin(RubyTime time) {
303283
return time.dateTime.getMinute();
304284
}
305-
306285
}
307286

308287
@CoreMethod(names = "hour")
309288
public abstract static class TimeHourNode extends CoreMethodArrayArgumentsNode {
310-
311-
@TruffleBoundary
312289
@Specialization
313290
protected int timeHour(RubyTime time) {
314291
return time.dateTime.getHour();
315292
}
316-
317293
}
318294

319295
@CoreMethod(names = { "day", "mday" })
320296
public abstract static class TimeDayNode extends CoreMethodArrayArgumentsNode {
321-
322-
@TruffleBoundary
323297
@Specialization
324298
protected int timeDay(RubyTime time) {
325299
return time.dateTime.getDayOfMonth();
326300
}
327-
328301
}
329302

330303
@CoreMethod(names = { "mon", "month" })
331304
public abstract static class TimeMonthNode extends CoreMethodArrayArgumentsNode {
332-
333-
@TruffleBoundary
334305
@Specialization
335306
protected int timeMonth(RubyTime time) {
336307
return time.dateTime.getMonthValue();
337308
}
338-
339309
}
340310

341311
@CoreMethod(names = "year")
342312
public abstract static class TimeYearNode extends CoreMethodArrayArgumentsNode {
343-
344-
@TruffleBoundary
345313
@Specialization
346314
protected int timeYear(RubyTime time) {
347315
return time.dateTime.getYear();
348316
}
349-
350317
}
351318

352319
@CoreMethod(names = "wday")
353320
public abstract static class TimeWeekDayNode extends CoreMethodArrayArgumentsNode {
354-
355321
@TruffleBoundary
356322
@Specialization
357323
protected int timeWeekDay(RubyTime time) {
@@ -361,50 +327,41 @@ protected int timeWeekDay(RubyTime time) {
361327
}
362328
return wday;
363329
}
364-
365330
}
366331

367332
@CoreMethod(names = "yday")
368333
public abstract static class TimeYearDayNode extends CoreMethodArrayArgumentsNode {
369-
370334
@TruffleBoundary
371335
@Specialization
372336
protected int timeYeayDay(RubyTime time) {
373337
return time.dateTime.getDayOfYear();
374338
}
375-
376339
}
377340

378341
@CoreMethod(names = { "dst?", "isdst" })
379342
public abstract static class TimeIsDSTNode extends CoreMethodArrayArgumentsNode {
380-
381343
@TruffleBoundary
382344
@Specialization
383345
protected boolean timeIsDST(RubyTime time) {
384346
final ZonedDateTime dateTime = time.dateTime;
385347
return dateTime.getZone().getRules().isDaylightSavings(dateTime.toInstant());
386348
}
387-
388349
}
389350

390351
@CoreMethod(names = { "utc?", "gmt?" })
391352
public abstract static class IsUTCNode extends CoreMethodArrayArgumentsNode {
392-
393353
@Specialization
394354
protected boolean isUTC(RubyTime time) {
395355
return time.isUtc;
396356
}
397-
398357
}
399358

400359
@Primitive(name = "time_zone")
401360
public abstract static class TimeZoneNode extends PrimitiveArrayArgumentsNode {
402-
403361
@Specialization
404362
protected Object timeZone(RubyTime time) {
405363
return time.zone;
406364
}
407-
408365
}
409366

410367
@Primitive(name = "time_strftime")

0 commit comments

Comments
 (0)