Class Ruva::VM::Class::Method
In: lib/ruva/class.rb
Parent: Object

Methods

Included Modules

AccessHelpers

Constants

ACC_PUBLIC = 0x0001
ACC_PRIVATE = 0x0002
ACC_PROTECTED = 0x0004
ACC_STATIC = 0x0008
ACC_FINAL = 0x0010
ACC_SYNCHRONIZED = 0x0020
ACC_BRIDGE = 0x0040
ACC_VARARGS = 0x0080
ACC_NATIVE = 0x0100
ACC_ABSTRACT = 0x0400
ACC_STRICT = 0x0800
ACC_SYNTHETIC = 0x1000
TYPES_RE = /(B|C|D|F|I|J|L[^;]+;|S|V|Z)/

Attributes

access  [RW] 
annotations  [RW] 
attrs  [RW] 
clz  [RW] 
code  [RW] 
desc  [RW] 
exception_handlers  [RW] 
line_numbers  [RW] 
local_variables  [RW] 
max_locals  [RW] 
max_stack  [RW] 
name  [RW] 
parameter_annotations  [RW] 
signature  [RW] 
throws  [RW] 

Public Class methods

[Source]

     # File lib/ruva/class.rb, line 324
324:         def initialize(clz, access, name, desc, signature, throws)
325:           self.clz, self.access, self.name, self.desc, self.signature, self.throws, = 
326:             clz, access, name, desc, signature, throws
327:             
328:           self.attrs, self.annotations, self.parameter_annotations, self.local_variables, 
329:             self.line_numbers, self.exception_handlers = [], [], [], [], [], {}
330:             
331:           @code = []
332:         end

Public Instance methods

[Source]

     # File lib/ruva/class.rb, line 339
339:         def arg_count
340:           @arg_count ||= arg_types.length
341:         end

Args length on stack / in locals. This is the actual number of slots taken up, including double slots for cat2s.

[Source]

     # File lib/ruva/class.rb, line 345
345:         def arg_length
346:           @arg_length ||= arg_types.inject(0) { |s,type| s + (['J','D'].include?(type) ? 2 : 1) }
347:         end

gets the individual arg types from the descriptor

[Source]

     # File lib/ruva/class.rb, line 335
335:         def arg_types
336:           @arg_types ||= desc[/\([^\)]*\)/].scan(TYPES_RE).flatten
337:         end

Get the return type from the descriptor

[Source]

     # File lib/ruva/class.rb, line 350
350:         def return_type
351:           @return_type ||= desc[/\([^\)]*\)#{TYPES_RE}/,1]
352:         end

[Source]

     # File lib/ruva/class.rb, line 358
358:         def to_s
359:           "#{Class.human_access_method(self)}#{Class.human_desc(return_type)} #{name}(#{Class.human_argdescs(arg_types).join(', ')})"
360:         end

—===—===—===—===

[Source]

     # File lib/ruva/class.rb, line 364
364:         def visit_annotation(desc, visible)
365:           annotations << a = Annotation.new(desc, visible)
366:           a
367:         end

[Source]

     # File lib/ruva/class.rb, line 369
369:         def visit_annotation_default
370:           annotations << a = Annotation.new
371:           a
372:         end

[Source]

     # File lib/ruva/class.rb, line 374
374:         def visit_attribute(attr)
375:           attrs << attr
376:         end

[Source]

     # File lib/ruva/class.rb, line 390
390:         def visit_code(code)
391:           self.code = code
392:         end

[Source]

     # File lib/ruva/class.rb, line 403
403:         def visit_end
404:         end

[Source]

     # File lib/ruva/class.rb, line 394
394:         def visit_exception_handler(start_pc, end_pc, handler_pc, catch_type)  
395:           (exception_handlers[catch_type] ||= []) << Exception.new(start_pc, end_pc, handler_pc)              
396:         end

[Source]

     # File lib/ruva/class.rb, line 378
378:         def visit_line_number(line, start_ofs)
379:           line_numbers << LineNumber.new(line, start_ofs)          
380:         end

[Source]

     # File lib/ruva/class.rb, line 382
382:         def visit_local_variable(name, desc, signature, start_ofs, end_ofs, index) 
383:           local_variables << LocalVariable.new(name, desc, signature, start_ofs, end_ofs, index)
384:         end

[Source]

     # File lib/ruva/class.rb, line 386
386:         def visit_maxs(max_stack, max_locals) 
387:           self.max_stack, self.max_locals = max_stack, max_locals
388:         end

[Source]

     # File lib/ruva/class.rb, line 398
398:         def visit_parameter_annotation(parameter_idx, desc, visible)
399:           (parameter_annotations[parameter_idx] ||= []) << a = Annotation.new(desc, visible)
400:           a
401:         end

[Source]

     # File lib/ruva/class.rb, line 354
354:         def void?
355:           return_type == 'V'
356:         end

[Validate]