| Class | Ruva::VM::Class::Method |
| In: |
lib/ruva/class.rb
|
| Parent: | Object |
| 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)/ |
| 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] |
# 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
Args length on stack / in locals. This is the actual number of slots taken up, including double slots for cat2s.
# 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
# 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
# File lib/ruva/class.rb, line 350
350: def return_type
351: @return_type ||= desc[/\([^\)]*\)#{TYPES_RE}/,1]
352: end
# 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
—===—===—===—===
# File lib/ruva/class.rb, line 364
364: def visit_annotation(desc, visible)
365: annotations << a = Annotation.new(desc, visible)
366: a
367: end
# File lib/ruva/class.rb, line 369
369: def visit_annotation_default
370: annotations << a = Annotation.new
371: a
372: end
# 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
# 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
# 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
# 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